Skip to content

Commit 315cd52

Browse files
authored
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 <[email protected]>
1 parent 000919d commit 315cd52

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ public StrategyPriority canHandle(Snapshot snapshot, Long zoneId, SnapshotOperat
951951

952952
VolumeVO volumeVO = volumeDao.findByIdIncludingRemoved(volumeId);
953953

954-
long volumeStoragePoolId = volumeVO.getPoolId();
954+
long volumeStoragePoolId = (volumeVO.getPoolId() != null ? volumeVO.getPoolId() : volumeVO.getLastPoolId());
955955

956956
if (SnapshotOperation.REVERT.equals(op)) {
957957
boolean baseVolumeExists = volumeVO.getRemoved() == null;

0 commit comments

Comments
 (0)