提交 56ca68c3 编写于 作者: A Andrea Bolognani

qemu: Move feature verification from PostParse() to Validate()

We want to perform all feature verification in a single spot, but
some of it (eg. GIC) is currently being performed at command line
generation time, and moving it to PostParse() would cause guests
to disappear. Moving verification to Validate() allows us to
side-step the issue.
Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 554a5edc
......@@ -3202,30 +3202,6 @@ qemuDomainDefCPUPostParse(virDomainDefPtr def)
}
static int
qemuDomainDefVerifyFeatures(const virDomainDef *def)
{
if (def->features[VIR_DOMAIN_FEATURE_IOAPIC] == VIR_TRISTATE_SWITCH_ON &&
!ARCH_IS_X86(def->os.arch)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("I/O APIC tuning is not supported "
"for '%s' architecture"),
virArchToString(def->os.arch));
return -1;
}
if (def->features[VIR_DOMAIN_FEATURE_HPT] == VIR_TRISTATE_SWITCH_ON &&
!qemuDomainIsPSeries(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s",
_("HPT tuning is only supported for pSeries guests"));
return -1;
}
return 0;
}
static int
qemuDomainDefPostParseBasic(virDomainDefPtr def,
virCapsPtr caps,
......@@ -3284,9 +3260,6 @@ qemuDomainDefPostParse(virDomainDefPtr def,
qemuDomainDefEnableDefaultFeatures(def, qemuCaps);
if (qemuDomainDefVerifyFeatures(def) < 0)
goto cleanup;
if (qemuDomainRecheckInternalPaths(def, cfg, parseFlags) < 0)
goto cleanup;
......@@ -3339,6 +3312,30 @@ qemuDomainDefGetVcpuHotplugGranularity(const virDomainDef *def)
#define QEMU_MAX_VCPUS_WITHOUT_EIM 255
static int
qemuDomainDefValidateFeatures(const virDomainDef *def)
{
if (def->features[VIR_DOMAIN_FEATURE_IOAPIC] == VIR_TRISTATE_SWITCH_ON &&
!ARCH_IS_X86(def->os.arch)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("I/O APIC tuning is not supported "
"for '%s' architecture"),
virArchToString(def->os.arch));
return -1;
}
if (def->features[VIR_DOMAIN_FEATURE_HPT] == VIR_TRISTATE_SWITCH_ON &&
!qemuDomainIsPSeries(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s",
_("HPT tuning is only supported for pSeries guests"));
return -1;
}
return 0;
}
static int
qemuDomainDefValidate(const virDomainDef *def,
virCapsPtr caps ATTRIBUTE_UNUSED,
......@@ -3451,6 +3448,9 @@ qemuDomainDefValidate(const virDomainDef *def,
}
}
if (qemuDomainDefValidateFeatures(def) < 0)
goto cleanup;
ret = 0;
cleanup:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册