It will get a bit more complicated soon and storing it on a stack with
{0} initializer will no longer work. We need a proper constructor.
Signed-off-by: Jiri Denemark
---
src/qemu/qemu_driver.c | 20 +++--
src/qemu/qemu_migration.c| 28 ++-
src/qemu/qemu_migration_params.c | 38 +++-
src/qemu/qemu_migration_params.h | 3 +++
4 files changed, 61 insertions(+), 28 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bf6c0d0826..c157ff9bb0 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;
-qemuMonitorMigrationParams migParams = { 0 };
+qemuMonitorMigrationParamsPtr migParams = NULL;
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
@@ -12252,6 +12252,9 @@ qemuDomainMigratePerform(virDomainPtr dom,
goto cleanup;
}
+if (!(migParams = qemuMigrationParamsNew()))
+goto cleanup;
+
if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
goto cleanup;
@@ -12276,12 +12279,12 @@ qemuDomainMigratePerform(virDomainPtr dom,
*/
ret = qemuMigrationSrcPerform(driver, dom->conn, vm, NULL,
NULL, dconnuri, uri, NULL, NULL, 0, NULL, 0,
- compression, , cookie, cookielen,
+ compression, migParams, cookie, cookielen,
NULL, NULL, /* No output cookies in v2 */
flags, dname, resource, false);
cleanup:
-qemuMigrationParamsClear();
+qemuMigrationParamsFree(migParams);
VIR_FREE(compression);
return ret;
}
@@ -12666,13 +12669,16 @@ qemuDomainMigratePerform3(virDomainPtr dom,
virQEMUDriverPtr driver = dom->conn->privateData;
virDomainObjPtr vm;
qemuMigrationCompressionPtr compression = NULL;
-qemuMonitorMigrationParams migParams = { 0 };
+qemuMonitorMigrationParamsPtr migParams = NULL;
int ret = -1;
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
+if (!(migParams = qemuMigrationParamsNew()))
+goto cleanup;
+
if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
-return -1;
+goto cleanup;
if (!(vm = qemuDomObjFromDomain(dom)))
goto cleanup;
@@ -12684,13 +12690,13 @@ qemuDomainMigratePerform3(virDomainPtr dom,
ret = qemuMigrationSrcPerform(driver, dom->conn, vm, xmlin, NULL,
dconnuri, uri, NULL, NULL, 0, NULL, 0,
- compression, ,
+ compression, migParams,
cookiein, cookieinlen,
cookieout, cookieoutlen,
flags, dname, resource, true);
cleanup:
-qemuMigrationParamsClear();
+qemuMigrationParamsFree(migParams);
VIR_FREE(compression);
return ret;
}
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 57903c7b17..a0061c8c83 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;
-qemuMonitorMigrationParams migParams = { 0 };
+qemuMonitorMigrationParamsPtr migParams = NULL;
virNWFilterReadLockFilterUpdates();
@@ -2301,6 +2301,9 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
if (!qemuMigrationSrcIsAllowedHostdev(*def))
goto cleanup;
+if (!(migParams = qemuMigrationParamsNew()))
+goto cleanup;
+
/* Let migration hook filter domain XML */
if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) {
char *xml;
@@ -2445,7 +2448,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
}
if (qemuMigrationParamsSetCompression(driver, vm,
QEMU_ASYNC_JOB_MIGRATION_IN,
- compression, ) < 0)
+ compression, migParams) < 0)
goto stopjob;
/* Migrations using TLS need to add the "tls-creds-x509" object and
@@ -2458,17 +2461,17 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
if (qemuMigrationParamsAddTLSObjects(driver, vm, cfg, true,
QEMU_ASYNC_JOB_MIGRATION_IN,
- , , )
< 0)
+ , , migParams)
< 0)
goto stopjob;
/* Force reset of 'tls-hostname', it's a source only parameter */
-if (VIR_STRDUP(migParams.tlsHostname, "") < 0)
+if (VIR_STRDUP(migParams->tlsHostname, "") < 0)
goto stopjob;
} else {
if