[PATCH 2/5] conf: Add network xmlopt argument

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

 



Pass an xmlopt argument through all the needed network conf
functions, like is done for domain XML handling. No functional
change for now

Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
---
 src/conf/domain_conf.c           |  2 +-
 src/conf/network_conf.c          | 40 +++++++++++++++----------
 src/conf/network_conf.h          | 21 ++++++++++----
 src/conf/virnetworkobj.c         | 50 ++++++++++++++++++++------------
 src/conf/virnetworkobj.h         | 13 ++++++---
 src/esx/esx_network_driver.c     |  4 +--
 src/network/bridge_driver.c      | 46 ++++++++++++++++++-----------
 src/qemu/qemu_process.c          |  2 +-
 src/test/test_driver.c           | 11 +++----
 src/vbox/vbox_network.c          |  4 +--
 tests/networkxml2conftest.c      |  2 +-
 tests/networkxml2firewalltest.c  |  2 +-
 tests/networkxml2xmltest.c       |  4 +--
 tests/networkxml2xmlupdatetest.c |  4 +--
 14 files changed, 128 insertions(+), 77 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3323c9a5b1..740da645c4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -30932,7 +30932,7 @@ virDomainNetResolveActualType(virDomainNetDefPtr iface)
     if (!(xml = virNetworkGetXMLDesc(net, 0)))
         goto cleanup;
 
-    if (!(def = virNetworkDefParseString(xml)))
+    if (!(def = virNetworkDefParseString(xml, NULL)))
         goto cleanup;
 
     switch ((virNetworkForwardType) def->forward.type) {
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index ca4b9986ad..067adf7936 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -282,7 +282,9 @@ virNetworkDefFree(virNetworkDefPtr def)
  * Returns a new NetworkDef on success, or NULL on failure.
  */
 virNetworkDefPtr
-virNetworkDefCopy(virNetworkDefPtr def, unsigned int flags)
+virNetworkDefCopy(virNetworkDefPtr def,
+                  virNetworkXMLOptionPtr xmlopt,
+                  unsigned int flags)
 {
     char *xml = NULL;
     virNetworkDefPtr newDef = NULL;
@@ -294,9 +296,9 @@ virNetworkDefCopy(virNetworkDefPtr def, unsigned int flags)
     }
 
     /* deep copy with a format/parse cycle */
-    if (!(xml = virNetworkDefFormat(def, flags)))
+    if (!(xml = virNetworkDefFormat(def, xmlopt, flags)))
         goto cleanup;
-    newDef = virNetworkDefParseString(xml);
+    newDef = virNetworkDefParseString(xml, xmlopt);
  cleanup:
     VIR_FREE(xml);
     return newDef;
@@ -1619,7 +1621,8 @@ virNetworkForwardDefParseXML(const char *networkName,
 
 
 virNetworkDefPtr
-virNetworkDefParseXML(xmlXPathContextPtr ctxt)
+virNetworkDefParseXML(xmlXPathContextPtr ctxt,
+                      virNetworkXMLOptionPtr xmlopt ATTRIBUTE_UNUSED)
 {
     virNetworkDefPtr def;
     char *tmp = NULL;
@@ -2059,14 +2062,15 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
 
 static virNetworkDefPtr
 virNetworkDefParse(const char *xmlStr,
-                   const char *filename)
+                   const char *filename,
+                   virNetworkXMLOptionPtr xmlopt)
 {
     xmlDocPtr xml;
     virNetworkDefPtr def = NULL;
     int keepBlanksDefault = xmlKeepBlanksDefault(0);
 
     if ((xml = virXMLParse(filename, xmlStr, _("(network_definition)")))) {
-        def = virNetworkDefParseNode(xml, xmlDocGetRootElement(xml));
+        def = virNetworkDefParseNode(xml, xmlDocGetRootElement(xml), xmlopt);
         xmlFreeDoc(xml);
     }
 
@@ -2076,22 +2080,25 @@ virNetworkDefParse(const char *xmlStr,
 
 
 virNetworkDefPtr
-virNetworkDefParseString(const char *xmlStr)
+virNetworkDefParseString(const char *xmlStr,
+                         virNetworkXMLOptionPtr xmlopt)
 {
-    return virNetworkDefParse(xmlStr, NULL);
+    return virNetworkDefParse(xmlStr, NULL, xmlopt);
 }
 
 
 virNetworkDefPtr
-virNetworkDefParseFile(const char *filename)
+virNetworkDefParseFile(const char *filename,
+                       virNetworkXMLOptionPtr xmlopt)
 {
-    return virNetworkDefParse(NULL, filename);
+    return virNetworkDefParse(NULL, filename, xmlopt);
 }
 
 
 virNetworkDefPtr
 virNetworkDefParseNode(xmlDocPtr xml,
-                       xmlNodePtr root)
+                       xmlNodePtr root,
+                       virNetworkXMLOptionPtr xmlopt)
 {
     xmlXPathContextPtr ctxt = NULL;
     virNetworkDefPtr def = NULL;
@@ -2111,7 +2118,7 @@ virNetworkDefParseNode(xmlDocPtr xml,
     }
 
     ctxt->node = root;
-    def = virNetworkDefParseXML(ctxt);
+    def = virNetworkDefParseXML(ctxt, xmlopt);
 
  cleanup:
     xmlXPathFreeContext(ctxt);
@@ -2405,6 +2412,7 @@ virNetworkForwardNatDefFormat(virBufferPtr buf,
 int
 virNetworkDefFormatBuf(virBufferPtr buf,
                        const virNetworkDef *def,
+                       virNetworkXMLOptionPtr xmlopt ATTRIBUTE_UNUSED,
                        unsigned int flags)
 {
     const unsigned char *uuid;
@@ -2631,11 +2639,12 @@ virNetworkDefFormatBuf(virBufferPtr buf,
 
 char *
 virNetworkDefFormat(const virNetworkDef *def,
+                    virNetworkXMLOptionPtr xmlopt,
                     unsigned int flags)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
 
-    if (virNetworkDefFormatBuf(&buf, def, flags) < 0)
+    if (virNetworkDefFormatBuf(&buf, def, xmlopt, flags) < 0)
         goto error;
 
     if (virBufferCheckError(&buf) < 0)
@@ -2709,12 +2718,13 @@ virNetworkSaveXML(const char *configDir,
 
 int
 virNetworkSaveConfig(const char *configDir,
-                     virNetworkDefPtr def)
+                     virNetworkDefPtr def,
+                     virNetworkXMLOptionPtr xmlopt)
 {
     int ret = -1;
     char *xml;
 
-    if (!(xml = virNetworkDefFormat(def, VIR_NETWORK_XML_INACTIVE)))
+    if (!(xml = virNetworkDefFormat(def, xmlopt, VIR_NETWORK_XML_INACTIVE)))
         goto cleanup;
 
     if (virNetworkSaveXML(configDir, def, xml))
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index edd9f51f44..b7ce569d4a 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -301,28 +301,36 @@ virNetworkXMLOptionPtr
 virNetworkXMLOptionNew(void);
 
 virNetworkDefPtr
-virNetworkDefCopy(virNetworkDefPtr def, unsigned int flags);
+virNetworkDefCopy(virNetworkDefPtr def,
+                  virNetworkXMLOptionPtr xmlopt,
+                  unsigned int flags);
 
 virNetworkDefPtr
-virNetworkDefParseXML(xmlXPathContextPtr ctxt);
+virNetworkDefParseXML(xmlXPathContextPtr ctxt,
+                      virNetworkXMLOptionPtr xmlopt);
 
 virNetworkDefPtr
-virNetworkDefParseString(const char *xmlStr);
+virNetworkDefParseString(const char *xmlStr,
+                         virNetworkXMLOptionPtr xmlopt);
 
 virNetworkDefPtr
-virNetworkDefParseFile(const char *filename);
+virNetworkDefParseFile(const char *filename,
+                       virNetworkXMLOptionPtr xmlopt);
 
 virNetworkDefPtr
 virNetworkDefParseNode(xmlDocPtr xml,
-                       xmlNodePtr root);
+                       xmlNodePtr root,
+                       virNetworkXMLOptionPtr xmlopt);
 
 char *
 virNetworkDefFormat(const virNetworkDef *def,
+                    virNetworkXMLOptionPtr xmlopt,
                     unsigned int flags);
 
 int
 virNetworkDefFormatBuf(virBufferPtr buf,
                        const virNetworkDef *def,
+                       virNetworkXMLOptionPtr xmlopt,
                        unsigned int flags);
 
 const char *
@@ -357,7 +365,8 @@ virNetworkSaveXML(const char *configDir,
 
 int
 virNetworkSaveConfig(const char *configDir,
-                     virNetworkDefPtr def);
+                     virNetworkDefPtr def,
+                     virNetworkXMLOptionPtr xmlopt);
 
 char *
 virNetworkConfigFile(const char *dir,
diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index 476f66affc..d63ead7fac 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -673,7 +673,8 @@ virNetworkObjAssignDef(virNetworkObjListPtr nets,
  */
 int
 virNetworkObjSetDefTransient(virNetworkObjPtr obj,
-                             bool live)
+                             bool live,
+                             virNetworkXMLOptionPtr xmlopt)
 {
     if (!virNetworkObjIsActive(obj) && !live)
         return 0;
@@ -681,7 +682,9 @@ virNetworkObjSetDefTransient(virNetworkObjPtr obj,
     if (!obj->persistent || obj->newDef)
         return 0;
 
-    obj->newDef = virNetworkDefCopy(obj->def, VIR_NETWORK_XML_INACTIVE);
+    obj->newDef = virNetworkDefCopy(obj->def,
+                                    xmlopt,
+                                    VIR_NETWORK_XML_INACTIVE);
     return obj->newDef ? 0 : -1;
 }
 
@@ -759,6 +762,7 @@ virNetworkObjReplacePersistentDef(virNetworkObjPtr obj,
  */
 static int
 virNetworkObjConfigChangeSetup(virNetworkObjPtr obj,
+                               virNetworkXMLOptionPtr xmlopt,
                                unsigned int flags)
 {
     bool isActive;
@@ -782,7 +786,7 @@ virNetworkObjConfigChangeSetup(virNetworkObjPtr obj,
         /* this should already have been done by the driver, but do it
          * anyway just in case.
          */
-        if (isActive && (virNetworkObjSetDefTransient(obj, false) < 0))
+        if (isActive && (virNetworkObjSetDefTransient(obj, false, xmlopt) < 0))
             goto cleanup;
     }
 
@@ -811,6 +815,7 @@ virNetworkObjRemoveInactive(virNetworkObjListPtr nets,
 
 static char *
 virNetworkObjFormat(virNetworkObjPtr obj,
+                    virNetworkXMLOptionPtr xmlopt,
                     unsigned int flags)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -832,7 +837,7 @@ virNetworkObjFormat(virNetworkObjPtr obj,
                               virNetworkTaintTypeToString(i));
     }
 
-    if (virNetworkDefFormatBuf(&buf, obj->def, flags) < 0)
+    if (virNetworkDefFormatBuf(&buf, obj->def, xmlopt, flags) < 0)
         goto error;
 
     virBufferAdjustIndent(&buf, -2);
@@ -851,13 +856,14 @@ virNetworkObjFormat(virNetworkObjPtr obj,
 
 int
 virNetworkObjSaveStatus(const char *statusDir,
-                        virNetworkObjPtr obj)
+                        virNetworkObjPtr obj,
+                        virNetworkXMLOptionPtr xmlopt)
 {
     int ret = -1;
     int flags = 0;
     char *xml;
 
-    if (!(xml = virNetworkObjFormat(obj, flags)))
+    if (!(xml = virNetworkObjFormat(obj, xmlopt, flags)))
         goto cleanup;
 
     if (virNetworkSaveXML(statusDir, obj->def, xml))
@@ -873,7 +879,8 @@ virNetworkObjSaveStatus(const char *statusDir,
 static virNetworkObjPtr
 virNetworkLoadState(virNetworkObjListPtr nets,
                     const char *stateDir,
-                    const char *name)
+                    const char *name,
+                    virNetworkXMLOptionPtr xmlopt)
 {
     char *configFile = NULL;
     virNetworkDefPtr def = NULL;
@@ -902,7 +909,7 @@ virNetworkLoadState(virNetworkObjListPtr nets,
 
     /* parse the definition first */
     ctxt->node = node;
-    if (!(def = virNetworkDefParseXML(ctxt)))
+    if (!(def = virNetworkDefParseXML(ctxt, xmlopt)))
         goto error;
 
     if (STRNEQ(name, def->name)) {
@@ -1000,7 +1007,8 @@ static virNetworkObjPtr
 virNetworkLoadConfig(virNetworkObjListPtr nets,
                      const char *configDir,
                      const char *autostartDir,
-                     const char *name)
+                     const char *name,
+                     virNetworkXMLOptionPtr xmlopt)
 {
     char *configFile = NULL, *autostartLink = NULL;
     virNetworkDefPtr def = NULL;
@@ -1015,7 +1023,7 @@ virNetworkLoadConfig(virNetworkObjListPtr nets,
     if ((autostart = virFileLinkPointsTo(autostartLink, configFile)) < 0)
         goto error;
 
-    if (!(def = virNetworkDefParseFile(configFile)))
+    if (!(def = virNetworkDefParseFile(configFile, xmlopt)))
         goto error;
 
     if (STRNEQ(name, def->name)) {
@@ -1033,7 +1041,7 @@ virNetworkLoadConfig(virNetworkObjListPtr nets,
     case VIR_NETWORK_FORWARD_OPEN:
         if (!def->mac_specified) {
             virNetworkSetBridgeMacAddr(def);
-            virNetworkSaveConfig(configDir, def);
+            virNetworkSaveConfig(configDir, def, xmlopt);
         }
         break;
 
@@ -1073,7 +1081,8 @@ virNetworkLoadConfig(virNetworkObjListPtr nets,
 
 int
 virNetworkObjLoadAllState(virNetworkObjListPtr nets,
-                          const char *stateDir)
+                          const char *stateDir,
+                          virNetworkXMLOptionPtr xmlopt)
 {
     DIR *dir;
     struct dirent *entry;
@@ -1089,7 +1098,7 @@ virNetworkObjLoadAllState(virNetworkObjListPtr nets,
         if (!virStringStripSuffix(entry->d_name, ".xml"))
             continue;
 
-        obj = virNetworkLoadState(nets, stateDir, entry->d_name);
+        obj = virNetworkLoadState(nets, stateDir, entry->d_name, xmlopt);
 
         if (obj &&
             virNetworkObjLoadAllPorts(obj, stateDir) < 0) {
@@ -1108,7 +1117,8 @@ virNetworkObjLoadAllState(virNetworkObjListPtr nets,
 int
 virNetworkObjLoadAllConfigs(virNetworkObjListPtr nets,
                             const char *configDir,
-                            const char *autostartDir)
+                            const char *autostartDir,
+                            virNetworkXMLOptionPtr xmlopt)
 {
     DIR *dir;
     struct dirent *entry;
@@ -1129,7 +1139,8 @@ virNetworkObjLoadAllConfigs(virNetworkObjListPtr nets,
         obj = virNetworkLoadConfig(nets,
                                    configDir,
                                    autostartDir,
-                                   entry->d_name);
+                                   entry->d_name,
+                                   xmlopt);
         virNetworkObjEndAPI(&obj);
     }
 
@@ -1239,20 +1250,21 @@ virNetworkObjUpdate(virNetworkObjPtr obj,
                     unsigned int section, /* virNetworkUpdateSection */
                     int parentIndex,
                     const char *xml,
+                    virNetworkXMLOptionPtr xmlopt,
                     unsigned int flags)  /* virNetworkUpdateFlags */
 {
     int ret = -1;
     virNetworkDefPtr livedef = NULL, configdef = NULL;
 
     /* normalize config data, and check for common invalid requests. */
-    if (virNetworkObjConfigChangeSetup(obj, flags) < 0)
+    if (virNetworkObjConfigChangeSetup(obj, xmlopt, flags) < 0)
        goto cleanup;
 
     if (flags & VIR_NETWORK_UPDATE_AFFECT_LIVE) {
         virNetworkDefPtr checkdef;
 
         /* work on a copy of the def */
-        if (!(livedef = virNetworkDefCopy(obj->def, 0)))
+        if (!(livedef = virNetworkDefCopy(obj->def, xmlopt, 0)))
             goto cleanup;
         if (virNetworkDefUpdateSection(livedef, command, section,
                                        parentIndex, xml, flags) < 0) {
@@ -1261,7 +1273,7 @@ virNetworkObjUpdate(virNetworkObjPtr obj,
         /* run a final format/parse cycle to make sure we didn't
          * add anything illegal to the def
          */
-        if (!(checkdef = virNetworkDefCopy(livedef, 0)))
+        if (!(checkdef = virNetworkDefCopy(livedef, xmlopt, 0)))
             goto cleanup;
         virNetworkDefFree(checkdef);
     }
@@ -1271,6 +1283,7 @@ virNetworkObjUpdate(virNetworkObjPtr obj,
 
         /* work on a copy of the def */
         if (!(configdef = virNetworkDefCopy(virNetworkObjGetPersistentDef(obj),
+                                            xmlopt,
                                             VIR_NETWORK_XML_INACTIVE))) {
             goto cleanup;
         }
@@ -1279,6 +1292,7 @@ virNetworkObjUpdate(virNetworkObjPtr obj,
             goto cleanup;
         }
         if (!(checkdef = virNetworkDefCopy(configdef,
+                                           xmlopt,
                                            VIR_NETWORK_XML_INACTIVE))) {
             goto cleanup;
         }
diff --git a/src/conf/virnetworkobj.h b/src/conf/virnetworkobj.h
index e649b6b350..1c28f0888c 100644
--- a/src/conf/virnetworkobj.h
+++ b/src/conf/virnetworkobj.h
@@ -140,7 +140,8 @@ virNetworkObjUpdateAssignDef(virNetworkObjPtr network,
 
 int
 virNetworkObjSetDefTransient(virNetworkObjPtr network,
-                             bool live);
+                             bool live,
+                             virNetworkXMLOptionPtr xmlopt);
 
 void
 virNetworkObjUnsetDefTransient(virNetworkObjPtr network);
@@ -191,16 +192,19 @@ virNetworkObjPortListExport(virNetworkPtr net,
 
 int
 virNetworkObjSaveStatus(const char *statusDir,
-                        virNetworkObjPtr net) ATTRIBUTE_RETURN_CHECK;
+                        virNetworkObjPtr net,
+                        virNetworkXMLOptionPtr xmlopt) ATTRIBUTE_RETURN_CHECK;
 
 int
 virNetworkObjLoadAllConfigs(virNetworkObjListPtr nets,
                             const char *configDir,
-                            const char *autostartDir);
+                            const char *autostartDir,
+                            virNetworkXMLOptionPtr xmlopt);
 
 int
 virNetworkObjLoadAllState(virNetworkObjListPtr nets,
-                          const char *stateDir);
+                          const char *stateDir,
+                          virNetworkXMLOptionPtr xmlopt);
 
 int
 virNetworkObjDeleteConfig(const char *configDir,
@@ -218,6 +222,7 @@ virNetworkObjUpdate(virNetworkObjPtr obj,
                     unsigned int section, /* virNetworkUpdateSection */
                     int parentIndex,
                     const char *xml,
+                    virNetworkXMLOptionPtr xmlopt,
                     unsigned int flags);  /* virNetworkUpdateFlags */
 
 int
diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c
index 31bceb7bff..40bd5c2168 100644
--- a/src/esx/esx_network_driver.c
+++ b/src/esx/esx_network_driver.c
@@ -298,7 +298,7 @@ esxNetworkDefineXML(virConnectPtr conn, const char *xml)
         return NULL;
 
     /* Parse network XML */
-    def = virNetworkDefParseString(xml);
+    def = virNetworkDefParseString(xml, NULL);
 
     if (!def)
         return NULL;
@@ -806,7 +806,7 @@ esxNetworkGetXMLDesc(virNetworkPtr network_, unsigned int flags)
         }
     }
 
-    xml = virNetworkDefFormat(def, flags);
+    xml = virNetworkDefFormat(def, NULL, flags);
 
  cleanup:
     esxVI_HostVirtualSwitch_Free(&hostVirtualSwitch);
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 5be6f1ba45..3353754eb5 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -231,7 +231,7 @@ networkRunHook(virNetworkObjPtr obj,
 
         virBufferAddLit(&buf, "<hookData>\n");
         virBufferAdjustIndent(&buf, 2);
-        if (virNetworkDefFormatBuf(&buf, def, 0) < 0)
+        if (virNetworkDefFormatBuf(&buf, def, network_driver->xmlopt, 0) < 0)
             goto cleanup;
         if (port && virNetworkPortDefFormatBuf(&buf, port) < 0)
             goto cleanup;
@@ -673,12 +673,14 @@ networkStateInitialize(bool privileged,
         goto error;
 
     if (virNetworkObjLoadAllState(network_driver->networks,
-                                  network_driver->stateDir) < 0)
+                                  network_driver->stateDir,
+                                  network_driver->xmlopt) < 0)
         goto error;
 
     if (virNetworkObjLoadAllConfigs(network_driver->networks,
                                     network_driver->networkConfigDir,
-                                    network_driver->networkAutostartDir) < 0)
+                                    network_driver->networkAutostartDir,
+                                    network_driver->xmlopt) < 0)
         goto error;
 
     /* Update the internal status of all allegedly active
@@ -750,10 +752,12 @@ networkStateReload(void)
         return 0;
 
     virNetworkObjLoadAllState(network_driver->networks,
-                              network_driver->stateDir);
+                              network_driver->stateDir,
+                              network_driver->xmlopt);
     virNetworkObjLoadAllConfigs(network_driver->networks,
                                 network_driver->networkConfigDir,
-                                network_driver->networkAutostartDir);
+                                network_driver->networkAutostartDir,
+                                network_driver->xmlopt);
     networkReloadFirewallRules(network_driver, false);
     networkRefreshDaemons(network_driver);
     virNetworkObjListForEach(network_driver->networks,
@@ -2789,7 +2793,7 @@ networkStartNetwork(virNetworkDriverStatePtr driver,
     virNetworkObjDeleteAllPorts(obj, driver->stateDir);
 
     VIR_DEBUG("Setting current network def as transient");
-    if (virNetworkObjSetDefTransient(obj, true) < 0)
+    if (virNetworkObjSetDefTransient(obj, true, network_driver->xmlopt) < 0)
         goto cleanup;
 
     /* Run an early hook to set-up missing devices.
@@ -2847,7 +2851,8 @@ networkStartNetwork(virNetworkDriverStatePtr driver,
      * is setup.
      */
     VIR_DEBUG("Writing network status to disk");
-    if (virNetworkObjSaveStatus(driver->stateDir, obj) < 0)
+    if (virNetworkObjSaveStatus(driver->stateDir,
+                                obj, network_driver->xmlopt) < 0)
         goto cleanup;
 
     virNetworkObjSetActive(obj, true);
@@ -3563,7 +3568,7 @@ networkCreateXML(virConnectPtr conn,
     virNetworkPtr net = NULL;
     virObjectEventPtr event = NULL;
 
-    if (!(newDef = virNetworkDefParseString(xml)))
+    if (!(newDef = virNetworkDefParseString(xml, network_driver->xmlopt)))
         goto cleanup;
 
     if (virNetworkCreateXMLEnsureACL(conn, newDef) < 0)
@@ -3615,7 +3620,7 @@ networkDefineXML(virConnectPtr conn,
     virNetworkPtr net = NULL;
     virObjectEventPtr event = NULL;
 
-    if (!(def = virNetworkDefParseString(xml)))
+    if (!(def = virNetworkDefParseString(xml, network_driver->xmlopt)))
         goto cleanup;
 
     if (virNetworkDefineXMLEnsureACL(conn, def) < 0)
@@ -3630,7 +3635,8 @@ networkDefineXML(virConnectPtr conn,
     /* def was assigned to network object */
     freeDef = false;
 
-    if (virNetworkSaveConfig(driver->networkConfigDir, def) < 0) {
+    if (virNetworkSaveConfig(driver->networkConfigDir,
+                             def, network_driver->xmlopt) < 0) {
         if (!virNetworkObjIsActive(obj)) {
             virNetworkObjRemoveInactive(driver->networks, obj);
             goto cleanup;
@@ -3811,7 +3817,9 @@ networkUpdate(virNetworkPtr net,
     }
 
     /* update the network config in memory/on disk */
-    if (virNetworkObjUpdate(obj, command, section, parentIndex, xml, flags) < 0) {
+    if (virNetworkObjUpdate(obj, command, section,
+                            parentIndex, xml,
+                            network_driver->xmlopt, flags) < 0) {
         if (needFirewallRefresh)
             ignore_value(networkAddFirewallRules(def));
         goto cleanup;
@@ -3826,7 +3834,8 @@ networkUpdate(virNetworkPtr net,
     if (flags & VIR_NETWORK_UPDATE_AFFECT_CONFIG) {
         /* save updated persistent config to disk */
         if (virNetworkSaveConfig(driver->networkConfigDir,
-                                 virNetworkObjGetPersistentDef(obj)) < 0) {
+                                 virNetworkObjGetPersistentDef(obj),
+                                 network_driver->xmlopt) < 0) {
             goto cleanup;
         }
     }
@@ -3893,7 +3902,8 @@ networkUpdate(virNetworkPtr net,
         }
 
         /* save current network state to disk */
-        if ((ret = virNetworkObjSaveStatus(driver->stateDir, obj)) < 0)
+        if ((ret = virNetworkObjSaveStatus(driver->stateDir,
+                                           obj, network_driver->xmlopt)) < 0)
             goto cleanup;
     }
 
@@ -4014,7 +4024,7 @@ networkGetXMLDesc(virNetworkPtr net,
     else
         curDef = def;
 
-    ret = virNetworkDefFormat(curDef, flags);
+    ret = virNetworkDefFormat(curDef, network_driver->xmlopt, flags);
 
  cleanup:
     virNetworkObjEndAPI(&obj);
@@ -5153,7 +5163,7 @@ networkPlugBandwidthImpl(virNetworkObjPtr obj,
     tmp_floor_sum += ifaceBand->in->floor;
     virNetworkObjSetFloorSum(obj, tmp_floor_sum);
     /* update status file */
-    if (virNetworkObjSaveStatus(driver->stateDir, obj) < 0) {
+    if (virNetworkObjSaveStatus(driver->stateDir, obj, network_driver->xmlopt) < 0) {
         ignore_value(virBitmapClearBit(classIdMap, next_id));
         tmp_floor_sum -= ifaceBand->in->floor;
         virNetworkObjSetFloorSum(obj, tmp_floor_sum);
@@ -5243,7 +5253,8 @@ networkUnplugBandwidth(virNetworkObjPtr obj,
         /* return class ID */
         ignore_value(virBitmapClearBit(classIdMap, *class_id));
         /* update status file */
-        if (virNetworkObjSaveStatus(driver->stateDir, obj) < 0) {
+        if (virNetworkObjSaveStatus(driver->stateDir,
+                                    obj, network_driver->xmlopt) < 0) {
             tmp_floor_sum += ifaceBand->in->floor;
             virNetworkObjSetFloorSum(obj, tmp_floor_sum);
             ignore_value(virBitmapSetBit(classIdMap, *class_id));
@@ -5337,7 +5348,8 @@ networkUpdatePortBandwidth(virNetworkObjPtr obj,
 
         if (virNetDevBandwidthUpdateRate(def->bridge, 2,
                                          def->bandwidth, new_rate) < 0 ||
-            virNetworkObjSaveStatus(driver->stateDir, obj) < 0) {
+            virNetworkObjSaveStatus(driver->stateDir,
+                                    obj, network_driver->xmlopt) < 0) {
             /* Ouch, rollback */
             tmp_floor_sum -= newBandwidth->in->floor;
             tmp_floor_sum += oldBandwidth->in->floor;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index aa09ef175a..746d701640 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4713,7 +4713,7 @@ qemuProcessGetNetworkAddress(const char *netname,
     if (!xml)
         goto cleanup;
 
-    netdef = virNetworkDefParseString(xml);
+    netdef = virNetworkDefParseString(xml, NULL);
     if (!netdef)
         goto cleanup;
 
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index c10344f6cd..dff384392e 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -971,7 +971,7 @@ testParseNetworks(testDriverPtr privconn,
         if (!node)
             return -1;
 
-        def = virNetworkDefParseNode(ctxt->doc, node);
+        def = virNetworkDefParseNode(ctxt->doc, node, NULL);
         if (!def)
             return -1;
 
@@ -4148,7 +4148,7 @@ testNetworkCreateXML(virConnectPtr conn, const char *xml)
     virNetworkPtr net = NULL;
     virObjectEventPtr event = NULL;
 
-    if ((newDef = virNetworkDefParseString(xml)) == NULL)
+    if ((newDef = virNetworkDefParseString(xml, NULL)) == NULL)
         goto cleanup;
 
     if (!(obj = virNetworkObjAssignDef(privconn->networks, newDef,
@@ -4184,7 +4184,7 @@ testNetworkDefineXML(virConnectPtr conn,
     virNetworkPtr net = NULL;
     virObjectEventPtr event = NULL;
 
-    if ((newDef = virNetworkDefParseString(xml)) == NULL)
+    if ((newDef = virNetworkDefParseString(xml, NULL)) == NULL)
         goto cleanup;
 
     if (!(obj = virNetworkObjAssignDef(privconn->networks, newDef, 0)))
@@ -4270,7 +4270,8 @@ testNetworkUpdate(virNetworkPtr net,
     }
 
     /* update the network config in memory/on disk */
-    if (virNetworkObjUpdate(obj, command, section, parentIndex, xml, flags) < 0)
+    if (virNetworkObjUpdate(obj, command, section,
+                            parentIndex, xml, NULL, flags) < 0)
        goto cleanup;
 
     ret = 0;
@@ -4354,7 +4355,7 @@ testNetworkGetXMLDesc(virNetworkPtr net,
     if (!(obj = testNetworkObjFindByName(privconn, net->name)))
         goto cleanup;
 
-    ret = virNetworkDefFormat(virNetworkObjGetDef(obj), flags);
+    ret = virNetworkDefFormat(virNetworkObjGetDef(obj), NULL, flags);
 
  cleanup:
     virNetworkObjEndAPI(&obj);
diff --git a/src/vbox/vbox_network.c b/src/vbox/vbox_network.c
index 7326ae7d07..814f27155f 100644
--- a/src/vbox/vbox_network.c
+++ b/src/vbox/vbox_network.c
@@ -375,7 +375,7 @@ vboxNetworkDefineCreateXML(virConnectPtr conn, const char *xml, bool start)
     PRUnichar *networkNameUtf16 = NULL;
     char *networkNameUtf8 = NULL;
     IHostNetworkInterface *networkInterface = NULL;
-    virNetworkDefPtr def = virNetworkDefParseString(xml);
+    virNetworkDefPtr def = virNetworkDefParseString(xml, NULL);
     virNetworkIPDefPtr ipdef = NULL;
     unsigned char uuid[VIR_UUID_BUFLEN];
     vboxIID vboxnetiid;
@@ -911,7 +911,7 @@ static char *vboxNetworkGetXMLDesc(virNetworkPtr network, unsigned int flags)
     }
 
     DEBUGIID("Network UUID", &vboxnet0IID);
-    ret = virNetworkDefFormat(def, 0);
+    ret = virNetworkDefFormat(def, NULL, 0);
 
  cleanup:
     vboxIIDUnalloc(&vboxnet0IID);
diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index bf9675838d..c445551099 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -26,7 +26,7 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf, dnsmasqCapsPtr
     char *pidfile = NULL;
     dnsmasqContext *dctx = NULL;
 
-    if (!(def = virNetworkDefParseFile(inxml)))
+    if (!(def = virNetworkDefParseFile(inxml, NULL)))
         goto fail;
 
     if (!(obj = virNetworkObjNew()))
diff --git a/tests/networkxml2firewalltest.c b/tests/networkxml2firewalltest.c
index c25282ebb1..78844085a0 100644
--- a/tests/networkxml2firewalltest.c
+++ b/tests/networkxml2firewalltest.c
@@ -70,7 +70,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
 
     virCommandSetDryRun(&buf, testCommandDryRun, NULL);
 
-    if (!(def = virNetworkDefParseFile(xml)))
+    if (!(def = virNetworkDefParseFile(xml, NULL)))
         goto cleanup;
 
     if (networkAddFirewallRules(def) < 0)
diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c
index b19a365ff4..cd76ce5375 100644
--- a/tests/networkxml2xmltest.c
+++ b/tests/networkxml2xmltest.c
@@ -30,14 +30,14 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
     testCompareNetXML2XMLResult result = TEST_COMPARE_NET_XML2XML_RESULT_SUCCESS;
     virNetworkDefPtr dev = NULL;
 
-    if (!(dev = virNetworkDefParseFile(inxml))) {
+    if (!(dev = virNetworkDefParseFile(inxml, NULL))) {
         result = TEST_COMPARE_NET_XML2XML_RESULT_FAIL_PARSE;
         goto cleanup;
     }
     if (expectResult == TEST_COMPARE_NET_XML2XML_RESULT_FAIL_PARSE)
         goto cleanup;
 
-    if (!(actual = virNetworkDefFormat(dev, flags))) {
+    if (!(actual = virNetworkDefFormat(dev, NULL, flags))) {
         result = TEST_COMPARE_NET_XML2XML_RESULT_FAIL_FORMAT;
         goto cleanup;
     }
diff --git a/tests/networkxml2xmlupdatetest.c b/tests/networkxml2xmlupdatetest.c
index 46cb4c2f0b..69c19e800d 100644
--- a/tests/networkxml2xmlupdatetest.c
+++ b/tests/networkxml2xmlupdatetest.c
@@ -27,14 +27,14 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
     if (virTestLoadFile(updatexml, &updateXmlData) < 0)
         goto error;
 
-    if (!(def = virNetworkDefParseFile(netxml)))
+    if (!(def = virNetworkDefParseFile(netxml, NULL)))
         goto fail;
 
     if (virNetworkDefUpdateSection(def, command, section, parentIndex,
                                    updateXmlData, 0) < 0)
         goto fail;
 
-    if (!(actual = virNetworkDefFormat(def, flags)))
+    if (!(actual = virNetworkDefFormat(def, NULL, flags)))
         goto fail;
 
     if (!expectFailure) {
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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