mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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.
This commit is contained in:
parent
c5da9e6188
commit
6ad9296412
@ -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());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user