Commit 5ebe0351 authored by Anya Harter's avatar Anya Harter Committed by Katerina Koukiou

Implement Create method for Interface Interface

Signed-off-by: 's avatarAnya Harter <aharter@redhat.com>
Reviewed-by: 's avatarJán Tomko <jtomko@redhat.com>
parent 26d7b995
......@@ -3,5 +3,10 @@
<node name="/org/libvirt/interface">
<interface name="org.libvirt.Interface">
<method name="Create">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceCreate"/>
<arg name="flags" type="u" direction="in"/>
</method>
</interface>
</node>
......@@ -3,11 +3,56 @@
#include <libvirt/libvirt.h>
static virInterfacePtr
virtDBusInterfaceGetVirInterface(virtDBusConnect *connect,
const gchar *objectPath,
GError **error)
{
virInterfacePtr interface;
if (virtDBusConnectOpen(connect, error) < 0)
return NULL;
interface = virtDBusUtilVirInterfaceFromBusPath(connect->connection,
objectPath,
connect->interfacePath);
if (!interface) {
virtDBusUtilSetLastVirtError(error);
return NULL;
}
return interface;
}
static void
virtDBusInterfaceCreate(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,
const gchar *objectPath,
gpointer userData,
GVariant **outArgs G_GNUC_UNUSED,
GUnixFDList **outFDs G_GNUC_UNUSED,
GError **error)
{
virtDBusConnect *connect = userData;
g_autoptr(virInterface) interface = NULL;
guint flags;
g_variant_get(inArgs, "(u)", &flags);
interface = virtDBusInterfaceGetVirInterface(connect, objectPath, error);
if (!interface)
return;
if (virInterfaceCreate(interface, flags) < 0)
virtDBusUtilSetLastVirtError(error);
}
static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] = {
{ 0 }
};
static virtDBusGDBusMethodTable virtDBusInterfaceMethodTable[] = {
{ "Create", virtDBusInterfaceCreate },
{ 0 }
};
......
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