The same functionality can be achieved using migrate-set-parameters QMP
command with downtime-limit parameter.
https://bugzilla.redhat.com/show_bug.cgi?id=1829543
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_driver.c | 27 +++++++++++++++++++++++----
tests/qemumonitorjsontest.c | 2 +-
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 779f28dbbb..c9a2081487 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13853,7 +13853,9 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom,
virQEMUDriverPtr driver = dom->conn->privateData;
virDomainObjPtr vm;
qemuDomainObjPrivatePtr priv;
+ g_autoptr(qemuMigrationParams) migParams = NULL;
int ret = -1;
+ int rc;
virCheckFlags(0, -1);
@@ -13872,10 +13874,27 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom,
priv = vm->privateData;
VIR_DEBUG("Setting migration downtime to %llums", downtime);
- qemuDomainObjEnterMonitor(driver, vm);
- ret = qemuMonitorSetMigrationDowntime(priv->mon, downtime);
- if (qemuDomainObjExitMonitor(driver, vm) < 0)
- ret = -1;
+
+ if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PARAM_DOWNTIME)) {
+ if (!(migParams = qemuMigrationParamsNew()))
+ goto endjob;
+
+ if (qemuMigrationParamsSetULL(migParams,
+ QEMU_MIGRATION_PARAM_DOWNTIME_LIMIT,
+ downtime) < 0)
+ goto endjob;
+
+ if (qemuMigrationParamsApply(driver, vm, QEMU_ASYNC_JOB_NONE,
+ migParams) < 0)
+ goto endjob;
+ } else {
+ qemuDomainObjEnterMonitor(driver, vm);
+ rc = qemuMonitorSetMigrationDowntime(priv->mon, downtime);
+ if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
+ goto endjob;
+ }
+
+ ret = 0;
endjob:
qemuDomainObjEndJob(driver, vm);
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index e8a0508c53..1c58c333d5 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -3221,7 +3221,7 @@ mymain(void)
DO_TEST_GEN(qemuMonitorJSONSaveVirtualMemory);
DO_TEST_GEN(qemuMonitorJSONSavePhysicalMemory);
DO_TEST_GEN_DEPRECATED(qemuMonitorJSONSetMigrationSpeed, true);
- DO_TEST_GEN_DEPRECATED(qemuMonitorJSONSetMigrationDowntime, false);
+ DO_TEST_GEN_DEPRECATED(qemuMonitorJSONSetMigrationDowntime, true);
DO_TEST_GEN(qemuMonitorJSONMigrate);
DO_TEST_GEN(qemuMonitorJSONDump);
DO_TEST_GEN(qemuMonitorJSONGraphicsRelocate);
--
2.27.0