[libvirt PATCH] qemu_snapshot: external: don't error out when updating metadata

Pavel Hrdina phrdina at redhat.com
Mon Mar 27 10:47:11 UTC 2023


Attaching disk into running VM the offilne 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 at redhat.com>
---
 src/qemu/qemu_snapshot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 14353c6f0d..e36d6288ac 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -2464,8 +2464,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;
-- 
2.39.2



More information about the libvir-list mailing list