[PATCH v2 08/11] nwfilter_driver: Add Driver implementation for metadata

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

 



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

diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 09719edd75..00b2d89eb4 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -812,6 +812,65 @@ nwfilterBindingDelete(virNWFilterBindingPtr binding)
 }
 
 
+static int
+nwfilterSetMetadata(virNWFilterPtr nwfilter,
+                    int type,
+                    const char *metadata,
+                    const char *key,
+                    const char *uri,
+                    unsigned int flags)
+{
+    virNWFilterObj *obj = NULL;
+    virNWFilterDef *def = NULL;
+    int ret = -1;
+
+    virCheckFlags(0, -1);
+
+    if (!(obj = nwfilterObjFromNWFilter(nwfilter->uuid)))
+        return -1;
+
+    def = virNWFilterObjGetDef(obj);
+
+    if (virNWFilterSetMetadataEnsureACL(nwfilter->conn, def) < 0)
+        goto cleanup;
+
+    ret = virNWFilterObjSetMetadata(obj, type, metadata, key, uri,
+                                    driver->configDir);
+
+ cleanup:
+    virNWFilterObjUnlock(obj);
+    return ret;
+}
+
+
+static char *
+nwfilterGetMetadata(virNWFilterPtr nwfilter,
+                   int type,
+                   const char *uri,
+                   unsigned int flags)
+{
+    virNWFilterObj *obj = NULL;
+    virNWFilterDef *def = NULL;
+    char *ret = NULL;
+
+    virCheckFlags(0, NULL);
+
+    if (!(obj = nwfilterObjFromNWFilter(nwfilter->uuid)))
+        return NULL;
+
+    def = virNWFilterObjGetDef(obj);
+
+    if (virNWFilterGetMetadataEnsureACL(nwfilter->conn, def) < 0)
+        goto cleanup;
+
+    ret = virNWFilterObjGetMetadata(obj, type, uri);
+
+ cleanup:
+    virNWFilterObjUnlock(obj);
+    return ret;
+}
+
+
 static virNWFilterDriver nwfilterDriver = {
     .name = "nwfilter",
     .connectNumOfNWFilters = nwfilterConnectNumOfNWFilters, /* 0.8.0 */
@@ -828,6 +887,8 @@ static virNWFilterDriver nwfilterDriver = {
     .nwfilterBindingGetXMLDesc = nwfilterBindingGetXMLDesc, /* 4.5.0 */
     .nwfilterBindingCreateXML = nwfilterBindingCreateXML, /* 4.5.0 */
     .nwfilterBindingDelete = nwfilterBindingDelete, /* 4.5.0 */
+    .nwfilterGetMetadata = nwfilterGetMetadata, /* 9.9.0 */
+    .nwfilterSetMetadata = nwfilterSetMetadata, /* 9.9.0 */
 };
 
 
-- 
2.42.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