[libvirt PATCH 13/16] virDomainFeaturesDefParse: Inline MSRS parsing

Tim Wiederhake posted 16 patches 3 years, 4 months ago
[libvirt PATCH 13/16] virDomainFeaturesDefParse: Inline MSRS parsing
Posted by Tim Wiederhake 3 years, 4 months ago
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 src/conf/domain_conf.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b411c1fb8c..915303adcd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17518,10 +17518,21 @@ virDomainFeaturesDefParse(virDomainDef *def,
         case VIR_DOMAIN_FEATURE_PAE:
         case VIR_DOMAIN_FEATURE_VIRIDIAN:
         case VIR_DOMAIN_FEATURE_PRIVNET:
-        case VIR_DOMAIN_FEATURE_MSRS:
             def->features[val] = VIR_TRISTATE_SWITCH_ON;
             break;
 
+        case VIR_DOMAIN_FEATURE_MSRS: {
+            virDomainMsrsUnknown unknown;
+            if (virXMLPropEnum(nodes[i], "unknown",
+                               virDomainMsrsUnknownTypeFromString,
+                               VIR_XML_PROP_REQUIRED, &unknown) < 0)
+                return -1;
+
+            def->features[val] = VIR_TRISTATE_SWITCH_ON;
+            def->msrs_features[VIR_DOMAIN_MSRS_UNKNOWN] = unknown;
+            break;
+        }
+
         case VIR_DOMAIN_FEATURE_HYPERV:
             if (virDomainFeaturesHyperVDefParse(def, nodes[i]) < 0)
                 return -1;
@@ -17694,19 +17705,6 @@ virDomainFeaturesDefParse(virDomainDef *def,
     }
     VIR_FREE(nodes);
 
-    if (def->features[VIR_DOMAIN_FEATURE_MSRS] == VIR_TRISTATE_SWITCH_ON) {
-        virDomainMsrsUnknown unknown;
-        xmlNodePtr node = NULL;
-        if ((node = virXPathNode("./features/msrs", ctxt)) == NULL)
-            return -1;
-
-        if (virXMLPropEnum(node, "unknown", virDomainMsrsUnknownTypeFromString,
-                           VIR_XML_PROP_REQUIRED, &unknown) < 0)
-            return -1;
-
-        def->msrs_features[VIR_DOMAIN_MSRS_UNKNOWN] = unknown;
-    }
-
     if ((n = virXPathNodeSet("./features/capabilities/*", ctxt, &nodes)) < 0)
         return -1;
 
-- 
2.31.1