[PATCH 3/7] src: add driver support for networkDefineXMLFlags()

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

 



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

Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx>
---
 src/esx/esx_network_driver.c | 14 +++++++++++++-
 src/network/bridge_driver.c  | 18 +++++++++++++++---
 src/test/test_driver.c       | 16 ++++++++++++++--
 src/vbox/vbox_network.c      |  7 +++++++
 4 files changed, 49 insertions(+), 6 deletions(-)

diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c
index a87ec6a377..72b5a4f235 100644
--- a/src/esx/esx_network_driver.c
+++ b/src/esx/esx_network_driver.c
@@ -274,7 +274,8 @@ esxBandwidthToShapingPolicy(virNetDevBandwidth *bandwidth,
 
 
 static virNetworkPtr
-esxNetworkDefineXML(virConnectPtr conn, const char *xml)
+esxNetworkDefineXMLFlags(virConnectPtr conn, const char *xml,
+                         unsigned int flags)
 {
     virNetworkPtr network = NULL;
     esxPrivate *priv = conn->privateData;
@@ -291,6 +292,8 @@ esxNetworkDefineXML(virConnectPtr conn, const char *xml)
 
     unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; /* VIR_CRYPTO_HASH_SIZE_MD5 = VIR_UUID_BUFLEN = 16 */
 
+    virCheckFlags(0, NULL);
+
     if (esxVI_EnsureSession(priv->primary) < 0)
         return NULL;
 
@@ -494,6 +497,14 @@ esxNetworkDefineXML(virConnectPtr conn, const char *xml)
 
 
 
+static virNetworkPtr
+esxNetworkDefineXML(virConnectPtr conn, const char *xml)
+{
+    return esxNetworkDefineXMLFlags(conn, xml, 0);
+}
+
+
+
 static int
 esxNetworkUndefine(virNetworkPtr network)
 {
@@ -933,6 +944,7 @@ virNetworkDriver esxNetworkDriver = {
     .networkLookupByUUID = esxNetworkLookupByUUID, /* 0.10.0 */
     .networkLookupByName = esxNetworkLookupByName, /* 0.10.0 */
     .networkDefineXML = esxNetworkDefineXML, /* 0.10.0 */
+    .networkDefineXMLFlags = esxNetworkDefineXMLFlags, /* 7.7.0 */
     .networkUndefine = esxNetworkUndefine, /* 0.10.0 */
     .networkGetXMLDesc = esxNetworkGetXMLDesc, /* 0.10.0 */
     .networkGetAutostart = esxNetworkGetAutostart, /* 0.10.0 */
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index acbc6be965..0f27b1d180 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3516,8 +3516,9 @@ networkCreateXML(virConnectPtr conn,
 
 
 static virNetworkPtr
-networkDefineXML(virConnectPtr conn,
-                 const char *xml)
+networkDefineXMLFlags(virConnectPtr conn,
+                      const char *xml,
+                      unsigned int flags)
 {
     virNetworkDriverState *driver = networkGetDriver();
     virNetworkDef *def = NULL;
@@ -3526,10 +3527,12 @@ networkDefineXML(virConnectPtr conn,
     virNetworkPtr net = NULL;
     virObjectEvent *event = NULL;
 
+    virCheckFlags(0, NULL);
+
     if (!(def = virNetworkDefParseString(xml, network_driver->xmlopt)))
         goto cleanup;
 
-    if (virNetworkDefineXMLEnsureACL(conn, def) < 0)
+    if (virNetworkDefineXMLFlagsEnsureACL(conn, def) < 0)
         goto cleanup;
 
     if (networkValidate(driver, def) < 0)
@@ -3571,6 +3574,14 @@ networkDefineXML(virConnectPtr conn,
 }
 
 
+static virNetworkPtr
+networkDefineXML(virConnectPtr conn,
+                 const char *xml)
+{
+    return networkDefineXMLFlags(conn, xml, 0);
+}
+
+
 static int
 networkUndefine(virNetworkPtr net)
 {
@@ -5618,6 +5629,7 @@ static virNetworkDriver networkDriver = {
     .networkLookupByName = networkLookupByName, /* 0.2.0 */
     .networkCreateXML = networkCreateXML, /* 0.2.0 */
     .networkDefineXML = networkDefineXML, /* 0.2.0 */
+    .networkDefineXMLFlags = networkDefineXMLFlags, /* 7.7.0 */
     .networkUndefine = networkUndefine, /* 0.2.0 */
     .networkUpdate = networkUpdate, /* 0.10.2 */
     .networkCreate = networkCreate, /* 0.2.0 */
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 67db02b25d..d9203c9568 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -5607,8 +5607,9 @@ testNetworkCreateXML(virConnectPtr conn, const char *xml)
 
 
 static virNetworkPtr
-testNetworkDefineXML(virConnectPtr conn,
-                     const char *xml)
+testNetworkDefineXMLFlags(virConnectPtr conn,
+                          const char *xml,
+                          unsigned int flags)
 {
     testDriver *privconn = conn->privateData;
     virNetworkDef *newDef;
@@ -5617,6 +5618,8 @@ testNetworkDefineXML(virConnectPtr conn,
     virNetworkPtr net = NULL;
     virObjectEvent *event = NULL;
 
+    virCheckFlags(0, NULL);
+
     if ((newDef = virNetworkDefParseString(xml, NULL)) == NULL)
         goto cleanup;
 
@@ -5639,6 +5642,14 @@ testNetworkDefineXML(virConnectPtr conn,
 }
 
 
+static virNetworkPtr
+testNetworkDefineXML(virConnectPtr conn,
+                     const char *xml)
+{
+    return testNetworkDefineXMLFlags(conn, xml, 0);
+}
+
+
 static int
 testNetworkUndefine(virNetworkPtr net)
 {
@@ -9712,6 +9723,7 @@ static virNetworkDriver testNetworkDriver = {
     .networkLookupByName = testNetworkLookupByName, /* 0.3.2 */
     .networkCreateXML = testNetworkCreateXML, /* 0.3.2 */
     .networkDefineXML = testNetworkDefineXML, /* 0.3.2 */
+    .networkDefineXMLFlags = testNetworkDefineXMLFlags, /* 7.7.0 */
     .networkUndefine = testNetworkUndefine, /* 0.3.2 */
     .networkUpdate = testNetworkUpdate, /* 0.10.2 */
     .networkCreate = testNetworkCreate, /* 0.3.2 */
diff --git a/src/vbox/vbox_network.c b/src/vbox/vbox_network.c
index 39da643f14..cce43ee5af 100644
--- a/src/vbox/vbox_network.c
+++ b/src/vbox/vbox_network.c
@@ -565,6 +565,12 @@ static virNetworkPtr vboxNetworkDefineXML(virConnectPtr conn, const char *xml)
     return vboxNetworkDefineCreateXML(conn, xml, false, 0);
 }
 
+static virNetworkPtr vboxNetworkDefineXMLFlags(virConnectPtr conn, const char *xml,
+                                               unsigned int flags)
+{
+    return vboxNetworkDefineCreateXML(conn, xml, false, flags);
+}
+
 static int
 vboxNetworkUndefineDestroy(virNetworkPtr network, bool removeinterface)
 {
@@ -924,6 +930,7 @@ virNetworkDriver vboxNetworkDriver = {
     .networkLookupByName = vboxNetworkLookupByName, /* 0.6.4 */
     .networkCreateXML = vboxNetworkCreateXML, /* 0.6.4 */
     .networkDefineXML = vboxNetworkDefineXML, /* 0.6.4 */
+    .networkDefineXMLFlags = vboxNetworkDefineXMLFlags, /* 7.7.0 */
     .networkUndefine = vboxNetworkUndefine, /* 0.6.4 */
     .networkCreate = vboxNetworkCreate, /* 0.6.4 */
     .networkDestroy = vboxNetworkDestroy, /* 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