mirror of https://gitee.com/openkylin/libvirt.git
qemu: Use qemuMigrationParamsFromFlags everywhere
Every migration entry point in qemu_driver is supposed to call qemuMigrationParamsFromFlags to transform flags and parameters into qemuMigrationParams structure and pass the result to qemuMigration* APIs. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
b51415513c
commit
111debd61c
|
@ -12104,6 +12104,7 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
|
|||
virQEMUDriverPtr driver = dconn->privateData;
|
||||
virDomainDefPtr def = NULL;
|
||||
char *origname = NULL;
|
||||
qemuMigrationParamsPtr migParams = NULL;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
|
||||
|
@ -12114,6 +12115,10 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
|
||||
QEMU_MIGRATION_DESTINATION)))
|
||||
goto cleanup;
|
||||
|
||||
if (virLockManagerPluginUsesState(driver->lockManager)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Cannot use migrate v2 protocol with lock manager %s"),
|
||||
|
@ -12129,9 +12134,10 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
|
|||
|
||||
ret = qemuMigrationDstPrepareTunnel(driver, dconn,
|
||||
NULL, 0, NULL, NULL, /* No cookies in v2 */
|
||||
st, &def, origname, flags);
|
||||
st, &def, origname, migParams, flags);
|
||||
|
||||
cleanup:
|
||||
qemuMigrationParamsFree(migParams);
|
||||
VIR_FREE(origname);
|
||||
virDomainDefFree(def);
|
||||
return ret;
|
||||
|
@ -12156,6 +12162,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
|
|||
virDomainDefPtr def = NULL;
|
||||
char *origname = NULL;
|
||||
qemuMigrationCompressionPtr compression = NULL;
|
||||
qemuMigrationParamsPtr migParams = NULL;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
|
||||
|
@ -12173,6 +12180,10 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
|
|||
if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
|
||||
QEMU_MIGRATION_DESTINATION)))
|
||||
goto cleanup;
|
||||
|
||||
if (virLockManagerPluginUsesState(driver->lockManager)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Cannot use migrate v2 protocol with lock manager %s"),
|
||||
|
@ -12194,9 +12205,10 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
|
|||
NULL, 0, NULL, NULL, /* No cookies */
|
||||
uri_in, uri_out,
|
||||
&def, origname, NULL, 0, NULL, 0,
|
||||
compression, flags);
|
||||
compression, migParams, flags);
|
||||
|
||||
cleanup:
|
||||
qemuMigrationParamsFree(migParams);
|
||||
VIR_FREE(compression);
|
||||
VIR_FREE(origname);
|
||||
virDomainDefFree(def);
|
||||
|
@ -12230,10 +12242,11 @@ qemuDomainMigratePerform(virDomainPtr dom,
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(migParams = qemuMigrationParamsNew()))
|
||||
if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
|
||||
if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
|
||||
QEMU_MIGRATION_SOURCE)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(vm = qemuDomObjFromDomain(dom)))
|
||||
|
@ -12408,6 +12421,7 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
|
|||
virDomainDefPtr def = NULL;
|
||||
char *origname = NULL;
|
||||
qemuMigrationCompressionPtr compression = NULL;
|
||||
qemuMigrationParamsPtr migParams = NULL;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
|
||||
|
@ -12425,6 +12439,10 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
|
|||
if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
|
||||
QEMU_MIGRATION_DESTINATION)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
|
||||
goto cleanup;
|
||||
|
||||
|
@ -12436,9 +12454,10 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
|
|||
cookieout, cookieoutlen,
|
||||
uri_in, uri_out,
|
||||
&def, origname, NULL, 0, NULL, 0,
|
||||
compression, flags);
|
||||
compression, migParams, flags);
|
||||
|
||||
cleanup:
|
||||
qemuMigrationParamsFree(migParams);
|
||||
VIR_FREE(compression);
|
||||
VIR_FREE(origname);
|
||||
virDomainDefFree(def);
|
||||
|
@ -12468,6 +12487,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
|
|||
const char **migrate_disks = NULL;
|
||||
char *origname = NULL;
|
||||
qemuMigrationCompressionPtr compression = NULL;
|
||||
qemuMigrationParamsPtr migParams = NULL;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlagsGoto(QEMU_MIGRATION_FLAGS, cleanup);
|
||||
|
@ -12501,6 +12521,10 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
|
|||
if (!(compression = qemuMigrationAnyCompressionParse(params, nparams, flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(migParams = qemuMigrationParamsFromFlags(params, nparams, flags,
|
||||
QEMU_MIGRATION_DESTINATION)))
|
||||
goto cleanup;
|
||||
|
||||
if (flags & VIR_MIGRATE_TUNNELLED) {
|
||||
/* this is a logical error; we never should have gotten here with
|
||||
* VIR_MIGRATE_TUNNELLED set
|
||||
|
@ -12523,9 +12547,10 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
|
|||
uri_in, uri_out,
|
||||
&def, origname, listenAddress,
|
||||
nmigrate_disks, migrate_disks, nbdPort,
|
||||
compression, flags);
|
||||
compression, migParams, flags);
|
||||
|
||||
cleanup:
|
||||
qemuMigrationParamsFree(migParams);
|
||||
VIR_FREE(compression);
|
||||
VIR_FREE(migrate_disks);
|
||||
VIR_FREE(origname);
|
||||
|
@ -12550,6 +12575,7 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
|
|||
virQEMUDriverPtr driver = dconn->privateData;
|
||||
virDomainDefPtr def = NULL;
|
||||
char *origname = NULL;
|
||||
qemuMigrationParamsPtr migParams = NULL;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
|
||||
|
@ -12560,6 +12586,10 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
|
||||
QEMU_MIGRATION_DESTINATION)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
|
||||
goto cleanup;
|
||||
|
||||
|
@ -12569,9 +12599,10 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
|
|||
ret = qemuMigrationDstPrepareTunnel(driver, dconn,
|
||||
cookiein, cookieinlen,
|
||||
cookieout, cookieoutlen,
|
||||
st, &def, origname, flags);
|
||||
st, &def, origname, migParams, flags);
|
||||
|
||||
cleanup:
|
||||
qemuMigrationParamsFree(migParams);
|
||||
VIR_FREE(origname);
|
||||
virDomainDefFree(def);
|
||||
return ret;
|
||||
|
@ -12593,6 +12624,7 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
|
|||
const char *dom_xml = NULL;
|
||||
const char *dname = NULL;
|
||||
char *origname = NULL;
|
||||
qemuMigrationParamsPtr migParams = NULL;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
|
||||
|
@ -12613,6 +12645,10 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(migParams = qemuMigrationParamsFromFlags(params, nparams, flags,
|
||||
QEMU_MIGRATION_DESTINATION)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
|
||||
goto cleanup;
|
||||
|
||||
|
@ -12622,9 +12658,10 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
|
|||
ret = qemuMigrationDstPrepareTunnel(driver, dconn,
|
||||
cookiein, cookieinlen,
|
||||
cookieout, cookieoutlen,
|
||||
st, &def, origname, flags);
|
||||
st, &def, origname, migParams, flags);
|
||||
|
||||
cleanup:
|
||||
qemuMigrationParamsFree(migParams);
|
||||
VIR_FREE(origname);
|
||||
virDomainDefFree(def);
|
||||
return ret;
|
||||
|
@ -12652,10 +12689,11 @@ qemuDomainMigratePerform3(virDomainPtr dom,
|
|||
|
||||
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
|
||||
|
||||
if (!(migParams = qemuMigrationParamsNew()))
|
||||
if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
|
||||
if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
|
||||
QEMU_MIGRATION_SOURCE)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(vm = qemuDomObjFromDomain(dom)))
|
||||
|
@ -12743,11 +12781,11 @@ qemuDomainMigratePerform3Params(virDomainPtr dom,
|
|||
if (nmigrate_disks < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(migParams = qemuMigrationParamsFromFlags(params, nparams, flags,
|
||||
QEMU_MIGRATION_SOURCE)))
|
||||
if (!(compression = qemuMigrationAnyCompressionParse(params, nparams, flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(compression = qemuMigrationAnyCompressionParse(params, nparams, flags)))
|
||||
if (!(migParams = qemuMigrationParamsFromFlags(params, nparams, flags,
|
||||
QEMU_MIGRATION_SOURCE)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(vm = qemuDomObjFromDomain(dom)))
|
||||
|
|
|
@ -2164,6 +2164,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
|
|||
const char **migrate_disks,
|
||||
int nbdPort,
|
||||
qemuMigrationCompressionPtr compression,
|
||||
qemuMigrationParamsPtr migParams,
|
||||
unsigned long flags)
|
||||
{
|
||||
virDomainObjPtr vm = NULL;
|
||||
|
@ -2184,7 +2185,6 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
|
|||
int rv;
|
||||
char *tlsAlias = NULL;
|
||||
char *secAlias = NULL;
|
||||
qemuMigrationParamsPtr migParams = NULL;
|
||||
|
||||
virNWFilterReadLockFilterUpdates();
|
||||
|
||||
|
@ -2234,9 +2234,6 @@ 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;
|
||||
|
@ -2503,7 +2500,6 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
|
|||
virDomainObjRemoveTransientDef(vm);
|
||||
qemuDomainRemoveInactiveJob(driver, vm);
|
||||
}
|
||||
qemuMigrationParamsFree(migParams);
|
||||
virDomainObjEndAPI(&vm);
|
||||
qemuDomainEventQueue(driver, event);
|
||||
qemuMigrationCookieFree(mig);
|
||||
|
@ -2543,6 +2539,7 @@ qemuMigrationDstPrepareTunnel(virQEMUDriverPtr driver,
|
|||
virStreamPtr st,
|
||||
virDomainDefPtr *def,
|
||||
const char *origname,
|
||||
qemuMigrationParamsPtr migParams,
|
||||
unsigned long flags)
|
||||
{
|
||||
qemuMigrationCompressionPtr compression = NULL;
|
||||
|
@ -2566,7 +2563,7 @@ qemuMigrationDstPrepareTunnel(virQEMUDriverPtr driver,
|
|||
ret = qemuMigrationDstPrepareAny(driver, dconn, cookiein, cookieinlen,
|
||||
cookieout, cookieoutlen, def, origname,
|
||||
st, NULL, 0, false, NULL, 0, NULL, 0,
|
||||
compression, flags);
|
||||
compression, migParams, flags);
|
||||
VIR_FREE(compression);
|
||||
return ret;
|
||||
}
|
||||
|
@ -2611,6 +2608,7 @@ qemuMigrationDstPrepareDirect(virQEMUDriverPtr driver,
|
|||
const char **migrate_disks,
|
||||
int nbdPort,
|
||||
qemuMigrationCompressionPtr compression,
|
||||
qemuMigrationParamsPtr migParams,
|
||||
unsigned long flags)
|
||||
{
|
||||
unsigned short port = 0;
|
||||
|
@ -2734,7 +2732,7 @@ qemuMigrationDstPrepareDirect(virQEMUDriverPtr driver,
|
|||
NULL, uri ? uri->scheme : "tcp",
|
||||
port, autoPort, listenAddress,
|
||||
nmigrate_disks, migrate_disks, nbdPort,
|
||||
compression, flags);
|
||||
compression, migParams, flags);
|
||||
cleanup:
|
||||
virURIFree(uri);
|
||||
VIR_FREE(hostname);
|
||||
|
@ -3788,7 +3786,8 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
|
|||
const char *dconnuri,
|
||||
unsigned long flags,
|
||||
const char *dname,
|
||||
unsigned long resource)
|
||||
unsigned long resource,
|
||||
qemuMigrationParamsPtr migParams)
|
||||
{
|
||||
virDomainPtr ddomain = NULL;
|
||||
char *uri_out = NULL;
|
||||
|
@ -3800,7 +3799,6 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
|
|||
virStreamPtr st = NULL;
|
||||
unsigned long destflags;
|
||||
qemuMigrationCompressionPtr compression = NULL;
|
||||
qemuMigrationParamsPtr migParams = NULL;
|
||||
|
||||
VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, dconnuri=%s, "
|
||||
"flags=0x%lx, dname=%s, resource=%lu",
|
||||
|
@ -3822,9 +3820,6 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
|
|||
destflags = flags & ~(VIR_MIGRATE_ABORT_ON_ERROR |
|
||||
VIR_MIGRATE_AUTO_CONVERGE);
|
||||
|
||||
if (!(migParams = qemuMigrationParamsNew()))
|
||||
goto cleanup;
|
||||
|
||||
if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
|
||||
goto cleanup;
|
||||
|
||||
|
@ -3926,7 +3921,6 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
|
|||
virSetError(orig_err);
|
||||
virFreeError(orig_err);
|
||||
}
|
||||
qemuMigrationParamsFree(migParams);
|
||||
VIR_FREE(uri_out);
|
||||
VIR_FREE(cookie);
|
||||
VIR_FREE(compression);
|
||||
|
@ -4442,7 +4436,8 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr driver,
|
|||
useParams, flags);
|
||||
} else {
|
||||
ret = qemuMigrationSrcPerformPeer2Peer2(driver, sconn, dconn, vm,
|
||||
dconnuri, flags, dname, resource);
|
||||
dconnuri, flags, dname, resource,
|
||||
migParams);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
|
|
@ -148,6 +148,7 @@ qemuMigrationDstPrepareTunnel(virQEMUDriverPtr driver,
|
|||
virStreamPtr st,
|
||||
virDomainDefPtr *def,
|
||||
const char *origname,
|
||||
qemuMigrationParamsPtr migParams,
|
||||
unsigned long flags);
|
||||
|
||||
int
|
||||
|
@ -166,6 +167,7 @@ qemuMigrationDstPrepareDirect(virQEMUDriverPtr driver,
|
|||
const char **migrate_disks,
|
||||
int nbdPort,
|
||||
qemuMigrationCompressionPtr compression,
|
||||
qemuMigrationParamsPtr migParams,
|
||||
unsigned long flags);
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in New Issue