Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
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#virNWFilterLookupB...
+ <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