The 'xbzrle-cache-size' parameter was added in qemu-2.11 thus all supported qemu versions now use the new code path. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 56 +++++++++----------------------- src/qemu/qemu_migration_params.c | 18 ---------- 2 files changed, 16 insertions(+), 58 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0a5239e136..75c7a8a6b2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13161,10 +13161,8 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom, { virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; - qemuDomainObjPrivate *priv; g_autoptr(qemuMigrationParams) migParams = NULL; int ret = -1; - int rc; virCheckFlags(0, -1); @@ -13180,8 +13178,6 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom, if (virDomainObjCheckActive(vm) < 0) goto endjob; - priv = vm->privateData; - if (!qemuMigrationCapsGet(vm, QEMU_MIGRATION_CAP_XBZRLE)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("Compressed migration is not supported by " @@ -13189,22 +13185,14 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom, goto endjob; } - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE)) { - if (qemuMigrationParamsFetch(driver, vm, VIR_ASYNC_JOB_NONE, - &migParams) < 0) - goto endjob; + if (qemuMigrationParamsFetch(driver, vm, VIR_ASYNC_JOB_NONE, + &migParams) < 0) + goto endjob; - if (qemuMigrationParamsGetULL(migParams, - QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE, - cacheSize) < 0) - goto endjob; - } else { - qemuDomainObjEnterMonitor(driver, vm); - rc = qemuMonitorGetMigrationCacheSize(priv->mon, cacheSize); - qemuDomainObjExitMonitor(vm); - if (rc < 0) - goto endjob; - } + if (qemuMigrationParamsGetULL(migParams, + QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE, + cacheSize) < 0) + goto endjob; ret = 0; @@ -13223,10 +13211,8 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom, { virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; - qemuDomainObjPrivate *priv; g_autoptr(qemuMigrationParams) migParams = NULL; int ret = -1; - int rc; virCheckFlags(0, -1); @@ -13242,8 +13228,6 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom, if (virDomainObjCheckActive(vm) < 0) goto endjob; - priv = vm->privateData; - if (!qemuMigrationCapsGet(vm, QEMU_MIGRATION_CAP_XBZRLE)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("Compressed migration is not supported by " @@ -13252,25 +13236,17 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom, } VIR_DEBUG("Setting compression cache to %llu B", cacheSize); - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE)) { - if (!(migParams = qemuMigrationParamsNew())) - goto endjob; + if (!(migParams = qemuMigrationParamsNew())) + goto endjob; - if (qemuMigrationParamsSetULL(migParams, - QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE, - cacheSize) < 0) - goto endjob; + if (qemuMigrationParamsSetULL(migParams, + QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE, + cacheSize) < 0) + goto endjob; - if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE, - migParams, 0) < 0) - goto endjob; - } else { - qemuDomainObjEnterMonitor(driver, vm); - rc = qemuMonitorSetMigrationCacheSize(priv->mon, cacheSize); - qemuDomainObjExitMonitor(vm); - if (rc < 0) - goto endjob; - } + if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE, + migParams, 0) < 0) + goto endjob; ret = 0; diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c index 6ea0bde13a..0bce358ac3 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -886,10 +886,8 @@ qemuMigrationParamsApply(virQEMUDriver *driver, unsigned long apiFlags) { qemuDomainObjPrivate *priv = vm->privateData; - bool xbzrleCacheSize_old = false; g_autoptr(virJSONValue) params = NULL; g_autoptr(virJSONValue) caps = NULL; - qemuMigrationParam xbzrle = QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE; bool postcopyResume = !!(apiFlags & VIR_MIGRATE_POSTCOPY_RESUME); int ret = -1; @@ -917,19 +915,6 @@ qemuMigrationParamsApply(virQEMUDriver *driver, } } - /* If QEMU is too old to support xbzrle-cache-size migration parameter, - * we need to set it via migrate-set-cache-size and tell - * qemuMonitorSetMigrationParams to ignore this parameter. - */ - if (migParams->params[xbzrle].set && - !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE)) { - if (qemuMonitorSetMigrationCacheSize(priv->mon, - migParams->params[xbzrle].value.ull) < 0) - goto cleanup; - xbzrleCacheSize_old = true; - migParams->params[xbzrle].set = false; - } - if (!(params = qemuMigrationParamsToJSON(migParams, postcopyResume))) goto cleanup; @@ -942,9 +927,6 @@ qemuMigrationParamsApply(virQEMUDriver *driver, cleanup: qemuDomainObjExitMonitor(vm); - if (xbzrleCacheSize_old) - migParams->params[xbzrle].set = true; - return ret; } -- 2.36.1