mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
qemu: Hide qemuMigrationParamsSetCompression
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@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
4087d312d2
commit
ebd1e3ff18
@ -12120,7 +12120,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)) {
|
||||
@ -12138,7 +12138,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);
|
||||
@ -12186,7 +12186,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)) {
|
||||
@ -12210,7 +12210,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);
|
||||
@ -12251,7 +12251,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)))
|
||||
@ -12445,7 +12445,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)))
|
||||
@ -12459,7 +12459,7 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
|
||||
cookieout, cookieoutlen,
|
||||
uri_in, uri_out,
|
||||
&def, origname, NULL, 0, NULL, 0,
|
||||
compression, migParams, flags);
|
||||
migParams, flags);
|
||||
|
||||
cleanup:
|
||||
qemuMigrationParamsFree(migParams);
|
||||
@ -12527,7 +12527,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) {
|
||||
@ -12552,7 +12552,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
|
||||
uri_in, uri_out,
|
||||
&def, origname, listenAddress,
|
||||
nmigrate_disks, migrate_disks, nbdPort,
|
||||
compression, migParams, flags);
|
||||
migParams, flags);
|
||||
|
||||
cleanup:
|
||||
qemuMigrationParamsFree(migParams);
|
||||
@ -12596,7 +12596,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)))
|
||||
@ -12608,7 +12608,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);
|
||||
@ -12660,7 +12660,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)))
|
||||
@ -12672,7 +12672,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);
|
||||
@ -12708,7 +12708,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)))
|
||||
@ -12800,7 +12800,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)))
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user