Move the code fetching the model of the net device before the main code
parsing individual device types so that the data is available before the
upcoming refactor.

Signed-off-by: Peter Krempa <pkre...@redhat.com>
---
 src/conf/domain_conf.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 77d3ef564e..35843f6b72 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9019,6 +9019,10 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
                                &def->trustGuestRxFilters) < 0)
         return NULL;

+    if ((model = virXPathString("string(./model/@type)", ctxt)) &&
+        virDomainNetSetModelString(def, model) < 0)
+        return NULL;
+
     if ((source_node = virXPathNode("./source", ctxt))) {
         if (virDomainNetIPInfoParseXML(_("interface host IP"), source_node, 
ctxt, &def->hostIP) < 0)
             return NULL;
@@ -9202,7 +9206,6 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
     def->script = virXPathString("string(./script/@path)", ctxt);
     def->downscript = virXPathString("string(./downscript/@path)", ctxt);
     def->domain_name = virXPathString("string(./backenddomain/@name)", ctxt);
-    model = virXPathString("string(./model/@type)", ctxt);

     if ((filterref_node = virXPathNode("./filterref", ctxt))) {
         filter = virXMLPropString(filterref_node, "filter");
@@ -9258,10 +9261,6 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
         return NULL;
     }

-    if (model != NULL &&
-        virDomainNetSetModelString(def, model) < 0)
-        return NULL;
-
     switch (def->type) {
     case VIR_DOMAIN_NET_TYPE_NETWORK:
         break;
-- 
2.37.1

Reply via email to