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)
|
if (qemuMigrationParamsCheck(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN) < 0)
|
||||||
goto stopjob;
|
goto stopjob;
|
||||||
|
|
||||||
if (qemuMigrationParamsSetCompression(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN,
|
if (qemuMigrationParamsSetCompression(vm, compression, migParams) < 0)
|
||||||
compression, migParams) < 0)
|
|
||||||
goto stopjob;
|
goto stopjob;
|
||||||
|
|
||||||
/* Migrations using TLS need to add the "tls-creds-x509" object and
|
/* Migrations using TLS need to add the "tls-creds-x509" object and
|
||||||
|
@ -3383,8 +3382,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuMigrationParamsSetCompression(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
|
if (qemuMigrationParamsSetCompression(vm, compression, migParams) < 0)
|
||||||
compression, migParams) < 0)
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (qemuMigrationParamsSetCapability(vm,
|
if (qemuMigrationParamsSetCapability(vm,
|
||||||
|
|
|
@ -141,6 +141,7 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver,
|
||||||
qemuMigrationParamsPtr migParams)
|
qemuMigrationParamsPtr migParams)
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
|
bool xbzrleCacheSize_old = false;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||||
|
@ -150,6 +151,20 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver,
|
||||||
migParams->caps) < 0)
|
migParams->caps) < 0)
|
||||||
goto cleanup;
|
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)
|
if (qemuMonitorSetMigrationParams(priv->mon, &migParams->params) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
@ -159,6 +174,9 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver,
|
||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
|
if (xbzrleCacheSize_old)
|
||||||
|
migParams->params.xbzrleCacheSize_set = true;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,15 +339,10 @@ qemuMigrationParamsDisableTLS(virDomainObjPtr vm,
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
qemuMigrationParamsSetCompression(virQEMUDriverPtr driver,
|
qemuMigrationParamsSetCompression(virDomainObjPtr vm,
|
||||||
virDomainObjPtr vm,
|
|
||||||
int asyncJob,
|
|
||||||
qemuMigrationCompressionPtr compression,
|
qemuMigrationCompressionPtr compression,
|
||||||
qemuMigrationParamsPtr migParams)
|
qemuMigrationParamsPtr migParams)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
||||||
|
|
||||||
if (qemuMigrationParamsSetCapability(vm,
|
if (qemuMigrationParamsSetCapability(vm,
|
||||||
QEMU_MONITOR_MIGRATION_CAPS_XBZRLE,
|
QEMU_MONITOR_MIGRATION_CAPS_XBZRLE,
|
||||||
compression->methods &
|
compression->methods &
|
||||||
|
@ -344,9 +357,6 @@ qemuMigrationParamsSetCompression(virQEMUDriverPtr driver,
|
||||||
migParams) < 0)
|
migParams) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
migParams->params.compressLevel_set = compression->level_set;
|
migParams->params.compressLevel_set = compression->level_set;
|
||||||
migParams->params.compressLevel = compression->level;
|
migParams->params.compressLevel = compression->level;
|
||||||
|
|
||||||
|
@ -356,18 +366,10 @@ qemuMigrationParamsSetCompression(virQEMUDriverPtr driver,
|
||||||
migParams->params.decompressThreads_set = compression->dthreads_set;
|
migParams->params.decompressThreads_set = compression->dthreads_set;
|
||||||
migParams->params.decompressThreads = compression->dthreads;
|
migParams->params.decompressThreads = compression->dthreads;
|
||||||
|
|
||||||
if (compression->xbzrle_cache_set &&
|
migParams->params.xbzrleCacheSize_set = compression->xbzrle_cache_set;
|
||||||
qemuMonitorSetMigrationCacheSize(priv->mon,
|
migParams->params.xbzrleCacheSize = compression->xbzrle_cache;
|
||||||
compression->xbzrle_cache) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
|
||||||
ret = -1;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -94,9 +94,7 @@ qemuMigrationParamsDisableTLS(virDomainObjPtr vm,
|
||||||
qemuMigrationParamsPtr migParams);
|
qemuMigrationParamsPtr migParams);
|
||||||
|
|
||||||
int
|
int
|
||||||
qemuMigrationParamsSetCompression(virQEMUDriverPtr driver,
|
qemuMigrationParamsSetCompression(virDomainObjPtr vm,
|
||||||
virDomainObjPtr vm,
|
|
||||||
int asyncJob,
|
|
||||||
qemuMigrationCompressionPtr compression,
|
qemuMigrationCompressionPtr compression,
|
||||||
qemuMigrationParamsPtr migParams);
|
qemuMigrationParamsPtr migParams);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue