Commit 76f16c85 authored by Katerina Koukiou's avatar Katerina Koukiou

Implement NWFilterLookupByName method for Connect Interface

Signed-off-by: default avatarKaterina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Jano Tomko's avatarJán Tomko <jtomko@redhat.com>
parent 0dc348de
......@@ -208,6 +208,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#virNWFilterLookupByName"/>
<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"/>
......
......@@ -1048,6 +1048,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,
......@@ -1524,6 +1552,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = {
{ "NetworkLookupByName", virtDBusConnectNetworkLookupByName },
{ "NetworkLookupByUUID", virtDBusConnectNetworkLookupByUUID },
{ "NWFilterDefineXML", virtDBusConnectNWFilterDefineXML },
{ "NWFilterLookupByName", virtDBusConnectNWFilterLookupByName },
{ "NodeGetCPUMap", virtDBusConnectNodeGetCPUMap },
{ "NodeGetCPUStats", virtDBusConnectNodeGetCPUStats },
{ "NodeGetFreeMemory", virtDBusConnectNodeGetFreeMemory },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment