Currently migration parameters are stored in a structure which mimics
the QEMU migration parameters handled by query-migrate-parameters and
migrate-set-parameters. The new structure will become a libvirt's
abstraction on top of QEMU migration parameters, capabilities, and
related stuff.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_driver.c | 6 ++--
src/qemu/qemu_migration.c | 26 +++++++-------
src/qemu/qemu_migration.h | 2 +-
src/qemu/qemu_migration_params.c | 62 ++++++++++++++++----------------
src/qemu/qemu_migration_params.h | 21 +++++++----
5 files changed, 62 insertions(+), 55 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c157ff9bb0..6e6fc130c5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12241,7 +12241,7 @@ qemuDomainMigratePerform(virDomainPtr dom,
int ret = -1;
const char *dconnuri = NULL;
qemuMigrationCompressionPtr compression = NULL;
- qemuMonitorMigrationParamsPtr migParams = NULL;
+ qemuMigrationParamsPtr migParams = NULL;
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
@@ -12669,7 +12669,7 @@ qemuDomainMigratePerform3(virDomainPtr dom,
virQEMUDriverPtr driver = dom->conn->privateData;
virDomainObjPtr vm;
qemuMigrationCompressionPtr compression = NULL;
- qemuMonitorMigrationParamsPtr migParams = NULL;
+ qemuMigrationParamsPtr migParams = NULL;
int ret = -1;
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
@@ -12725,7 +12725,7 @@ qemuDomainMigratePerform3Params(virDomainPtr dom,
unsigned long long bandwidth = 0;
int nbdPort = 0;
qemuMigrationCompressionPtr compression = NULL;
- qemuMonitorMigrationParamsPtr migParams = NULL;
+ qemuMigrationParamsPtr migParams = NULL;
int ret = -1;
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index a0061c8c83..055d8a674a 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2251,7 +2251,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
int rv;
char *tlsAlias = NULL;
char *secAlias = NULL;
- qemuMonitorMigrationParamsPtr migParams = NULL;
+ qemuMigrationParamsPtr migParams = NULL;
virNWFilterReadLockFilterUpdates();
@@ -2465,7 +2465,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
goto stopjob;
/* Force reset of 'tls-hostname', it's a source only parameter */
- if (VIR_STRDUP(migParams->tlsHostname, "") < 0)
+ if (VIR_STRDUP(migParams->params.tlsHostname, "") < 0)
goto stopjob;
} else {
@@ -3337,7 +3337,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
size_t nmigrate_disks,
const char **migrate_disks,
qemuMigrationCompressionPtr compression,
- qemuMonitorMigrationParamsPtr migParams)
+ qemuMigrationParamsPtr migParams)
{
int ret = -1;
unsigned int migrate_flags = QEMU_MONITOR_MIGRATE_BACKGROUND;
@@ -3426,11 +3426,11 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
* connect directly to the destination. */
if (spec->destType == MIGRATION_DEST_CONNECT_HOST ||
spec->destType == MIGRATION_DEST_FD) {
- if (VIR_STRDUP(migParams->tlsHostname, spec->dest.host.name) < 0)
+ if (VIR_STRDUP(migParams->params.tlsHostname, spec->dest.host.name)
< 0)
goto error;
} else {
/* Be sure there's nothing from a previous migration */
- if (VIR_STRDUP(migParams->tlsHostname, "") < 0)
+ if (VIR_STRDUP(migParams->params.tlsHostname, "") < 0)
goto error;
}
} else {
@@ -3733,7 +3733,7 @@ qemuMigrationSrcPerformNative(virQEMUDriverPtr driver,
size_t nmigrate_disks,
const char **migrate_disks,
qemuMigrationCompressionPtr compression,
- qemuMonitorMigrationParamsPtr migParams)
+ qemuMigrationParamsPtr migParams)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virURIPtr uribits = NULL;
@@ -3812,7 +3812,7 @@ qemuMigrationSrcPerformTunnel(virQEMUDriverPtr driver,
size_t nmigrate_disks,
const char **migrate_disks,
qemuMigrationCompressionPtr compression,
- qemuMonitorMigrationParamsPtr migParams)
+ qemuMigrationParamsPtr migParams)
{
int ret = -1;
qemuMigrationSpec spec;
@@ -3884,7 +3884,7 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
virStreamPtr st = NULL;
unsigned long destflags;
qemuMigrationCompressionPtr compression = NULL;
- qemuMonitorMigrationParamsPtr migParams = NULL;
+ qemuMigrationParamsPtr migParams = NULL;
VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, dconnuri=%s, "
"flags=0x%lx, dname=%s, resource=%lu",
@@ -4039,7 +4039,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver,
const char **migrate_disks,
int nbdPort,
qemuMigrationCompressionPtr compression,
- qemuMonitorMigrationParamsPtr migParams,
+ qemuMigrationParamsPtr migParams,
unsigned long long bandwidth,
bool useParams,
unsigned long flags)
@@ -4398,7 +4398,7 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr driver,
const char **migrate_disks,
int nbdPort,
qemuMigrationCompressionPtr compression,
- qemuMonitorMigrationParamsPtr migParams,
+ qemuMigrationParamsPtr migParams,
unsigned long flags,
const char *dname,
unsigned long resource,
@@ -4563,7 +4563,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver,
const char **migrate_disks,
int nbdPort,
qemuMigrationCompressionPtr compression,
- qemuMonitorMigrationParamsPtr migParams,
+ qemuMigrationParamsPtr migParams,
const char *cookiein,
int cookieinlen,
char **cookieout,
@@ -4676,7 +4676,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver,
size_t nmigrate_disks,
const char **migrate_disks,
qemuMigrationCompressionPtr compression,
- qemuMonitorMigrationParamsPtr migParams,
+ qemuMigrationParamsPtr migParams,
const char *cookiein,
int cookieinlen,
char **cookieout,
@@ -4750,7 +4750,7 @@ qemuMigrationSrcPerform(virQEMUDriverPtr driver,
const char **migrate_disks,
int nbdPort,
qemuMigrationCompressionPtr compression,
- qemuMonitorMigrationParamsPtr migParams,
+ qemuMigrationParamsPtr migParams,
const char *cookiein,
int cookieinlen,
char **cookieout,
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index 4e7b33445b..e59296fd63 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -182,7 +182,7 @@ qemuMigrationSrcPerform(virQEMUDriverPtr driver,
const char **migrate_disks,
int nbdPort,
qemuMigrationCompressionPtr compression,
- qemuMonitorMigrationParamsPtr migParams,
+ qemuMigrationParamsPtr migParams,
const char *cookiein,
int cookieinlen,
char **cookieout,
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index c315810728..3a1816c2b9 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -38,10 +38,10 @@ VIR_LOG_INIT("qemu.qemu_migration_params");
#define QEMU_MIGRATION_TLS_ALIAS_BASE "libvirt_migrate"
-qemuMonitorMigrationParamsPtr
+qemuMigrationParamsPtr
qemuMigrationParamsNew(void)
{
- qemuMonitorMigrationParamsPtr params;
+ qemuMigrationParamsPtr params;
if (VIR_ALLOC(params) < 0)
return NULL;
@@ -51,23 +51,23 @@ qemuMigrationParamsNew(void)
void
-qemuMigrationParamsFree(qemuMonitorMigrationParamsPtr migParams)
+qemuMigrationParamsFree(qemuMigrationParamsPtr migParams)
{
if (!migParams)
return;
- VIR_FREE(migParams->tlsCreds);
- VIR_FREE(migParams->tlsHostname);
+ VIR_FREE(migParams->params.tlsCreds);
+ VIR_FREE(migParams->params.tlsHostname);
VIR_FREE(migParams);
}
-qemuMonitorMigrationParamsPtr
+qemuMigrationParamsPtr
qemuMigrationParamsFromFlags(virTypedParameterPtr params,
int nparams,
unsigned long flags)
{
- qemuMonitorMigrationParamsPtr migParams;
+ qemuMigrationParamsPtr migParams;
if (!(migParams = qemuMigrationParamsNew()))
return NULL;
@@ -80,11 +80,11 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
int rc; \
if ((rc = virTypedParamsGetInt(params, nparams, \
VIR_MIGRATE_PARAM_ ## PARAM, \
- &migParams->VAR)) < 0) \
+ &migParams->params.VAR)) < 0) \
goto error; \
\
if (rc == 1) \
- migParams->VAR ## _set = true; \
+ migParams->params.VAR ## _set = true; \
} while (0)
GET(AUTO_CONVERGE_INITIAL, cpuThrottleInitial);
@@ -92,8 +92,8 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
#undef GET
- if ((migParams->cpuThrottleInitial_set ||
- migParams->cpuThrottleIncrement_set) &&
+ if ((migParams->params.cpuThrottleInitial_set ||
+ migParams->params.cpuThrottleIncrement_set) &&
!(flags & VIR_MIGRATE_AUTO_CONVERGE)) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("Turn auto convergence on to tune it"));
@@ -112,7 +112,7 @@ int
qemuMigrationParamsSet(virQEMUDriverPtr driver,
virDomainObjPtr vm,
int asyncJob,
- qemuMonitorMigrationParamsPtr migParams)
+ qemuMigrationParamsPtr migParams)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
int ret = -1;
@@ -120,7 +120,7 @@ qemuMigrationParamsSet(virQEMUDriverPtr driver,
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return -1;
- if (qemuMonitorSetMigrationParams(priv->mon, migParams) < 0)
+ if (qemuMonitorSetMigrationParams(priv->mon, &migParams->params) < 0)
goto cleanup;
ret = 0;
@@ -153,7 +153,7 @@ qemuMigrationParamsCheckTLSCreds(virQEMUDriverPtr driver,
{
int ret = -1;
qemuDomainObjPrivatePtr priv = vm->privateData;
- qemuMonitorMigrationParamsPtr migParams = NULL;
+ qemuMigrationParamsPtr migParams = NULL;
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return -1;
@@ -161,11 +161,11 @@ qemuMigrationParamsCheckTLSCreds(virQEMUDriverPtr driver,
if (!(migParams = qemuMigrationParamsNew()))
goto cleanup;
- if (qemuMonitorGetMigrationParams(priv->mon, migParams) < 0)
+ if (qemuMonitorGetMigrationParams(priv->mon, &migParams->params) < 0)
goto cleanup;
/* NB: Could steal NULL pointer too! Let caller decide what to do. */
- VIR_STEAL_PTR(priv->migTLSAlias, migParams->tlsCreds);
+ VIR_STEAL_PTR(priv->migTLSAlias, migParams->params.tlsCreds);
ret = 0;
@@ -251,7 +251,7 @@ qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
int asyncJob,
char **tlsAlias,
char **secAlias,
- qemuMonitorMigrationParamsPtr migParams)
+ qemuMigrationParamsPtr migParams)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virJSONValuePtr tlsProps = NULL;
@@ -274,7 +274,7 @@ qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
*tlsAlias, &tlsProps) < 0)
goto error;
- if (VIR_STRDUP(migParams->tlsCreds, *tlsAlias) < 0)
+ if (VIR_STRDUP(migParams->params.tlsCreds, *tlsAlias) < 0)
goto error;
return 0;
@@ -302,7 +302,7 @@ int
qemuMigrationParamsSetEmptyTLS(virQEMUDriverPtr driver,
virDomainObjPtr vm,
int asyncJob,
- qemuMonitorMigrationParamsPtr migParams)
+ qemuMigrationParamsPtr migParams)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -312,8 +312,8 @@ qemuMigrationParamsSetEmptyTLS(virQEMUDriverPtr driver,
if (!priv->migTLSAlias)
return 0;
- if (VIR_STRDUP(migParams->tlsCreds, "") < 0 ||
- VIR_STRDUP(migParams->tlsHostname, "") < 0)
+ if (VIR_STRDUP(migParams->params.tlsCreds, "") < 0 ||
+ VIR_STRDUP(migParams->params.tlsHostname, "") < 0)
return -1;
return 0;
@@ -325,7 +325,7 @@ qemuMigrationParamsSetCompression(virQEMUDriverPtr driver,
virDomainObjPtr vm,
int asyncJob,
qemuMigrationCompressionPtr compression,
- qemuMonitorMigrationParamsPtr migParams)
+ qemuMigrationParamsPtr migParams)
{
int ret = -1;
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -347,14 +347,14 @@ qemuMigrationParamsSetCompression(virQEMUDriverPtr driver,
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return -1;
- migParams->compressLevel_set = compression->level_set;
- migParams->compressLevel = compression->level;
+ migParams->params.compressLevel_set = compression->level_set;
+ migParams->params.compressLevel = compression->level;
- migParams->compressThreads_set = compression->threads_set;
- migParams->compressThreads = compression->threads;
+ migParams->params.compressThreads_set = compression->threads_set;
+ migParams->params.compressThreads = compression->threads;
- migParams->decompressThreads_set = compression->dthreads_set;
- migParams->decompressThreads = compression->dthreads;
+ migParams->params.decompressThreads_set = compression->dthreads_set;
+ migParams->params.decompressThreads = compression->dthreads;
if (compression->xbzrle_cache_set &&
qemuMonitorSetMigrationCacheSize(priv->mon,
@@ -389,7 +389,7 @@ qemuMigrationParamsResetTLS(virQEMUDriverPtr driver,
qemuDomainObjPrivatePtr priv = vm->privateData;
char *tlsAlias = NULL;
char *secAlias = NULL;
- qemuMonitorMigrationParamsPtr migParams = NULL;
+ qemuMigrationParamsPtr migParams = NULL;
int ret = -1;
if (qemuMigrationParamsCheckTLSCreds(driver, vm, asyncJob) < 0)
@@ -412,8 +412,8 @@ qemuMigrationParamsResetTLS(virQEMUDriverPtr driver,
qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, tlsAlias);
qemuDomainSecretInfoFree(&priv->migSecinfo);
- if (VIR_STRDUP(migParams->tlsCreds, "") < 0 ||
- VIR_STRDUP(migParams->tlsHostname, "") < 0 ||
+ if (VIR_STRDUP(migParams->params.tlsCreds, "") < 0 ||
+ VIR_STRDUP(migParams->params.tlsHostname, "") < 0 ||
qemuMigrationParamsSet(driver, vm, asyncJob, migParams) < 0)
goto cleanup;
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index bb38d34cd6..57b7dd6666 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -47,22 +47,29 @@ struct _qemuMigrationCompression {
};
-qemuMonitorMigrationParamsPtr
+typedef struct _qemuMigrationParams qemuMigrationParams;
+typedef qemuMigrationParams *qemuMigrationParamsPtr;
+struct _qemuMigrationParams {
+ qemuMonitorMigrationParams params;
+};
+
+
+qemuMigrationParamsPtr
qemuMigrationParamsNew(void);
-qemuMonitorMigrationParamsPtr
+qemuMigrationParamsPtr
qemuMigrationParamsFromFlags(virTypedParameterPtr params,
int nparams,
unsigned long flags);
void
-qemuMigrationParamsFree(qemuMonitorMigrationParamsPtr migParams);
+qemuMigrationParamsFree(qemuMigrationParamsPtr migParams);
int
qemuMigrationParamsSet(virQEMUDriverPtr driver,
virDomainObjPtr vm,
int asyncJob,
- qemuMonitorMigrationParamsPtr migParams);
+ qemuMigrationParamsPtr migParams);
int
qemuMigrationParamsCheckSetupTLS(virQEMUDriverPtr driver,
@@ -78,20 +85,20 @@ qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
int asyncJob,
char **tlsAlias,
char **secAlias,
- qemuMonitorMigrationParamsPtr migParams);
+ qemuMigrationParamsPtr migParams);
int
qemuMigrationParamsSetEmptyTLS(virQEMUDriverPtr driver,
virDomainObjPtr vm,
int asyncJob,
- qemuMonitorMigrationParamsPtr migParams);
+ qemuMigrationParamsPtr migParams);
int
qemuMigrationParamsSetCompression(virQEMUDriverPtr driver,
virDomainObjPtr vm,
int asyncJob,
qemuMigrationCompressionPtr compression,
- qemuMonitorMigrationParamsPtr migParams);
+ qemuMigrationParamsPtr migParams);
void
qemuMigrationParamsReset(virQEMUDriverPtr driver,
--
2.17.0