Skip to content

Commit aa1893b

Browse files
committed
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>
1 parent 71f47d6 commit aa1893b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

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
@@ -952,7 +952,7 @@ public StrategyPriority canHandle(Snapshot snapshot, Long zoneId, SnapshotOperat
952952

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

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

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

0 commit comments

Comments
 (0)