From: Nikolay Shirokovskiy <[email protected]> Don't unnecessarily pause the VM if the snapshot can't be taken.
Signed-off-by: Nikolay Shirokovskiy <[email protected]> Signed-off-by: Peter Krempa <[email protected]> --- src/qemu/qemu_snapshot.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index c8954fd805..b75e2b4233 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1661,6 +1661,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 @@ -1723,10 +1729,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); -- 2.52.0
