提交 d5f47d7d 编写于 作者: J Jiri Denemark

qemu: Refactor KVM features check

The checks are now in a dedicated qemuProcessVerifyKVMFeatures function.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 e9dbe701
......@@ -3787,6 +3787,28 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
}
static int
qemuProcessVerifyKVMFeatures(virDomainDefPtr def,
virCPUDataPtr cpu)
{
int rc = 0;
if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] != VIR_TRISTATE_SWITCH_ON)
return 0;
rc = virCPUDataCheckFeature(cpu, VIR_CPU_x86_KVM_PV_UNHALT);
if (rc <= 0) {
if (rc == 0)
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("host doesn't support paravirtual spinlocks"));
return -1;
}
return 0;
}
static bool
qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver,
virDomainObjPtr vm,
......@@ -3816,15 +3838,8 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver,
goto cleanup;
}
if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] == VIR_TRISTATE_SWITCH_ON) {
if (!virCPUDataCheckFeature(guestcpu, VIR_CPU_x86_KVM_PV_UNHALT)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("host doesn't support paravirtual spinlocks"));
goto cleanup;
}
}
if (qemuProcessVerifyHypervFeatures(def, guestcpu) < 0)
if (qemuProcessVerifyKVMFeatures(def, guestcpu) < 0 ||
qemuProcessVerifyHypervFeatures(def, guestcpu) < 0)
goto cleanup;
if (def->cpu) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册