1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-11 09:17:52 +03:00

qemu: Generalize macro for getting VIR_MIGRATE_* typed params

So far it's used only for CPU throttling parameters which are all ints,
but we'll soon want to use it for more parameters with different types.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Jiri Denemark 2018-03-09 17:17:01 +01:00
parent ffe6da2db3
commit 1b392a1cbf

View File

@ -112,6 +112,17 @@ qemuMigrationParamsFree(qemuMigrationParamsPtr migParams)
}
#define GET(API, PARAM, VAR) \
do { \
int rc; \
if ((rc = API(params, nparams, VIR_MIGRATE_PARAM_ ## PARAM, \
&migParams->params.VAR)) < 0) \
goto error; \
\
if (rc == 1) \
migParams->params.VAR ## _set = true; \
} while (0)
qemuMigrationParamsPtr
qemuMigrationParamsFromFlags(virTypedParameterPtr params,
int nparams,
@ -135,27 +146,13 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
}
}
#define GET(PARAM, VAR) \
do { \
int rc; \
if ((rc = virTypedParamsGetInt(params, nparams, \
VIR_MIGRATE_PARAM_ ## PARAM, \
&migParams->params.VAR)) < 0) \
goto error; \
\
if (rc == 1) \
migParams->params.VAR ## _set = true; \
} while (0)
if (params) {
if (party == QEMU_MIGRATION_SOURCE) {
GET(AUTO_CONVERGE_INITIAL, cpuThrottleInitial);
GET(AUTO_CONVERGE_INCREMENT, cpuThrottleIncrement);
GET(virTypedParamsGetInt, AUTO_CONVERGE_INITIAL, cpuThrottleInitial);
GET(virTypedParamsGetInt, AUTO_CONVERGE_INCREMENT, cpuThrottleIncrement);
}
}
#undef GET
if ((migParams->params.cpuThrottleInitial_set ||
migParams->params.cpuThrottleIncrement_set) &&
!(flags & VIR_MIGRATE_AUTO_CONVERGE)) {
@ -171,6 +168,8 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
return NULL;
}
#undef GET
/**
* qemuMigrationParamsApply