mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
qemu: Support enabling migration caps unless a flag is used
So far we were enabling specific migration capabilities when a corresponding API flag is set. We need to generalize our code to be able to enable some migration capabilities unless a particular API flag is used. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
7826148a72
commit
4f9f3c5d13
@ -47,6 +47,11 @@ typedef enum {
|
|||||||
QEMU_MIGRATION_PARAM_TYPE_STRING,
|
QEMU_MIGRATION_PARAM_TYPE_STRING,
|
||||||
} qemuMigrationParamType;
|
} qemuMigrationParamType;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
QEMU_MIGRATION_FLAG_REQUIRED,
|
||||||
|
QEMU_MIGRATION_FLAG_FORBIDDEN,
|
||||||
|
} qemuMigrationFlagMatch;
|
||||||
|
|
||||||
typedef struct _qemuMigrationParamValue qemuMigrationParamValue;
|
typedef struct _qemuMigrationParamValue qemuMigrationParamValue;
|
||||||
struct _qemuMigrationParamValue {
|
struct _qemuMigrationParamValue {
|
||||||
bool set;
|
bool set;
|
||||||
@ -119,6 +124,7 @@ struct _qemuMigrationParamsAlwaysOnItem {
|
|||||||
|
|
||||||
typedef struct _qemuMigrationParamsFlagMapItem qemuMigrationParamsFlagMapItem;
|
typedef struct _qemuMigrationParamsFlagMapItem qemuMigrationParamsFlagMapItem;
|
||||||
struct _qemuMigrationParamsFlagMapItem {
|
struct _qemuMigrationParamsFlagMapItem {
|
||||||
|
qemuMigrationFlagMatch match;
|
||||||
virDomainMigrateFlags flag;
|
virDomainMigrateFlags flag;
|
||||||
qemuMigrationCapability cap;
|
qemuMigrationCapability cap;
|
||||||
int party; /* bit-wise OR of qemuMigrationParty */
|
int party; /* bit-wise OR of qemuMigrationParty */
|
||||||
@ -146,19 +152,23 @@ static const qemuMigrationParamsAlwaysOnItem qemuMigrationParamsAlwaysOn[] = {
|
|||||||
|
|
||||||
/* Translation from virDomainMigrateFlags to qemuMigrationCapability. */
|
/* Translation from virDomainMigrateFlags to qemuMigrationCapability. */
|
||||||
static const qemuMigrationParamsFlagMapItem qemuMigrationParamsFlagMap[] = {
|
static const qemuMigrationParamsFlagMapItem qemuMigrationParamsFlagMap[] = {
|
||||||
{VIR_MIGRATE_RDMA_PIN_ALL,
|
{QEMU_MIGRATION_FLAG_REQUIRED,
|
||||||
|
VIR_MIGRATE_RDMA_PIN_ALL,
|
||||||
QEMU_MIGRATION_CAP_RDMA_PIN_ALL,
|
QEMU_MIGRATION_CAP_RDMA_PIN_ALL,
|
||||||
QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION},
|
QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION},
|
||||||
|
|
||||||
{VIR_MIGRATE_AUTO_CONVERGE,
|
{QEMU_MIGRATION_FLAG_REQUIRED,
|
||||||
|
VIR_MIGRATE_AUTO_CONVERGE,
|
||||||
QEMU_MIGRATION_CAP_AUTO_CONVERGE,
|
QEMU_MIGRATION_CAP_AUTO_CONVERGE,
|
||||||
QEMU_MIGRATION_SOURCE},
|
QEMU_MIGRATION_SOURCE},
|
||||||
|
|
||||||
{VIR_MIGRATE_POSTCOPY,
|
{QEMU_MIGRATION_FLAG_REQUIRED,
|
||||||
|
VIR_MIGRATE_POSTCOPY,
|
||||||
QEMU_MIGRATION_CAP_POSTCOPY,
|
QEMU_MIGRATION_CAP_POSTCOPY,
|
||||||
QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION},
|
QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION},
|
||||||
|
|
||||||
{VIR_MIGRATE_PARALLEL,
|
{QEMU_MIGRATION_FLAG_REQUIRED,
|
||||||
|
VIR_MIGRATE_PARALLEL,
|
||||||
QEMU_MIGRATION_CAP_MULTIFD,
|
QEMU_MIGRATION_CAP_MULTIFD,
|
||||||
QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION},
|
QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION},
|
||||||
};
|
};
|
||||||
@ -553,13 +563,16 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS(qemuMigrationParamsFlagMap); i++) {
|
for (i = 0; i < G_N_ELEMENTS(qemuMigrationParamsFlagMap); i++) {
|
||||||
qemuMigrationCapability cap = qemuMigrationParamsFlagMap[i].cap;
|
const qemuMigrationParamsFlagMapItem *item = &qemuMigrationParamsFlagMap[i];
|
||||||
|
int match = 0;
|
||||||
|
|
||||||
if (qemuMigrationParamsFlagMap[i].party & party &&
|
if (item->match == QEMU_MIGRATION_FLAG_REQUIRED)
|
||||||
flags & qemuMigrationParamsFlagMap[i].flag) {
|
match = item->flag;
|
||||||
|
|
||||||
|
if (item->party & party && (flags & item->flag) == match) {
|
||||||
VIR_DEBUG("Enabling migration capability '%s'",
|
VIR_DEBUG("Enabling migration capability '%s'",
|
||||||
qemuMigrationCapabilityTypeToString(cap));
|
qemuMigrationCapabilityTypeToString(item->cap));
|
||||||
ignore_value(virBitmapSetBit(migParams->caps, cap));
|
ignore_value(virBitmapSetBit(migParams->caps, item->cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user