Commit 5565b453 authored by Katerina Koukiou's avatar Katerina Koukiou

Implement NWFilterDefineXML 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 eeb5adc4
......@@ -202,6 +202,12 @@
<arg name="uuid" type="s" direction="in"/>
<arg name="network" type="o" direction="out"/>
</method>
<method name="NWFilterDefineXML">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterDefineXML"/>
<arg name="xml" 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"/>
......
......@@ -1020,6 +1020,34 @@ virtDBusConnectNetworkLookupByUUID(GVariant *inArgs,
*outArgs = g_variant_new("(o)", path);
}
static void
virtDBusConnectNWFilterDefineXML(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 *xml;
g_variant_get(inArgs, "(&s)", &xml);
if (!virtDBusConnectOpen(connect, error))
return;
nwfilter = virNWFilterDefineXML(connect->connection, xml);
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,
......@@ -1495,6 +1523,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = {
{ "NetworkDefineXML", virtDBusConnectNetworkDefineXML },
{ "NetworkLookupByName", virtDBusConnectNetworkLookupByName },
{ "NetworkLookupByUUID", virtDBusConnectNetworkLookupByUUID },
{ "NWFilterDefineXML", virtDBusConnectNWFilterDefineXML },
{ "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