[PATCH 1/9] qemu: make snap possibility check before pausing CPUS

Nikolay Shirokovskiy posted 9 patches 4 years, 3 months ago
[PATCH 1/9] qemu: make snap possibility check before pausing CPUS
Posted by Nikolay Shirokovskiy 4 years, 3 months ago
This way we won't unnecessaryly pause VMs. Looks like pausing does not
afect qemuMigrationSrcIsAllowed checks so we can check without pausing.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.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 d105eead27..007c55b82a 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -1363,6 +1363,10 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver,
     virQEMUSaveData *data = NULL;
     g_autoptr(GHashTable) blockNamedNodeData = NULL;
 
+    /* check if migration is possible */
+    if (memory && !qemuMigrationSrcIsAllowed(driver, vm, false, 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
@@ -1423,10 +1427,6 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver,
 
     /* do the memory snapshot if necessary */
     if (memory) {
-        /* check if migration is possible */
-        if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
-            goto cleanup;
-
         priv->job.current->statsType = QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP;
 
         /* allow the migration job to be cancelled or the domain to be paused */
-- 
2.27.0

Re: [PATCH 1/9] qemu: make snap possibility check before pausing CPUS
Posted by Peter Krempa 4 years, 2 months ago
On Thu, Nov 11, 2021 at 11:55:46 +0300, Nikolay Shirokovskiy wrote:
> This way we won't unnecessaryly pause VMs. Looks like pausing does not
> afect qemuMigrationSrcIsAllowed checks so we can check without pausing.
> 
> Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
> ---
>  src/qemu/qemu_snapshot.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>