[PATCH v2 2/5] src: add driver support for networkCreateXMLFlags()

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

 



I added new driver functions to handle creating network with
given flags. I also replaced definitions of the functions without
flags with function calls to the new ones.

Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx>
---
 src/network/bridge_driver.c | 18 +++++++++++++++---
 src/test/test_driver.c      | 13 ++++++++++++-
 src/vbox/vbox_network.c     |  7 +++++++
 3 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 86cefbd82b..dbb8846e05 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3464,8 +3464,9 @@ networkValidate(virNetworkDriverState *driver,
 
 
 static virNetworkPtr
-networkCreateXML(virConnectPtr conn,
-                 const char *xml)
+networkCreateXMLFlags(virConnectPtr conn,
+                      const char *xml,
+                      unsigned int flags)
 {
     virNetworkDriverState *driver = networkGetDriver();
     virNetworkDef *newDef;
@@ -3474,10 +3475,12 @@ networkCreateXML(virConnectPtr conn,
     virNetworkPtr net = NULL;
     virObjectEvent *event = NULL;
 
+    virCheckFlags(0, NULL);
+
     if (!(newDef = virNetworkDefParseString(xml, network_driver->xmlopt, false)))
         goto cleanup;
 
-    if (virNetworkCreateXMLEnsureACL(conn, newDef) < 0)
+    if (virNetworkCreateXMLFlagsEnsureACL(conn, newDef) < 0)
         goto cleanup;
 
     if (networkValidate(driver, newDef) < 0)
@@ -3515,6 +3518,14 @@ networkCreateXML(virConnectPtr conn,
 }
 
 
+static virNetworkPtr
+networkCreateXML(virConnectPtr conn,
+                 const char *xml)
+{
+    return networkCreateXMLFlags(conn, xml, 0);
+}
+
+
 static virNetworkPtr
 networkDefineXMLFlags(virConnectPtr conn,
                       const char *xml,
@@ -5630,6 +5641,7 @@ static virNetworkDriver networkDriver = {
     .networkLookupByUUID = networkLookupByUUID, /* 0.2.0 */
     .networkLookupByName = networkLookupByName, /* 0.2.0 */
     .networkCreateXML = networkCreateXML, /* 0.2.0 */
+    .networkCreateXMLFlags = networkCreateXMLFlags, /* 7.8.0 */
     .networkDefineXML = networkDefineXML, /* 0.2.0 */
     .networkDefineXMLFlags = networkDefineXMLFlags, /* 7.7.0 */
     .networkUndefine = networkUndefine, /* 0.2.0 */
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 2c2c6f52d1..26ff2cc759 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -5572,7 +5572,8 @@ testNetworkIsPersistent(virNetworkPtr net)
 
 
 static virNetworkPtr
-testNetworkCreateXML(virConnectPtr conn, const char *xml)
+testNetworkCreateXMLFlags(virConnectPtr conn, const char *xml,
+                          unsigned int flags)
 {
     testDriver *privconn = conn->privateData;
     virNetworkDef *newDef;
@@ -5581,6 +5582,8 @@ testNetworkCreateXML(virConnectPtr conn, const char *xml)
     virNetworkPtr net = NULL;
     virObjectEvent *event = NULL;
 
+    virCheckFlags(0, NULL);
+
     if ((newDef = virNetworkDefParseString(xml, NULL, false)) == NULL)
         goto cleanup;
 
@@ -5606,6 +5609,13 @@ testNetworkCreateXML(virConnectPtr conn, const char *xml)
 }
 
 
+static virNetworkPtr
+testNetworkCreateXML(virConnectPtr conn, const char *xml)
+{
+    return testNetworkCreateXMLFlags(conn, xml, 0);
+}
+
+
 static virNetworkPtr
 testNetworkDefineXMLFlags(virConnectPtr conn,
                           const char *xml,
@@ -9723,6 +9733,7 @@ static virNetworkDriver testNetworkDriver = {
     .networkLookupByUUID = testNetworkLookupByUUID, /* 0.3.2 */
     .networkLookupByName = testNetworkLookupByName, /* 0.3.2 */
     .networkCreateXML = testNetworkCreateXML, /* 0.3.2 */
+    .networkCreateXMLFlags = testNetworkCreateXMLFlags, /* 7.8.0 */
     .networkDefineXML = testNetworkDefineXML, /* 0.3.2 */
     .networkDefineXMLFlags = testNetworkDefineXMLFlags, /* 7.7.0 */
     .networkUndefine = testNetworkUndefine, /* 0.3.2 */
diff --git a/src/vbox/vbox_network.c b/src/vbox/vbox_network.c
index e772e580ad..1c23b880e8 100644
--- a/src/vbox/vbox_network.c
+++ b/src/vbox/vbox_network.c
@@ -561,6 +561,12 @@ static virNetworkPtr vboxNetworkCreateXML(virConnectPtr conn, const char *xml)
     return vboxNetworkDefineCreateXML(conn, xml, true, 0);
 }
 
+static virNetworkPtr vboxNetworkCreateXMLFlags(virConnectPtr conn, const char *xml,
+                                               unsigned int flags)
+{
+    return vboxNetworkDefineCreateXML(conn, xml, true, flags);
+}
+
 static virNetworkPtr vboxNetworkDefineXML(virConnectPtr conn, const char *xml)
 {
     return vboxNetworkDefineCreateXML(conn, xml, false, 0);
@@ -930,6 +936,7 @@ virNetworkDriver vboxNetworkDriver = {
     .networkLookupByUUID = vboxNetworkLookupByUUID, /* 0.6.4 */
     .networkLookupByName = vboxNetworkLookupByName, /* 0.6.4 */
     .networkCreateXML = vboxNetworkCreateXML, /* 0.6.4 */
+    .networkCreateXMLFlags = vboxNetworkCreateXMLFlags, /* 7.8.0 */
     .networkDefineXML = vboxNetworkDefineXML, /* 0.6.4 */
     .networkDefineXMLFlags = vboxNetworkDefineXMLFlags, /* 7.7.0 */
     .networkUndefine = vboxNetworkUndefine, /* 0.6.4 */
-- 
2.31.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