]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: snapshot: Setup disks for manual snapshot only when the VM is actually paused
authorPeter Krempa <pkrempa@redhat.com>
Mon, 1 Dec 2025 15:36:16 +0000 (16:36 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 10 Dec 2025 10:07:34 +0000 (11:07 +0100)
When creating a snapshot with 'VIR_DOMAIN_SNAPSHOT_CREATE_LIVE' the VM
is paused only after dumping the memory state.

This means that also the steps to do a 'manual' disk snapshot
(deactivation of the block nodes in qemu) must happen only once the VM
is paused.

Move the manual snapshot setup code after the memory snapshot code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_snapshot.c

index 302775af926f38d05918aa8caea8c1424d5e40bf..bf25c70826ed50ac2c6b046743e1f434342d1155 100644 (file)
@@ -1707,10 +1707,6 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver,
         }
     }
 
-    if (has_manual &&
-        qemuSnapshotCreateActiveExternalDisksManual(vm, snap, VIR_ASYNC_JOB_SNAPSHOT) < 0)
-        goto cleanup;
-
     /* We need to collect reply from 'query-named-block-nodes' prior to the
      * migration step as qemu deactivates bitmaps after migration so the result
      * would be wrong */
@@ -1769,6 +1765,10 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver,
 
     /* the domain is now paused if a memory snapshot was requested */
 
+    if (has_manual &&
+        qemuSnapshotCreateActiveExternalDisksManual(vm, snap, VIR_ASYNC_JOB_SNAPSHOT) < 0)
+        goto cleanup;
+
     if ((ret = qemuSnapshotCreateActiveExternalDisks(vm, snap,
                                                      blockNamedNodeData, flags,
                                                      VIR_ASYNC_JOB_SNAPSHOT)) < 0)