From 56ca68c3c8947fb37e97a131af7d0fcd1987e800 Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Fri, 2 Feb 2018 10:58:13 +0100 Subject: [PATCH] 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: Andrea Bolognani Reviewed-by: John Ferlan --- 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 178ec24ae7..eb8bb78a7e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -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: -- 2.39.5