]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_migration_params: Refactor qemuMigrationParamsReset
authorJiri Denemark <jdenemar@redhat.com>
Thu, 21 Jul 2022 14:49:09 +0000 (16:49 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 26 Jul 2022 08:09:01 +0000 (10:09 +0200)
Because qemuMigrationParamsReset used to call qemuMigrationParamsApply
for resetting migration capabilities and parameters, it did not work
well since commit v5.1.0-83-ga1dec315c9 which only allowed capabilities
to be set from an async job. However, when reconnecting to running
domains after daemon restart we do not have an async job. Thus the
capabilities were not properly reset in case the daemon was restarted
during an ongoing migration. We need to avoid calling
qemuMigrationParamsApply to make sure both parameters and capabilities
can be reset by a normal job.

https://bugzilla.redhat.com/show_bug.cgi?id=2107892

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_migration_params.c

index dcfb30b56f868c439a996b2ac2496c1c9c511001..be7966a18a77312bb498c48b345c7b56b83f2fbc 100644 (file)
@@ -1290,6 +1290,7 @@ qemuMigrationParamsReset(virQEMUDriver *driver,
                          unsigned long apiFlags)
 {
     virErrorPtr err;
+    g_autoptr(virBitmap) clearCaps = NULL;
 
     virErrorPreserveLast(&err);
 
@@ -1299,13 +1300,16 @@ qemuMigrationParamsReset(virQEMUDriver *driver,
     if (!virDomainObjIsActive(vm) || !origParams)
         goto cleanup;
 
-    /* Do not pass apiFlags to qemuMigrationParamsApply here to make sure all
-     * parameters and capabilities are reset. */
-    if (qemuMigrationParamsApply(driver, vm, asyncJob, origParams, 0) < 0)
+    if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
         goto cleanup;
 
-    qemuMigrationParamsResetTLS(driver, vm, asyncJob, origParams, apiFlags);
-    /* We don't reset 'block-bitmap-mapping' as it can't be unset */
+    clearCaps = virBitmapNew(0);
+
+    if (qemuMigrationParamsApplyCaps(vm, clearCaps) == 0 &&
+        qemuMigrationParamsApplyValues(vm, origParams, false) == 0)
+        qemuMigrationParamsResetTLS(driver, vm, asyncJob, origParams, apiFlags);
+
+    qemuDomainObjExitMonitor(vm);
 
  cleanup:
     virErrorRestore(&err);