There's no need to call this API explicitly in the migration code. We
can pass the compression parameters to qemuMigrationParamsFromFlags and
it can internally call qemuMigrationParamsSetCompression to apply them
to the qemuMigrationParams structure.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_driver.c | 30 ++++++++++++-------------
src/qemu/qemu_migration.c | 38 ++++++++++----------------------
src/qemu/qemu_migration.h | 2 --
src/qemu/qemu_migration_params.c | 11 +++++----
src/qemu/qemu_migration_params.h | 8 ++-----
5 files changed, 36 insertions(+), 53 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 85755257aa..3b0c3a3ffb 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12142,7 +12142,7 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
goto cleanup;
if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
- QEMU_MIGRATION_DESTINATION)))
+ QEMU_MIGRATION_DESTINATION,
compression)))
goto cleanup;
if (virLockManagerPluginUsesState(driver->lockManager)) {
@@ -12160,7 +12160,7 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
ret = qemuMigrationDstPrepareTunnel(driver, dconn,
NULL, 0, NULL, NULL, /* No cookies in v2 */
- st, &def, origname, compression, migParams,
flags);
+ st, &def, origname, migParams, flags);
cleanup:
VIR_FREE(compression);
@@ -12208,7 +12208,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
goto cleanup;
if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
- QEMU_MIGRATION_DESTINATION)))
+ QEMU_MIGRATION_DESTINATION,
compression)))
goto cleanup;
if (virLockManagerPluginUsesState(driver->lockManager)) {
@@ -12232,7 +12232,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
NULL, 0, NULL, NULL, /* No cookies */
uri_in, uri_out,
&def, origname, NULL, 0, NULL, 0,
- compression, migParams, flags);
+ migParams, flags);
cleanup:
qemuMigrationParamsFree(migParams);
@@ -12273,7 +12273,7 @@ qemuDomainMigratePerform(virDomainPtr dom,
goto cleanup;
if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
- QEMU_MIGRATION_SOURCE)))
+ QEMU_MIGRATION_SOURCE, compression)))
goto cleanup;
if (!(vm = qemuDomObjFromDomain(dom)))
@@ -12467,7 +12467,7 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
goto cleanup;
if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
- QEMU_MIGRATION_DESTINATION)))
+ QEMU_MIGRATION_DESTINATION,
compression)))
goto cleanup;
if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
@@ -12481,7 +12481,7 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
cookieout, cookieoutlen,
uri_in, uri_out,
&def, origname, NULL, 0, NULL, 0,
- compression, migParams, flags);
+ migParams, flags);
cleanup:
qemuMigrationParamsFree(migParams);
@@ -12549,7 +12549,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
goto cleanup;
if (!(migParams = qemuMigrationParamsFromFlags(params, nparams, flags,
- QEMU_MIGRATION_DESTINATION)))
+ QEMU_MIGRATION_DESTINATION,
compression)))
goto cleanup;
if (flags & VIR_MIGRATE_TUNNELLED) {
@@ -12574,7 +12574,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
uri_in, uri_out,
&def, origname, listenAddress,
nmigrate_disks, migrate_disks, nbdPort,
- compression, migParams, flags);
+ migParams, flags);
cleanup:
qemuMigrationParamsFree(migParams);
@@ -12618,7 +12618,7 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
goto cleanup;
if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
- QEMU_MIGRATION_DESTINATION)))
+ QEMU_MIGRATION_DESTINATION,
compression)))
goto cleanup;
if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
@@ -12630,7 +12630,7 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
ret = qemuMigrationDstPrepareTunnel(driver, dconn,
cookiein, cookieinlen,
cookieout, cookieoutlen,
- st, &def, origname, compression, migParams,
flags);
+ st, &def, origname, migParams, flags);
cleanup:
VIR_FREE(compression);
@@ -12682,7 +12682,7 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
goto cleanup;
if (!(migParams = qemuMigrationParamsFromFlags(params, nparams, flags,
- QEMU_MIGRATION_DESTINATION)))
+ QEMU_MIGRATION_DESTINATION,
compression)))
goto cleanup;
if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
@@ -12694,7 +12694,7 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
ret = qemuMigrationDstPrepareTunnel(driver, dconn,
cookiein, cookieinlen,
cookieout, cookieoutlen,
- st, &def, origname, compression, migParams,
flags);
+ st, &def, origname, migParams, flags);
cleanup:
VIR_FREE(compression);
@@ -12730,7 +12730,7 @@ qemuDomainMigratePerform3(virDomainPtr dom,
goto cleanup;
if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
- QEMU_MIGRATION_SOURCE)))
+ QEMU_MIGRATION_SOURCE, compression)))
goto cleanup;
if (!(vm = qemuDomObjFromDomain(dom)))
@@ -12822,7 +12822,7 @@ qemuDomainMigratePerform3Params(virDomainPtr dom,
goto cleanup;
if (!(migParams = qemuMigrationParamsFromFlags(params, nparams, flags,
- QEMU_MIGRATION_SOURCE)))
+ QEMU_MIGRATION_SOURCE, compression)))
goto cleanup;
if (!(vm = qemuDomObjFromDomain(dom)))
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index d0d0d97be4..1c5ee67929 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2158,7 +2158,6 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
size_t nmigrate_disks,
const char **migrate_disks,
int nbdPort,
- qemuMigrationCompressionPtr compression,
qemuMigrationParamsPtr migParams,
unsigned long flags)
{
@@ -2372,9 +2371,6 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
dataFD[1] = -1; /* 'st' owns the FD now & will close it */
}
- if (qemuMigrationParamsSetCompression(vm, compression, migParams) < 0)
- goto stopjob;
-
if (STREQ_NULLABLE(protocol, "rdma") &&
virProcessSetMaxMemLock(vm->pid, vm->def->mem.hard_limit << 10)
< 0) {
goto stopjob;
@@ -2526,7 +2522,6 @@ qemuMigrationDstPrepareTunnel(virQEMUDriverPtr driver,
virStreamPtr st,
virDomainDefPtr *def,
const char *origname,
- qemuMigrationCompressionPtr compression,
qemuMigrationParamsPtr migParams,
unsigned long flags)
{
@@ -2545,7 +2540,7 @@ qemuMigrationDstPrepareTunnel(virQEMUDriverPtr driver,
return qemuMigrationDstPrepareAny(driver, dconn, cookiein, cookieinlen,
cookieout, cookieoutlen, def, origname,
st, NULL, 0, false, NULL, 0, NULL, 0,
- compression, migParams, flags);
+ migParams, flags);
}
@@ -2587,7 +2582,6 @@ qemuMigrationDstPrepareDirect(virQEMUDriverPtr driver,
size_t nmigrate_disks,
const char **migrate_disks,
int nbdPort,
- qemuMigrationCompressionPtr compression,
qemuMigrationParamsPtr migParams,
unsigned long flags)
{
@@ -2712,7 +2706,7 @@ qemuMigrationDstPrepareDirect(virQEMUDriverPtr driver,
NULL, uri ? uri->scheme : "tcp",
port, autoPort, listenAddress,
nmigrate_disks, migrate_disks, nbdPort,
- compression, migParams, flags);
+ migParams, flags);
cleanup:
virURIFree(uri);
VIR_FREE(hostname);
@@ -3239,7 +3233,6 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
const char *graphicsuri,
size_t nmigrate_disks,
const char **migrate_disks,
- qemuMigrationCompressionPtr compression,
qemuMigrationParamsPtr migParams)
{
int ret = -1;
@@ -3314,9 +3307,6 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
if (qemuMigrationSrcGraphicsRelocate(driver, vm, mig, graphicsuri) < 0)
VIR_WARN("unable to provide data for graphics client relocation");
- if (qemuMigrationParamsSetCompression(vm, compression, migParams) < 0)
- goto error;
-
if (qemuMigrationParamsCheck(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
migParams) < 0)
goto error;
@@ -3606,7 +3596,6 @@ qemuMigrationSrcPerformNative(virQEMUDriverPtr driver,
const char *graphicsuri,
size_t nmigrate_disks,
const char **migrate_disks,
- qemuMigrationCompressionPtr compression,
qemuMigrationParamsPtr migParams)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -3658,7 +3647,7 @@ qemuMigrationSrcPerformNative(virQEMUDriverPtr driver,
ret = qemuMigrationSrcRun(driver, vm, persist_xml, cookiein, cookieinlen, cookieout,
cookieoutlen, flags, resource, &spec, dconn,
graphicsuri, nmigrate_disks, migrate_disks,
- compression, migParams);
+ migParams);
if (spec.destType == MIGRATION_DEST_FD)
VIR_FORCE_CLOSE(spec.dest.fd.qemu);
@@ -3685,7 +3674,6 @@ qemuMigrationSrcPerformTunnel(virQEMUDriverPtr driver,
const char *graphicsuri,
size_t nmigrate_disks,
const char **migrate_disks,
- qemuMigrationCompressionPtr compression,
qemuMigrationParamsPtr migParams)
{
int ret = -1;
@@ -3723,7 +3711,7 @@ qemuMigrationSrcPerformTunnel(virQEMUDriverPtr driver,
ret = qemuMigrationSrcRun(driver, vm, persist_xml, cookiein, cookieinlen,
cookieout, cookieoutlen, flags, resource, &spec,
dconn, graphicsuri, nmigrate_disks, migrate_disks,
- compression, migParams);
+ migParams);
cleanup:
VIR_FORCE_CLOSE(spec.dest.fd.qemu);
@@ -3747,7 +3735,6 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
unsigned long flags,
const char *dname,
unsigned long resource,
- qemuMigrationCompressionPtr compression,
qemuMigrationParamsPtr migParams)
{
virDomainPtr ddomain = NULL;
@@ -3832,13 +3819,13 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
ret = qemuMigrationSrcPerformTunnel(driver, vm, st, NULL,
NULL, 0, NULL, NULL,
flags, resource, dconn,
- NULL, 0, NULL, compression, migParams);
+ NULL, 0, NULL, migParams);
else
ret = qemuMigrationSrcPerformNative(driver, vm, NULL, uri_out,
cookie, cookielen,
NULL, NULL, /* No out cookie with v2
migration */
flags, resource, dconn, NULL, 0, NULL,
- compression, migParams);
+ migParams);
/* Perform failed. Make sure Finish doesn't overwrite the error */
if (ret < 0)
@@ -4077,14 +4064,14 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver,
cookiein, cookieinlen,
&cookieout, &cookieoutlen,
flags, bandwidth, dconn, graphicsuri,
- nmigrate_disks, migrate_disks, compression,
+ nmigrate_disks, migrate_disks,
migParams);
} else {
ret = qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri,
cookiein, cookieinlen,
&cookieout, &cookieoutlen,
flags, bandwidth, dconn, graphicsuri,
- nmigrate_disks, migrate_disks, compression,
+ nmigrate_disks, migrate_disks,
migParams);
}
@@ -4393,7 +4380,7 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr driver,
} else {
ret = qemuMigrationSrcPerformPeer2Peer2(driver, sconn, dconn, vm,
dconnuri, flags, dname, resource,
- compression, migParams);
+ migParams);
}
cleanup:
@@ -4475,7 +4462,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver,
ret = qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri, cookiein,
cookieinlen,
cookieout, cookieoutlen,
flags, resource, NULL, NULL, 0, NULL,
- compression, migParams);
+ migParams);
}
if (ret < 0)
goto endjob;
@@ -4544,7 +4531,6 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver,
const char *graphicsuri,
size_t nmigrate_disks,
const char **migrate_disks,
- qemuMigrationCompressionPtr compression,
qemuMigrationParamsPtr migParams,
const char *cookiein,
int cookieinlen,
@@ -4572,7 +4558,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver,
ret = qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri, cookiein,
cookieinlen,
cookieout, cookieoutlen,
flags, resource, NULL, graphicsuri,
- nmigrate_disks, migrate_disks, compression,
migParams);
+ nmigrate_disks, migrate_disks, migParams);
if (ret < 0) {
if (qemuMigrationSrcRestoreDomainState(driver, vm)) {
@@ -4667,7 +4653,7 @@ qemuMigrationSrcPerform(virQEMUDriverPtr driver,
return qemuMigrationSrcPerformPhase(driver, conn, vm, persist_xml, uri,
graphicsuri,
nmigrate_disks, migrate_disks,
- compression, migParams,
+ migParams,
cookiein, cookieinlen,
cookieout, cookieoutlen,
flags, resource);
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index 53d8c529fc..b135f740c1 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -129,7 +129,6 @@ qemuMigrationDstPrepareTunnel(virQEMUDriverPtr driver,
virStreamPtr st,
virDomainDefPtr *def,
const char *origname,
- qemuMigrationCompressionPtr compression,
qemuMigrationParamsPtr migParams,
unsigned long flags);
@@ -148,7 +147,6 @@ qemuMigrationDstPrepareDirect(virQEMUDriverPtr driver,
size_t nmigrate_disks,
const char **migrate_disks,
int nbdPort,
- qemuMigrationCompressionPtr compression,
qemuMigrationParamsPtr migParams,
unsigned long flags);
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 94eb08a6bb..5808aa761d 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -137,9 +137,8 @@ qemuMigrationParamsFree(qemuMigrationParamsPtr migParams)
} while (0)
-int
-qemuMigrationParamsSetCompression(virDomainObjPtr vm ATTRIBUTE_UNUSED,
- qemuMigrationCompressionPtr compression,
+static int
+qemuMigrationParamsSetCompression(qemuMigrationCompressionPtr compression,
qemuMigrationParamsPtr migParams)
{
if (compression->methods & (1ULL << QEMU_MIGRATION_COMPRESS_XBZRLE))
@@ -170,7 +169,8 @@ qemuMigrationParamsPtr
qemuMigrationParamsFromFlags(virTypedParameterPtr params,
int nparams,
unsigned long flags,
- qemuMigrationParty party)
+ qemuMigrationParty party,
+ qemuMigrationCompressionPtr compression)
{
qemuMigrationParamsPtr migParams;
size_t i;
@@ -204,6 +204,9 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
goto error;
}
+ if (qemuMigrationParamsSetCompression(compression, migParams) < 0)
+ goto error;
+
return migParams;
error:
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index 165e1267ab..65bd3125dc 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -60,7 +60,8 @@ qemuMigrationParamsPtr
qemuMigrationParamsFromFlags(virTypedParameterPtr params,
int nparams,
unsigned long flags,
- qemuMigrationParty party);
+ qemuMigrationParty party,
+ qemuMigrationCompressionPtr compression);
qemuMigrationCompressionPtr
qemuMigrationAnyCompressionParse(virTypedParameterPtr params,
@@ -96,11 +97,6 @@ int
qemuMigrationParamsDisableTLS(virDomainObjPtr vm,
qemuMigrationParamsPtr migParams);
-int
-qemuMigrationParamsSetCompression(virDomainObjPtr vm,
- qemuMigrationCompressionPtr compression,
- qemuMigrationParamsPtr migParams);
-
int
qemuMigrationParamsCheck(virQEMUDriverPtr driver,
virDomainObjPtr vm,
--
2.17.0