mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 14:35:25 +00:00
qemu: Set always-on migration caps in ParamsCheck
Some migration capabilities are always enabled if QEMU supports them. We can just drop the explicit code for them and let qemuMigrationParamsCheck automatically set such capabilities. QEMU_MONITOR_MIGRATION_CAPS_EVENTS would normally be one of the always on features, but it is the only feature we want to enable even for other jobs which internally use migration (such as save and snapshot). Hence this capability is set very early after libvirtd connects to QEMU monitor. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
1034418b54
commit
78bd047075
@ -3359,12 +3359,6 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
|
||||
migParams) < 0)
|
||||
goto error;
|
||||
|
||||
if (qemuMigrationCapsGet(vm, QEMU_MONITOR_MIGRATION_CAPS_PAUSE_BEFORE_SWITCHOVER) &&
|
||||
qemuMigrationParamsSetCapability(vm,
|
||||
QEMU_MONITOR_MIGRATION_CAPS_PAUSE_BEFORE_SWITCHOVER,
|
||||
true, migParams) < 0)
|
||||
goto error;
|
||||
|
||||
if (qemuMigrationParamsCheck(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
|
||||
migParams) < 0)
|
||||
goto error;
|
||||
|
@ -43,6 +43,19 @@ struct _qemuMigrationParams {
|
||||
qemuMonitorMigrationParams params;
|
||||
};
|
||||
|
||||
typedef struct _qemuMigrationParamsAlwaysOnItem qemuMigrationParamsAlwaysOnItem;
|
||||
struct _qemuMigrationParamsAlwaysOnItem {
|
||||
qemuMonitorMigrationCaps cap;
|
||||
int party; /* bit-wise OR of qemuMigrationParty */
|
||||
};
|
||||
|
||||
/* Migration capabilities which should always be enabled as long as they
|
||||
* are supported by QEMU. */
|
||||
static const qemuMigrationParamsAlwaysOnItem qemuMigrationParamsAlwaysOn[] = {
|
||||
{QEMU_MONITOR_MIGRATION_CAPS_PAUSE_BEFORE_SWITCHOVER,
|
||||
QEMU_MIGRATION_SOURCE},
|
||||
};
|
||||
|
||||
|
||||
static qemuMigrationParamsPtr
|
||||
qemuMigrationParamsNew(void)
|
||||
@ -399,8 +412,15 @@ qemuMigrationParamsCheck(virQEMUDriverPtr driver,
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
qemuMigrationParamsPtr origParams = NULL;
|
||||
qemuMonitorMigrationCaps cap;
|
||||
qemuMigrationParty party;
|
||||
size_t i;
|
||||
int ret = -1;
|
||||
|
||||
if (asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT)
|
||||
party = QEMU_MIGRATION_SOURCE;
|
||||
else
|
||||
party = QEMU_MIGRATION_DESTINATION;
|
||||
|
||||
for (cap = 0; cap < QEMU_MONITOR_MIGRATION_CAPS_LAST; cap++) {
|
||||
bool state = false;
|
||||
|
||||
@ -414,6 +434,17 @@ qemuMigrationParamsCheck(virQEMUDriverPtr driver,
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_CARDINALITY(qemuMigrationParamsAlwaysOn); i++) {
|
||||
cap = qemuMigrationParamsAlwaysOn[i].cap;
|
||||
|
||||
if (qemuMigrationParamsAlwaysOn[i].party & party &&
|
||||
qemuMigrationCapsGet(vm, cap)) {
|
||||
VIR_DEBUG("Enabling migration capability '%s'",
|
||||
qemuMonitorMigrationCapsTypeToString(cap));
|
||||
ignore_value(virBitmapSetBit(migParams->caps, cap));
|
||||
}
|
||||
}
|
||||
|
||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||
return -1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user