This is an automated email from the ASF dual-hosted git repository. sureshanaparti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push: new 6ad92964120 Fix KVM incremental snapshot removal when using multiple secondary storages (#11180) 6ad92964120 is described below commit 6ad929641206b073c83727b32ca17167d5be4818 Author: João Jandre <48719461+joaojan...@users.noreply.github.com> AuthorDate: Mon Jul 21 08:17:27 2025 -0300 Fix KVM incremental snapshot removal when using multiple secondary storages (#11180) When removing an incremental snapshot (For both KVM and XenServer), it is checked if the snapshot has a child or not. If it has, then the snapshot is not removed from the storage. For KVM incremental snapshots, snapshots in the same chain may be on different secondary storages (within the same zone). However, the child search process only considers snapshots from the same secondary storage as theirs. Therefore, if a snapshot has its parent snapshot on a different secondary storage, it will be completely removed, making the snapshot chain inconsistent. --- .../java/org/apache/cloudstack/storage/snapshot/SnapshotObject.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/SnapshotObject.java b/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/SnapshotObject.java index 178d42f5c74..6cec193cd0a 100644 --- a/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/SnapshotObject.java +++ b/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/SnapshotObject.java @@ -155,7 +155,9 @@ public class SnapshotObject implements SnapshotInfo { @Override public SnapshotInfo getChild() { QueryBuilder<SnapshotDataStoreVO> sc = QueryBuilder.create(SnapshotDataStoreVO.class); - sc.and(sc.entity().getDataStoreId(), Op.EQ, store.getId()); + if (!HypervisorType.KVM.equals(snapshot.getHypervisorType())) { + sc.and(sc.entity().getDataStoreId(), Op.EQ, store.getId()); + } sc.and(sc.entity().getRole(), Op.EQ, store.getRole()); sc.and(sc.entity().getState(), Op.NIN, State.Destroying, State.Destroyed, State.Error); sc.and(sc.entity().getParentSnapshotId(), Op.EQ, getId());