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 c228c6d..6847aaf 100644
--- a/data/org.libvirt.Connect.xml
+++ b/data/org.libvirt.Connect.xml
@@ -201,6 +201,12 @@
<arg name="xml" type="s" direction="in"/>
<arg name="nwfilter" type="o"
direction="out"/>
</method>
+ <method name="NWFilterLookupByName">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterLookupB...
+ <arg name="name" 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 8981f36..d0fb791 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -1022,6 +1022,34 @@ virtDBusConnectNWFilterDefineXML(GVariant *inArgs,
*outArgs = g_variant_new("(o)", path);
}
+static void
+virtDBusConnectNWFilterLookupByName(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 *name;
+
+ g_variant_get(inArgs, "(s)", &name);
+
+ if (!virtDBusConnectOpen(connect, error))
+ return;
+
+ nwfilter = virNWFilterLookupByName(connect->connection, name);
+ 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,
@@ -1437,6 +1465,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = {
{ "NetworkLookupByName", virtDBusConnectNetworkLookupByName },
{ "NetworkLookupByUUID", virtDBusConnectNetworkLookupByUUID },
{ "NWFilterDefineXML", virtDBusConnectNWFilterDefineXML },
+ { "NWFilterLookupByName", virtDBusConnectNWFilterLookupByName },
{ "NodeGetCPUMap", virtDBusConnectNodeGetCPUMap },
{ "NodeGetCPUStats", virtDBusConnectNodeGetCPUStats },
{ "NodeGetFreeMemory", virtDBusConnectNodeGetFreeMemory },
--
2.15.0