[PATCH 31/68] qemu: Move ParamsCheck closer to ParamsApply on Src side

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

 



We reached the point when qemuMigrationParamsApply is the only API which
sends migration parameters and capabilities to QEMU. Thus all but the
TLS parameters can be set before we ask QEMU for the current values of
all parameters in qemuMigrationParamsCheck.

Supported migration capabilities are queried as soon as libvirt connects
to QEMU monitor so we can check them anytime.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/qemu/qemu_migration.c | 67 +++++++++++++++++++--------------------
 1 file changed, 32 insertions(+), 35 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 5f50795c16..6c736796b4 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3338,6 +3338,34 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
     if (qemuMigrationSrcGraphicsRelocate(driver, vm, mig, graphicsuri) < 0)
         VIR_WARN("unable to provide data for graphics client relocation");
 
+    if (qemuMigrationParamsSetCompression(vm, compression, migParams) < 0)
+        goto error;
+
+    if (qemuMigrationParamsSetCapability(vm,
+                                         QEMU_MONITOR_MIGRATION_CAPS_AUTO_CONVERGE,
+                                         flags & VIR_MIGRATE_AUTO_CONVERGE,
+                                         migParams) < 0)
+        goto error;
+
+    if (qemuMigrationParamsSetCapability(vm,
+                                         QEMU_MONITOR_MIGRATION_CAPS_RDMA_PIN_ALL,
+                                         flags & VIR_MIGRATE_RDMA_PIN_ALL,
+                                         migParams) < 0)
+        goto error;
+
+    if (qemuMigrationParamsSetPostCopy(vm, flags & VIR_MIGRATE_POSTCOPY,
+                                       migParams) < 0)
+        goto error;
+
+    if (qemuMigrationCapsGet(vm, QEMU_MONITOR_MIGRATION_CAPS_PAUSE_BEFORE_SWITCHOVER) &&
+        qemuMigrationParamsSetCapability(vm,
+                                         QEMU_MONITOR_MIGRATION_CAPS_PAUSE_BEFORE_SWITCHOVER,
+                                         true, migParams) < 0)
+        goto error;
+
+    if (qemuMigrationParamsCheck(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
+        goto error;
+
     if (flags & VIR_MIGRATE_TLS) {
         const char *hostname = NULL;
 
@@ -3357,6 +3385,10 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
             goto error;
     }
 
+    if (qemuMigrationParamsApply(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
+                                 migParams) < 0)
+        goto error;
+
     if (migrate_flags & (QEMU_MONITOR_MIGRATE_NON_SHARED_DISK |
                          QEMU_MONITOR_MIGRATE_NON_SHARED_INC)) {
         if (mig->nbd) {
@@ -3385,35 +3417,6 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
             goto error;
     }
 
-    if (qemuMigrationParamsSetCompression(vm, compression, migParams) < 0)
-        goto error;
-
-    if (qemuMigrationParamsSetCapability(vm,
-                                         QEMU_MONITOR_MIGRATION_CAPS_AUTO_CONVERGE,
-                                         flags & VIR_MIGRATE_AUTO_CONVERGE,
-                                         migParams) < 0)
-        goto error;
-
-    if (qemuMigrationParamsSetCapability(vm,
-                                         QEMU_MONITOR_MIGRATION_CAPS_RDMA_PIN_ALL,
-                                         flags & VIR_MIGRATE_RDMA_PIN_ALL,
-                                         migParams) < 0)
-        goto error;
-
-    if (qemuMigrationParamsSetPostCopy(vm, flags & VIR_MIGRATE_POSTCOPY,
-                                       migParams) < 0)
-        goto error;
-
-    if (qemuMigrationCapsGet(vm, QEMU_MONITOR_MIGRATION_CAPS_PAUSE_BEFORE_SWITCHOVER) &&
-        qemuMigrationParamsSetCapability(vm,
-                                         QEMU_MONITOR_MIGRATION_CAPS_PAUSE_BEFORE_SWITCHOVER,
-                                         true, migParams) < 0)
-        goto error;
-
-    if (qemuMigrationParamsApply(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
-                                 migParams) < 0)
-        goto error;
-
     if (qemuDomainObjEnterMonitorAsync(driver, vm,
                                        QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
         goto error;
@@ -4511,9 +4514,6 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver,
 
     qemuMigrationSrcStoreDomainState(vm);
 
-    if (qemuMigrationParamsCheck(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
-        goto endjob;
-
     if ((flags & (VIR_MIGRATE_TUNNELLED | VIR_MIGRATE_PEER2PEER))) {
         ret = qemuMigrationSrcPerformPeer2Peer(driver, conn, vm, xmlin, persist_xml,
                                                dconnuri, uri, graphicsuri, listenAddress,
@@ -4619,9 +4619,6 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver,
     virCloseCallbacksUnset(driver->closeCallbacks, vm,
                            qemuMigrationSrcCleanup);
 
-    if (qemuMigrationParamsCheck(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
-        goto endjob;
-
     ret = qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri, cookiein, cookieinlen,
                                         cookieout, cookieoutlen,
                                         flags, resource, NULL, graphicsuri,
-- 
2.17.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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