From 627bcc8525f93123d3d12ba0e937ee2d450654d4 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 1 Dec 2025 16:36:16 +0100 Subject: [PATCH] qemu: snapshot: Setup disks for manual snapshot only when the VM is actually paused 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 Reviewed-by: Michal Privoznik --- 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.47.3