]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Move feature verification from PostParse() to Validate()
authorAndrea Bolognani <abologna@redhat.com>
Fri, 2 Feb 2018 09:58:13 +0000 (10:58 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Tue, 13 Feb 2018 13:39:49 +0000 (14:39 +0100)
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@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_domain.c

index 178ec24ae7e0cd4cc3b488cfb100e77b629104ae..eb8bb78a7e4afadea63cf6516b235734ac741e43 100644 (file)
@@ -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: