[PATCH 31/43] conf: network: Provide only virNetworkDefParse

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

 



Replace virNetworkDefParseString/File by direct calls to
virNetworkDefParse.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/domain_conf.c           |  2 +-
 src/conf/network_conf.c          | 21 ++-------------------
 src/conf/network_conf.h          | 11 ++++-------
 src/conf/virnetworkobj.c         |  2 +-
 src/esx/esx_network_driver.c     |  2 +-
 src/libvirt_private.syms         |  3 +--
 src/network/bridge_driver.c      |  8 ++++----
 src/qemu/qemu_process.c          |  2 +-
 src/test/test_driver.c           |  8 ++++----
 src/vbox/vbox_network.c          |  2 +-
 tests/networkxml2conftest.c      |  2 +-
 tests/networkxml2firewalltest.c  |  2 +-
 tests/networkxml2xmltest.c       |  2 +-
 tests/networkxml2xmlupdatetest.c |  2 +-
 14 files changed, 24 insertions(+), 45 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2a3ea9641f..5bb5cfa500 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -29728,7 +29728,7 @@ virDomainNetResolveActualType(virDomainNetDef *iface)
     if (!(xml = virNetworkGetXMLDesc(net, 0)))
         return -1;

-    if (!(def = virNetworkDefParseString(xml, NULL, false)))
+    if (!(def = virNetworkDefParse(xml, NULL, NULL, false)))
         return -1;

     switch ((virNetworkForwardType) def->forward.type) {
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 3574c0214b..be43894050 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -315,7 +315,7 @@ virNetworkDefCopy(virNetworkDef *def,
     if (!(xml = virNetworkDefFormat(def, xmlopt, flags)))
        return NULL;

-    return virNetworkDefParseString(xml, xmlopt, false);
+    return virNetworkDefParse(xml, NULL, xmlopt, false);
 }


@@ -2025,7 +2025,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt,
 }


-static virNetworkDef *
+virNetworkDef *
 virNetworkDefParse(const char *xmlStr,
                    const char *filename,
                    virNetworkXMLOption *xmlopt,
@@ -2046,23 +2046,6 @@ virNetworkDefParse(const char *xmlStr,
 }


-virNetworkDef *
-virNetworkDefParseString(const char *xmlStr,
-                         virNetworkXMLOption *xmlopt,
-                         bool validate)
-{
-    return virNetworkDefParse(xmlStr, NULL, xmlopt, validate);
-}
-
-
-virNetworkDef *
-virNetworkDefParseFile(const char *filename,
-                       virNetworkXMLOption *xmlopt)
-{
-    return virNetworkDefParse(NULL, filename, xmlopt, false);
-}
-
-
 static int
 virNetworkDNSDefFormat(virBuffer *buf,
                        const virNetworkDNSDef *def)
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 49d3ce6b30..2b2e9d15f0 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -325,13 +325,10 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt,
                       virNetworkXMLOption *xmlopt);

 virNetworkDef *
-virNetworkDefParseString(const char *xmlStr,
-                         virNetworkXMLOption *xmlopt,
-                         bool validate);
-
-virNetworkDef *
-virNetworkDefParseFile(const char *filename,
-                       virNetworkXMLOption *xmlopt);
+virNetworkDefParse(const char *xmlStr,
+                   const char *filename,
+                   virNetworkXMLOption *xmlopt,
+                   bool validate);

 char *
 virNetworkDefFormat(const virNetworkDef *def,
diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index 7621fa3380..d23eb2f401 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -967,7 +967,7 @@ virNetworkLoadConfig(virNetworkObjList *nets,
     if ((autostart = virFileLinkPointsTo(autostartLink, configFile)) < 0)
         goto error;

-    if (!(def = virNetworkDefParseFile(configFile, xmlopt)))
+    if (!(def = virNetworkDefParse(NULL, configFile, xmlopt, false)))
         goto error;

     if (STRNEQ(name, def->name)) {
diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c
index bf9630ce9d..1261b3f1fa 100644
--- a/src/esx/esx_network_driver.c
+++ b/src/esx/esx_network_driver.c
@@ -296,7 +296,7 @@ esxNetworkDefineXMLFlags(virConnectPtr conn, const char *xml,
         return NULL;

     /* Parse network XML */
-    def = virNetworkDefParseString(xml, NULL, !!(flags & VIR_NETWORK_DEFINE_VALIDATE));
+    def = virNetworkDefParse(xml, NULL, NULL, !!(flags & VIR_NETWORK_DEFINE_VALIDATE));

     if (!def)
         return NULL;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 3ce2cc1a7e..5714e0c114 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -828,8 +828,7 @@ virNetworkDefForwardIf;
 virNetworkDefFree;
 virNetworkDefGetIPByIndex;
 virNetworkDefGetRouteByIndex;
-virNetworkDefParseFile;
-virNetworkDefParseString;
+virNetworkDefParse;
 virNetworkDefParseXML;
 virNetworkDefUpdateSection;
 virNetworkDHCPLeaseTimeUnitTypeFromString;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index e4f5e93779..a5973e26cd 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3017,8 +3017,8 @@ networkCreateXMLFlags(virConnectPtr conn,

     virCheckFlags(VIR_NETWORK_CREATE_VALIDATE, NULL);

-    if (!(newDef = virNetworkDefParseString(xml, network_driver->xmlopt,
-                                            !!(flags & VIR_NETWORK_CREATE_VALIDATE))))
+    if (!(newDef = virNetworkDefParse(xml, NULL, network_driver->xmlopt,
+                                      !!(flags & VIR_NETWORK_CREATE_VALIDATE))))
         goto cleanup;

     if (virNetworkCreateXMLFlagsEnsureACL(conn, newDef) < 0)
@@ -3082,8 +3082,8 @@ networkDefineXMLFlags(virConnectPtr conn,

     virCheckFlags(VIR_NETWORK_DEFINE_VALIDATE, NULL);

-    if (!(def = virNetworkDefParseString(xml, network_driver->xmlopt,
-                                         !!(flags & VIR_NETWORK_DEFINE_VALIDATE))))
+    if (!(def = virNetworkDefParse(xml, NULL, network_driver->xmlopt,
+                                   !!(flags & VIR_NETWORK_DEFINE_VALIDATE))))
         goto cleanup;

     defAlias = def; /* so we can still ref the object after nullifying def */
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 998f4aa63c..d23857353a 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4852,7 +4852,7 @@ qemuProcessGetNetworkAddress(const char *netname,
     if (!xml)
         return -1;

-    netdef = virNetworkDefParseString(xml, NULL, false);
+    netdef = virNetworkDefParse(xml, NULL, NULL, false);
     if (!netdef)
         return -1;

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 4c4eabc9fc..9f0517e89e 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -5559,8 +5559,8 @@ testNetworkCreateXMLFlags(virConnectPtr conn, const char *xml,

     virCheckFlags(VIR_NETWORK_CREATE_VALIDATE, NULL);

-    if (!(newDef = virNetworkDefParseString(xml, NULL,
-                                            !!(flags & VIR_NETWORK_CREATE_VALIDATE))))
+    if (!(newDef = virNetworkDefParse(xml, NULL, NULL,
+                                      !!(flags & VIR_NETWORK_CREATE_VALIDATE))))
         goto cleanup;

     if (!(obj = virNetworkObjAssignDef(privconn->networks, newDef,
@@ -5605,8 +5605,8 @@ testNetworkDefineXMLFlags(virConnectPtr conn,

     virCheckFlags(VIR_NETWORK_DEFINE_VALIDATE, NULL);

-    if (!(newDef = virNetworkDefParseString(xml, NULL,
-                                            !!(flags & VIR_NETWORK_DEFINE_VALIDATE))))
+    if (!(newDef = virNetworkDefParse(xml, NULL, NULL,
+                                      !!(flags & VIR_NETWORK_DEFINE_VALIDATE))))
         goto cleanup;

     if (!(obj = virNetworkObjAssignDef(privconn->networks, newDef, 0)))
diff --git a/src/vbox/vbox_network.c b/src/vbox/vbox_network.c
index 885fd48321..c3dea66102 100644
--- a/src/vbox/vbox_network.c
+++ b/src/vbox/vbox_network.c
@@ -402,7 +402,7 @@ vboxNetworkDefineCreateXML(virConnectPtr conn, const char *xml, bool start,

     VBOX_IID_INITIALIZE(&vboxnetiid);

-    if (!(def = virNetworkDefParseString(xml, NULL, validate)) ||
+    if (!(def = virNetworkDefParse(xml, NULL, NULL, validate)) ||
         (def->forward.type != VIR_NETWORK_FORWARD_NONE) ||
         (def->nips == 0 || !def->ips))
         goto cleanup;
diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index bbeb849a39..726f073ddc 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -31,7 +31,7 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf,
     if (!(xmlopt = networkDnsmasqCreateXMLConf()))
         goto fail;

-    if (!(def = virNetworkDefParseFile(inxml, xmlopt)))
+    if (!(def = virNetworkDefParse(NULL, inxml, xmlopt, false)))
         goto fail;

     if (!(obj = virNetworkObjNew()))
diff --git a/tests/networkxml2firewalltest.c b/tests/networkxml2firewalltest.c
index ca793fd4ea..cb66a26294 100644
--- a/tests/networkxml2firewalltest.c
+++ b/tests/networkxml2firewalltest.c
@@ -95,7 +95,7 @@ static int testCompareXMLToArgvFiles(const char *xml,

     virCommandSetDryRun(dryRunToken, &buf, true, true, testCommandDryRun, NULL);

-    if (!(def = virNetworkDefParseFile(xml, NULL)))
+    if (!(def = virNetworkDefParse(NULL, xml, NULL, false)))
         return -1;

     if (networkAddFirewallRules(def) < 0)
diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c
index 521f058acc..b0814c7529 100644
--- a/tests/networkxml2xmltest.c
+++ b/tests/networkxml2xmltest.c
@@ -33,7 +33,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
     if (!(xmlopt = networkDnsmasqCreateXMLConf()))
         goto cleanup;

-    if (!(dev = virNetworkDefParseFile(inxml, xmlopt))) {
+    if (!(dev = virNetworkDefParse(NULL, inxml, xmlopt, false))) {
         result = TEST_COMPARE_NET_XML2XML_RESULT_FAIL_PARSE;
         goto cleanup;
     }
diff --git a/tests/networkxml2xmlupdatetest.c b/tests/networkxml2xmlupdatetest.c
index 58b6f70c96..afe2b1f574 100644
--- a/tests/networkxml2xmlupdatetest.c
+++ b/tests/networkxml2xmlupdatetest.c
@@ -25,7 +25,7 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
     if (virTestLoadFile(updatexml, &updateXmlData) < 0)
         return -1;

-    if (!(def = virNetworkDefParseFile(netxml, NULL)))
+    if (!(def = virNetworkDefParse(NULL, netxml, NULL, false)))
         goto fail;

     if (virNetworkDefUpdateSection(def, command, section, parentIndex,
-- 
2.37.3




[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