From: Peter Krempa Date: Mon, 1 Dec 2025 15:36:16 +0000 (+0100) Subject: qemu: snapshot: Setup disks for manual snapshot only when the VM is actually paused X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=627bcc8525f93123d3d12ba0e937ee2d450654d4;p=thirdparty%2Flibvirt.git 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 --- 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)