[PATCH 23/37] virDomainNetDefParseXML: Extract network device model earlier

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

 



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 <pkrempa@xxxxxxxxxx>
---
 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




[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