Propagate the calls up the stack to the point where
qemuMigrationParamsFromFlags is called. The end goal achieved in the
following few patches is to merge compression parameters into the
general migration parameters code.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_driver.c | 21 ++++++++++++++++++---
src/qemu/qemu_migration.c | 25 +++++++------------------
src/qemu/qemu_migration.h | 1 +
3 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5271e01d92..85755257aa 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12126,6 +12126,7 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
virQEMUDriverPtr driver = dconn->privateData;
virDomainDefPtr def = NULL;
char *origname = NULL;
+ qemuMigrationCompressionPtr compression = NULL;
qemuMigrationParamsPtr migParams = NULL;
int ret = -1;
@@ -12137,6 +12138,9 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
goto cleanup;
}
+ if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
+ goto cleanup;
+
if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
QEMU_MIGRATION_DESTINATION)))
goto cleanup;
@@ -12156,9 +12160,10 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
ret = qemuMigrationDstPrepareTunnel(driver, dconn,
NULL, 0, NULL, NULL, /* No cookies in v2 */
- st, &def, origname, migParams, flags);
+ st, &def, origname, compression, migParams,
flags);
cleanup:
+ VIR_FREE(compression);
qemuMigrationParamsFree(migParams);
VIR_FREE(origname);
virDomainDefFree(def);
@@ -12597,6 +12602,7 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
virQEMUDriverPtr driver = dconn->privateData;
virDomainDefPtr def = NULL;
char *origname = NULL;
+ qemuMigrationCompressionPtr compression = NULL;
qemuMigrationParamsPtr migParams = NULL;
int ret = -1;
@@ -12608,6 +12614,9 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
goto cleanup;
}
+ if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
+ goto cleanup;
+
if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
QEMU_MIGRATION_DESTINATION)))
goto cleanup;
@@ -12621,9 +12630,10 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
ret = qemuMigrationDstPrepareTunnel(driver, dconn,
cookiein, cookieinlen,
cookieout, cookieoutlen,
- st, &def, origname, migParams, flags);
+ st, &def, origname, compression, migParams,
flags);
cleanup:
+ VIR_FREE(compression);
qemuMigrationParamsFree(migParams);
VIR_FREE(origname);
virDomainDefFree(def);
@@ -12646,6 +12656,7 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
const char *dom_xml = NULL;
const char *dname = NULL;
char *origname = NULL;
+ qemuMigrationCompressionPtr compression = NULL;
qemuMigrationParamsPtr migParams = NULL;
int ret = -1;
@@ -12667,6 +12678,9 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
goto cleanup;
}
+ if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
+ goto cleanup;
+
if (!(migParams = qemuMigrationParamsFromFlags(params, nparams, flags,
QEMU_MIGRATION_DESTINATION)))
goto cleanup;
@@ -12680,9 +12694,10 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
ret = qemuMigrationDstPrepareTunnel(driver, dconn,
cookiein, cookieinlen,
cookieout, cookieoutlen,
- st, &def, origname, migParams, flags);
+ st, &def, origname, compression, migParams,
flags);
cleanup:
+ VIR_FREE(compression);
qemuMigrationParamsFree(migParams);
VIR_FREE(origname);
virDomainDefFree(def);
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 1c614f8c0d..fa220d6ce4 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2534,12 +2534,10 @@ qemuMigrationDstPrepareTunnel(virQEMUDriverPtr driver,
virStreamPtr st,
virDomainDefPtr *def,
const char *origname,
+ qemuMigrationCompressionPtr compression,
qemuMigrationParamsPtr migParams,
unsigned long flags)
{
- qemuMigrationCompressionPtr compression = NULL;
- int ret;
-
VIR_DEBUG("driver=%p, dconn=%p, cookiein=%s, cookieinlen=%d, "
"cookieout=%p, cookieoutlen=%p, st=%p, def=%p, "
"origname=%s, flags=0x%lx",
@@ -2552,15 +2550,10 @@ qemuMigrationDstPrepareTunnel(virQEMUDriverPtr driver,
return -1;
}
- if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
- return -1;
-
- ret = qemuMigrationDstPrepareAny(driver, dconn, cookiein, cookieinlen,
- cookieout, cookieoutlen, def, origname,
- st, NULL, 0, false, NULL, 0, NULL, 0,
- compression, migParams, flags);
- VIR_FREE(compression);
- return ret;
+ return qemuMigrationDstPrepareAny(driver, dconn, cookiein, cookieinlen,
+ cookieout, cookieoutlen, def, origname,
+ st, NULL, 0, false, NULL, 0, NULL, 0,
+ compression, migParams, flags);
}
@@ -3762,6 +3755,7 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
unsigned long flags,
const char *dname,
unsigned long resource,
+ qemuMigrationCompressionPtr compression,
qemuMigrationParamsPtr migParams)
{
virDomainPtr ddomain = NULL;
@@ -3773,7 +3767,6 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
bool cancelled;
virStreamPtr st = NULL;
unsigned long destflags;
- qemuMigrationCompressionPtr compression = NULL;
VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, dconnuri=%s, "
"flags=0x%lx, dname=%s, resource=%lu",
@@ -3795,9 +3788,6 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
destflags = flags & ~(VIR_MIGRATE_ABORT_ON_ERROR |
VIR_MIGRATE_AUTO_CONVERGE);
- if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
- goto cleanup;
-
VIR_DEBUG("Prepare2 %p", dconn);
if (flags & VIR_MIGRATE_TUNNELLED) {
/*
@@ -3898,7 +3888,6 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
}
VIR_FREE(uri_out);
VIR_FREE(cookie);
- VIR_FREE(compression);
return ret;
}
@@ -4412,7 +4401,7 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr driver,
} else {
ret = qemuMigrationSrcPerformPeer2Peer2(driver, sconn, dconn, vm,
dconnuri, flags, dname, resource,
- migParams);
+ compression, migParams);
}
cleanup:
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index af8f2cfeb4..2d67da8435 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -149,6 +149,7 @@ qemuMigrationDstPrepareTunnel(virQEMUDriverPtr driver,
virStreamPtr st,
virDomainDefPtr *def,
const char *origname,
+ qemuMigrationCompressionPtr compression,
qemuMigrationParamsPtr migParams,
unsigned long flags);
--
2.17.0