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(a)redhat.com>
---
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 c97911039d..3f443a756b 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3335,6 +3335,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;
@@ -3354,6 +3382,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) {
@@ -3382,35 +3414,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;
@@ -4508,9 +4511,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,
@@ -4616,9 +4616,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