mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
qemu_snapshot: fix detection if non-leaf snapshot isn't in active chain
The condition was completely wrong. As per the comment for function virDomainMomentIsAncestor() it checks that the first argument is descendant of the second argument. Consider the following snapshot tree for VM: s1 | +- s2 | | | +- s3 | +- s4 | +- s5 (current) When deleting s2 with the original code we checked if virDomainMomentIsAncestor(s2, s5) which would return false basically for any snapshot as s5 is leaf snapshot so no children. When deleting s2 with fixed code we check if virDomainMomentIsAncestor(s5, s2) which still returns false but when deleting s4 it will correctly return true. Before this fix it fails with the following error: error: Failed to delete snapshot s2 error: invalid argument: could not find base disk source in disk source chain After the fix it fails with correct error: error: Failed to delete snapshot s2 error: unsupported configuration: deletion of non-leaf external snapshot that is not in active chain is not supported Resolves: https://issues.redhat.com/browse/RHEL-23212 Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
18f2bf0a43
commit
7143c4e1f9
@ -3815,7 +3815,7 @@ qemuSnapshotDeleteValidate(virDomainObj *vm,
|
||||
}
|
||||
|
||||
if (snap != current && snap->nchildren != 0 &&
|
||||
virDomainMomentIsAncestor(snap, current)) {
|
||||
!virDomainMomentIsAncestor(current, snap)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("deletion of non-leaf external snapshot that is not in active chain is not supported"));
|
||||
return -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user