From: Nikolay Shirokovskiy Date: Thu, 11 Nov 2021 08:55:46 +0000 (+0300) Subject: qemu: snapshot: Check earlier if memory snapshot is possible X-Git-Tag: v12.0.0-rc1~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ccf008b85fbfb4af49b31ae23877aeccd042869e;p=thirdparty%2Flibvirt.git qemu: snapshot: Check earlier if memory snapshot is possible Don't unnecessarily pause the VM if the snapshot can't be taken. Signed-off-by: Nikolay Shirokovskiy Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 0338641559..e738afffc3 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1665,6 +1665,12 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver, virQEMUSaveData *data = NULL; g_autoptr(GHashTable) blockNamedNodeData = NULL; + if (memory) { + /* When doing a snapshot with memory check if migration is possible */ + if (!qemuMigrationSrcIsAllowed(vm, false, VIR_ASYNC_JOB_SNAPSHOT, 0)) + return -1; + } + /* If quiesce was requested, then issue a freeze command, and a * counterpart thaw command when it is actually sent to agent. * The command will fail if the guest is paused or the guest agent @@ -1727,10 +1733,6 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver, if (memory) { g_autoptr(qemuMigrationParams) snap_params = NULL; - /* check if migration is possible */ - if (!qemuMigrationSrcIsAllowed(vm, false, VIR_ASYNC_JOB_SNAPSHOT, 0)) - goto cleanup; - qemuDomainJobSetStatsType(vm->job->current, QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP);