mirror of https://gitee.com/openkylin/libvirt.git
qemu: Set XBZRLE cache size via migration parameters
Prefer xbzrle-cache-size migration parameter over the special migrate-set-cache-size QMP command. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
323567a6fa
commit
0911dac853
|
@ -2383,8 +2383,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
|
|||
if (qemuMigrationParamsCheck(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN) < 0)
|
||||
goto stopjob;
|
||||
|
||||
if (qemuMigrationParamsSetCompression(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN,
|
||||
compression, migParams) < 0)
|
||||
if (qemuMigrationParamsSetCompression(vm, compression, migParams) < 0)
|
||||
goto stopjob;
|
||||
|
||||
/* Migrations using TLS need to add the "tls-creds-x509" object and
|
||||
|
@ -3383,8 +3382,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (qemuMigrationParamsSetCompression(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
|
||||
compression, migParams) < 0)
|
||||
if (qemuMigrationParamsSetCompression(vm, compression, migParams) < 0)
|
||||
goto error;
|
||||
|
||||
if (qemuMigrationParamsSetCapability(vm,
|
||||
|
|
|
@ -141,6 +141,7 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver,
|
|||
qemuMigrationParamsPtr migParams)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
bool xbzrleCacheSize_old = false;
|
||||
int ret = -1;
|
||||
|
||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||
|
@ -150,6 +151,20 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver,
|
|||
migParams->caps) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* 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.xbzrleCacheSize_set &&
|
||||
(!priv->job.migParams ||
|
||||
!priv->job.migParams->params.xbzrleCacheSize_set)) {
|
||||
if (qemuMonitorSetMigrationCacheSize(priv->mon,
|
||||
migParams->params.xbzrleCacheSize) < 0)
|
||||
goto cleanup;
|
||||
xbzrleCacheSize_old = true;
|
||||
migParams->params.xbzrleCacheSize_set = false;
|
||||
}
|
||||
|
||||
if (qemuMonitorSetMigrationParams(priv->mon, &migParams->params) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -159,6 +174,9 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver,
|
|||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||
ret = -1;
|
||||
|
||||
if (xbzrleCacheSize_old)
|
||||
migParams->params.xbzrleCacheSize_set = true;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -321,15 +339,10 @@ qemuMigrationParamsDisableTLS(virDomainObjPtr vm,
|
|||
|
||||
|
||||
int
|
||||
qemuMigrationParamsSetCompression(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
int asyncJob,
|
||||
qemuMigrationParamsSetCompression(virDomainObjPtr vm,
|
||||
qemuMigrationCompressionPtr compression,
|
||||
qemuMigrationParamsPtr migParams)
|
||||
{
|
||||
int ret = -1;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
|
||||
if (qemuMigrationParamsSetCapability(vm,
|
||||
QEMU_MONITOR_MIGRATION_CAPS_XBZRLE,
|
||||
compression->methods &
|
||||
|
@ -344,9 +357,6 @@ qemuMigrationParamsSetCompression(virQEMUDriverPtr driver,
|
|||
migParams) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||
return -1;
|
||||
|
||||
migParams->params.compressLevel_set = compression->level_set;
|
||||
migParams->params.compressLevel = compression->level;
|
||||
|
||||
|
@ -356,18 +366,10 @@ qemuMigrationParamsSetCompression(virQEMUDriverPtr driver,
|
|||
migParams->params.decompressThreads_set = compression->dthreads_set;
|
||||
migParams->params.decompressThreads = compression->dthreads;
|
||||
|
||||
if (compression->xbzrle_cache_set &&
|
||||
qemuMonitorSetMigrationCacheSize(priv->mon,
|
||||
compression->xbzrle_cache) < 0)
|
||||
goto cleanup;
|
||||
migParams->params.xbzrleCacheSize_set = compression->xbzrle_cache_set;
|
||||
migParams->params.xbzrleCacheSize = compression->xbzrle_cache;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||
ret = -1;
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -94,9 +94,7 @@ qemuMigrationParamsDisableTLS(virDomainObjPtr vm,
|
|||
qemuMigrationParamsPtr migParams);
|
||||
|
||||
int
|
||||
qemuMigrationParamsSetCompression(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
int asyncJob,
|
||||
qemuMigrationParamsSetCompression(virDomainObjPtr vm,
|
||||
qemuMigrationCompressionPtr compression,
|
||||
qemuMigrationParamsPtr migParams);
|
||||
|
||||
|
|
Loading…
Reference in New Issue