snapshot: fix listSnapshots for volume which got delete and whose storage pool got deleted

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-15 17:56:10 +05:30 committed by dahn
parent b1f870ae83
commit 9dd8a4cc40
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;