This is an automated email from the ASF dual-hosted git repository.

bstoyanov pushed a commit to branch 4.22
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.22 by this push:
     new 315cd52fd1a snapshot: fix listSnapshots for volume which got delete 
and whose storage pool got deleted (#12433)
315cd52fd1a is described below

commit 315cd52fd1ac7fe461b9ceca6651cddca0382087
Author: Rohit Yadav <[email protected]>
AuthorDate: Mon Jan 26 16:23:47 2026 +0530

    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]>
---
 .../cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
 
b/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
index a19397d03e3..560bb4b2fc1 100644
--- 
a/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
+++ 
b/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
@@ -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;

Reply via email to