qemu: Introduce qemuMigrationParty enum

Some migration parameters and capabilities are supposed to be set on
both sides of migration while others should only be set on one side. For
example, CPU throttling parameters make no sense on the destination and
they can be used even if the destination is too old to support them.

To make qemuMigrationParamsFromFlags more general and usable on both
sides of migration, we need to tell it what side it's been called on.

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 11:23:49 +01:00
parent 657980693c
commit b51415513c
3 changed files with 15 additions and 5 deletions

View File

@ -12743,7 +12743,8 @@ qemuDomainMigratePerform3Params(virDomainPtr dom,
if (nmigrate_disks < 0)
goto cleanup;
if (!(migParams = qemuMigrationParamsFromFlags(params, nparams, flags)))
if (!(migParams = qemuMigrationParamsFromFlags(params, nparams, flags,
QEMU_MIGRATION_SOURCE)))
goto cleanup;
if (!(compression = qemuMigrationAnyCompressionParse(params, nparams, flags)))

View File

@ -80,7 +80,8 @@ qemuMigrationParamsFree(qemuMigrationParamsPtr migParams)
qemuMigrationParamsPtr
qemuMigrationParamsFromFlags(virTypedParameterPtr params,
int nparams,
unsigned long flags)
unsigned long flags,
qemuMigrationParty party)
{
qemuMigrationParamsPtr migParams;
@ -102,8 +103,10 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
migParams->params.VAR ## _set = true; \
} while (0)
GET(AUTO_CONVERGE_INITIAL, cpuThrottleInitial);
GET(AUTO_CONVERGE_INCREMENT, cpuThrottleIncrement);
if (party == QEMU_MIGRATION_SOURCE) {
GET(AUTO_CONVERGE_INITIAL, cpuThrottleInitial);
GET(AUTO_CONVERGE_INCREMENT, cpuThrottleIncrement);
}
#undef GET

View File

@ -50,6 +50,11 @@ struct _qemuMigrationCompression {
typedef struct _qemuMigrationParams qemuMigrationParams;
typedef qemuMigrationParams *qemuMigrationParamsPtr;
typedef enum {
QEMU_MIGRATION_SOURCE = (1 << 0),
QEMU_MIGRATION_DESTINATION = (1 << 1),
} qemuMigrationParty;
qemuMigrationParamsPtr
qemuMigrationParamsNew(void);
@ -57,7 +62,8 @@ qemuMigrationParamsNew(void);
qemuMigrationParamsPtr
qemuMigrationParamsFromFlags(virTypedParameterPtr params,
int nparams,
unsigned long flags);
unsigned long flags,
qemuMigrationParty party);
void
qemuMigrationParamsFree(qemuMigrationParamsPtr migParams);