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: Andrea Bolognani <abologna(a)redhat.com>
---
src/qemu/qemu_domain.c | 54 +++++++++++++++++++++++++-------------------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index df433c2f0..27a4751e9 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3113,30 +3113,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,
@@ -3195,9 +3171,6 @@ qemuDomainDefPostParse(virDomainDefPtr def,
qemuDomainDefEnableDefaultFeatures(def, qemuCaps);
- if (qemuDomainDefVerifyFeatures(def) < 0)
- goto cleanup;
-
if (qemuDomainRecheckInternalPaths(def, cfg, parseFlags) < 0)
goto cleanup;
@@ -3250,6 +3223,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,
@@ -3362,6 +3359,9 @@ qemuDomainDefValidate(const virDomainDef *def,
}
}
+ if (qemuDomainDefValidateFeatures(def) < 0)
+ goto cleanup;
+
ret = 0;
cleanup:
--
2.14.3