[PATCH 29/31] qemuValidateDomainDefPSeriesFeature: Simplify feature validation

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

 



Unify validation of VIR_DOMAIN_FEATURE_HTM, VIR_DOMAIN_FEATURE_NESTED_HV,
VIR_DOMAIN_FEATURE_CCF_ASSIST and remove temporary string.

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

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 793990c4ca..83f2502e6a 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -39,8 +39,6 @@ static int
 qemuValidateDomainDefPSeriesFeature(const virDomainDef *def,
                                     int feature)
 {
-    const char *str;
-
     if (def->features[feature] == VIR_TRISTATE_SWITCH_ABSENT)
         return 0;

@@ -59,8 +57,7 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def,
             break;

         if (def->hpt_resizing != VIR_DOMAIN_HPT_RESIZING_NONE) {
-            str = virDomainHPTResizingTypeToString(def->hpt_resizing);
-            if (!str) {
+            if (!virDomainHPTResizingTypeToString(def->hpt_resizing)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("Invalid setting for HPT resizing"));
                 return -1;
@@ -69,33 +66,15 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def,
         break;

     case VIR_DOMAIN_FEATURE_HTM:
-        str = virTristateSwitchTypeToString(def->features[feature]);
-        if (!str) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("Invalid setting for HTM state"));
-            return -1;
-        }
-
-        break;
-
     case VIR_DOMAIN_FEATURE_NESTED_HV:
-        str = virTristateSwitchTypeToString(def->features[feature]);
-        if (!str) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("Invalid setting for nested HV state"));
-            return -1;
-        }
-
-        break;
-
     case VIR_DOMAIN_FEATURE_CCF_ASSIST:
-        str = virTristateSwitchTypeToString(def->features[feature]);
-        if (!str) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("Invalid setting for ccf-assist state"));
+        if (!virTristateSwitchTypeToString(def->features[feature])) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("Invalid setting for pseries feature '%s'"),
+                           virDomainFeatureTypeToString(feature));
+
             return -1;
         }
-
         break;

     case VIR_DOMAIN_FEATURE_CFPC:
-- 
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