]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_snapshot: external: don't error out when updating metadata
authorPavel Hrdina <phrdina@redhat.com>
Tue, 21 Mar 2023 16:42:10 +0000 (17:42 +0100)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Apr 2023 12:32:40 +0000 (14:32 +0200)
Attaching disk into running VM the offline definition may not be
updated and we will end up with that disk existing only in live
definition. Creating snapshot with this state saves both live and
offline definition into snapshot metadata.

When we are deleting an external snapshot we are updating these
definitions in the snapshot metadata so we should just skip over
non-existing disks instead of reporting error.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2174700

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_snapshot.c

index fc04244e74fc836adbdcbdae9122fce14fc9c49b..12ddf19c48ae819b276fc0569182afa7f4ebc4bc 100644 (file)
@@ -2456,8 +2456,8 @@ qemuSnapshotUpdateDisksSingle(virDomainMomentObj *snap,
 {
     virDomainDiskDef *disk = NULL;
 
-    if (!(disk = qemuDomainDiskByName(def, snapDisk->name)))
-        return -1;
+    if (!(disk = virDomainDiskByName(def, snapDisk->name, true)))
+        return 0;
 
     if (virDomainSnapshotIsExternal(snap)) {
         virDomainDiskDef *parentDisk = NULL;