[PATCH 28/31] qemuValidateDomainDefPSeriesFeature: Simplify machine validation logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Return early and reformat the error message.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_validate.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 83e4ca757e..793990c4ca 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -41,20 +41,18 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def,
 {
     const char *str;

-    if (def->features[feature] != VIR_TRISTATE_SWITCH_ABSENT &&
-        !qemuDomainIsPSeries(def)) {
+    if (def->features[feature] == VIR_TRISTATE_SWITCH_ABSENT)
+        return 0;
+
+    if (!qemuDomainIsPSeries(def)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("The '%s' feature is not supported for "
-                         "architecture '%s' or machine type '%s'"),
+                       _("The '%s' feature is not supported for architecture '%s' or machine type '%s'"),
                        virDomainFeatureTypeToString(feature),
                        virArchToString(def->os.arch),
                        def->os.machine);
         return -1;
     }

-    if (def->features[feature] == VIR_TRISTATE_SWITCH_ABSENT)
-        return 0;
-
     switch (feature) {
     case VIR_DOMAIN_FEATURE_HPT:
         if (def->features[feature] != VIR_TRISTATE_SWITCH_ON)
-- 
2.39.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux