[libvirt PATCH v2 7/7] Added bridge driver implementation

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

 



Signed-off-by: K Shiva Kiran <shiva_kr@xxxxxxxxxx>
---
 src/network/bridge_driver.c | 64 +++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index e776d86c73..caad085192 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -5119,6 +5119,68 @@ networkListAllPorts(virNetworkPtr net,
 }
 
 
+static int
+networkSetMetadata(virNetworkPtr net,
+                   int type,
+                   const char *metadata,
+                   const char *key,
+                   const char *uri,
+                   unsigned int flags)
+{
+    virNetworkDriverState *driver = networkGetDriver();
+    virNetworkObj *obj = NULL;
+    virNetworkDef *def = NULL;
+    g_autoptr(virNetworkDriverConfig) cfg = NULL;
+    int ret = -1;
+
+    virCheckFlags(VIR_NETWORK_UPDATE_AFFECT_LIVE |
+                  VIR_NETWORK_UPDATE_AFFECT_CONFIG, -1);
+
+    if (!(obj = networkObjFromNetwork(net)))
+        return -1;
+
+    cfg = virNetworkDriverGetConfig(driver);
+    def = virNetworkObjGetDef(obj);
+
+    if (virNetworkSetMetadataEnsureACL(net->conn, def, flags) < 0)
+        goto cleanup;
+
+    ret = virNetworkObjSetMetadata(obj, type, metadata, key, uri,
+                                   driver->xmlopt, cfg->stateDir,
+                                   cfg->networkConfigDir, flags);
+
+ cleanup:
+    virNetworkObjEndAPI(&obj);
+    return ret;
+}
+
+
+static char *
+networkGetMetadata(virNetworkPtr net,
+                   int type,
+                   const char *uri,
+                   unsigned int flags)
+{
+    virNetworkObj *obj = NULL;
+    virNetworkDef *def = NULL;
+    char *ret = NULL;
+
+    if (!(obj = networkObjFromNetwork(net)))
+        return NULL;
+
+    def = virNetworkObjGetDef(obj);
+
+    if (virNetworkGetMetadataEnsureACL(net->conn, def) < 0)
+        goto cleanup;
+
+    ret = virNetworkObjGetMetadata(obj, type, uri, flags);
+
+ cleanup:
+    virNetworkObjEndAPI(&obj);
+    return ret;
+}
+
+
 static virNetworkDriver networkDriver = {
     .name = "bridge",
     .connectNumOfNetworks = networkConnectNumOfNetworks, /* 0.2.0 */
@@ -5152,6 +5214,8 @@ static virNetworkDriver networkDriver = {
     .networkListAllPorts = networkListAllPorts, /* 5.5.0 */
     .networkPortGetParameters = networkPortGetParameters, /* 5.5.0 */
     .networkPortSetParameters = networkPortSetParameters, /* 5.5.0 */
+    .networkGetMetadata = networkGetMetadata, /* 9.7.0 */
+    .networkSetMetadata = networkSetMetadata, /* 9.7.0 */
 };
 
 
-- 
2.41.0





[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