提交 78bd0470 编写于 作者: J Jiri Denemark

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: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 1034418b
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册