snapshot: fix listSnapshots for volume which got delete and whose storage pool got deleted (#12433)

This fixes the case when the storage pool is removed as well the KVM
host and the subsequent volumes on the host. When that happened, listing
snapshots (for recovery purposes) cause NPE as the pool_id was null, but
last_pool_id for the related destroyed volume wasn't null. This adds a
fallback logic.

Signed-off-by: Rohit Yadav <rohit@yadav.cloud>
This commit is contained in:
Rohit Yadav 2026-01-26 16:23:47 +05:30 committed by GitHub
parent 000919d6e5
commit 315cd52fd1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -951,7 +951,7 @@ public class StorageSystemSnapshotStrategy extends SnapshotStrategyBase {
VolumeVO volumeVO = volumeDao.findByIdIncludingRemoved(volumeId);
long volumeStoragePoolId = volumeVO.getPoolId();
long volumeStoragePoolId = (volumeVO.getPoolId() != null ? volumeVO.getPoolId() : volumeVO.getLastPoolId());
if (SnapshotOperation.REVERT.equals(op)) {
boolean baseVolumeExists = volumeVO.getRemoved() == null;