diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b47085febb..b6f81d5c71 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13857,7 +13857,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); @@ -13876,10 +13878,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);