qemu: Avoid deprecated query-migrate-cache-size QMP command

The same functionality can be achieved using query-migrate-parameters
QMP command and checking the xbzrle-cache-size parameter.

https://bugzilla.redhat.com/show_bug.cgi?id=1829544

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 65de5f6fe4
commit 0b45addf19
2 changed files with 18 additions and 5 deletions

View File

@ -13971,7 +13971,9 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom,
virQEMUDriverPtr driver = dom->conn->privateData;
virDomainObjPtr vm;
qemuDomainObjPrivatePtr priv;
g_autoptr(qemuMigrationParams) migParams = NULL;
int ret = -1;
int rc;
virCheckFlags(0, -1);
@ -13996,12 +13998,23 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom,
goto endjob;
}
qemuDomainObjEnterMonitor(driver, vm);
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE)) {
if (qemuMigrationParamsFetch(driver, vm, QEMU_ASYNC_JOB_NONE,
&migParams) < 0)
goto endjob;
ret = qemuMonitorGetMigrationCacheSize(priv->mon, cacheSize);
if (qemuMigrationParamsGetULL(migParams,
QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE,
cacheSize) < 0)
goto endjob;
} else {
qemuDomainObjEnterMonitor(driver, vm);
rc = qemuMonitorGetMigrationCacheSize(priv->mon, cacheSize);
if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
goto endjob;
}
if (qemuDomainObjExitMonitor(driver, vm) < 0)
ret = -1;
ret = 0;
endjob:
qemuDomainObjEndJob(driver, vm);

View File

@ -1888,7 +1888,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCacheSize(const void *opaque)
if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
return -1;
qemuMonitorTestSkipDeprecatedValidation(test, false);
qemuMonitorTestSkipDeprecatedValidation(test, true);
if (qemuMonitorTestAddItem(test, "query-migrate-cache-size",
"{"