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@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 21 +++++++++++++++++---- tests/qemumonitorjsontest.c | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c9a2081487..820a54ab2b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13967,7 +13967,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); @@ -13992,12 +13994,23 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom, goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PARAM_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); diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 1c58c333d5..d2cd054dbf 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -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", "{" -- 2.27.0