]> xenbits.xensource.com Git - libvirt.git/commit
qemu_snapshot: correctly update metadata when deleting external snapshot with multipl...
authorPavel Hrdina <phrdina@redhat.com>
Wed, 21 Feb 2024 16:45:50 +0000 (17:45 +0100)
committerPavel Hrdina <phrdina@redhat.com>
Tue, 2 Apr 2024 12:14:26 +0000 (14:14 +0200)
commit0a164b74eb21d78bbaba28b6f2dfa7f2ba58318c
tree3c13ab354ffcdb1abf4e0882ede328ef7449ec81
parent79654f425c3ea6d421dcf0fe109cf0bb6d741d61
qemu_snapshot: correctly update metadata when deleting external snapshot with multiple branches

XML metadata for snapshot contains only single list of disk overlays
from the moment when the snapshot was taken. When user creates multiple
branches of snapshots the parent snapshot will still list only the
original disk overlays. This may cause an issue in a specific scenario:

     s1
      |
      +- s2
      +- s3 (active)

For this snapshot topology when we delete s2 metadata for s1 are not
updated. Now when we delete s1 the code operated with incorrect
overlays from s1 metadata in order to update s3 metadata resulting in no
changes to s3 metadata.

Now when user tries to delete s3 it fails with following error:

    error: Failed to delete snapshot s3
    error: operation failed: snapshot VM disk source and parent disk source are not the same

For the actual deletion there is a code to figure out the correct disk
source but it was not used to update metadata as well. Due to reasons
how block commit in libvirt works we need to create a copy of that disk
source in order to have it available when updating metadata as the
original source will be freed at that point.

Resolves: https://issues.redhat.com/browse/RHEL-26276
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_snapshot.c