qemu: Avoid deprecated migrate_set_downtime QMP command

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@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Jiri Denemark 2020-06-10 16:13:15 +02:00
parent 92b8dbc66a
commit 65de5f6fe4
2 changed files with 24 additions and 5 deletions

View File

@ -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);

View File

@ -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);