[libvirt PATCH 3/3] qemu_migration_params: Refactor qemuMigrationParamsReset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/qemu/qemu_migration_params.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index dcfb30b56f..be7966a18a 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -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);
-- 
2.35.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux