[PATCH 2/9] qemu: snapshot: Setup disks for manual snapshot only when the VM is actually paused

Peter Krempa via Devel posted 9 patches 3 days, 3 hours ago
[PATCH 2/9] qemu: snapshot: Setup disks for manual snapshot only when the VM is actually paused
Posted by Peter Krempa via Devel 3 days, 3 hours ago
From: Peter Krempa <pkrempa@redhat.com>

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>
---
 src/qemu/qemu_snapshot.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 302775af92..bf25c70826 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -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)
-- 
2.52.0