[dbus PATCH 8/8] Implement NWFilterLookupByUUID method for Connect Interface

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

 



Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
 data/org.libvirt.Connect.xml |  6 ++++++
 src/connect.c                | 29 +++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml
index 6847aaf..9f42d8c 100644
--- a/data/org.libvirt.Connect.xml
+++ b/data/org.libvirt.Connect.xml
@@ -207,6 +207,12 @@
       <arg name="name" type="s" direction="in"/>
       <arg name="nwfilter" type="o" direction="out"/>
     </method>
+    <method name="NWFilterLookupByUUID">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterLookupByUUIDString"/>
+      <arg name="uuid" type="s" direction="in"/>
+      <arg name="nwfilter" type="o" direction="out"/>
+    </method>
     <method name="NodeGetCPUMap">
       <annotation name="org.gtk.GDBus.DocString"
           value="See https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetCPUMap"/>
diff --git a/src/connect.c b/src/connect.c
index d0fb791..861b0ed 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -1050,6 +1050,34 @@ virtDBusConnectNWFilterLookupByName(GVariant *inArgs,
     *outArgs = g_variant_new("(o)", path);
 }
 
+static void
+virtDBusConnectNWFilterLookupByUUID(GVariant *inArgs,
+                                    GUnixFDList *inFDs G_GNUC_UNUSED,
+                                    const gchar *objectPath G_GNUC_UNUSED,
+                                    gpointer userData,
+                                    GVariant **outArgs,
+                                    GUnixFDList **outFDs G_GNUC_UNUSED,
+                                    GError **error)
+{
+    virtDBusConnect *connect = userData;
+    g_autoptr(virNWFilter) nwfilter = NULL;
+    g_autofree gchar *path = NULL;
+    const gchar *uuidstr;
+
+    g_variant_get(inArgs, "(&s)", &uuidstr);
+
+    if (!virtDBusConnectOpen(connect, error))
+        return;
+
+    nwfilter = virNWFilterLookupByUUIDString(connect->connection, uuidstr);
+    if (!nwfilter)
+        return virtDBusUtilSetLastVirtError(error);
+
+    path = virtDBusUtilBusPathForVirNWFilter(nwfilter, connect->nwfilterPath);
+
+    *outArgs = g_variant_new("(o)", path);
+}
+
 static void
 virtDBusConnectNodeGetCPUMap(GVariant *inArgs,
                              GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -1466,6 +1494,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = {
     { "NetworkLookupByUUID", virtDBusConnectNetworkLookupByUUID },
     { "NWFilterDefineXML", virtDBusConnectNWFilterDefineXML },
     { "NWFilterLookupByName", virtDBusConnectNWFilterLookupByName },
+    { "NWFilterLookupByUUID", virtDBusConnectNWFilterLookupByUUID },
     { "NodeGetCPUMap", virtDBusConnectNodeGetCPUMap },
     { "NodeGetCPUStats", virtDBusConnectNodeGetCPUStats },
     { "NodeGetFreeMemory", virtDBusConnectNodeGetFreeMemory },
-- 
2.15.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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