Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- data/org.libvirt.Domain.xml | 6 ++++++ src/domain.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index e97ebe9..9743f25 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -136,6 +136,12 @@ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateWithFlags"/> <arg name="flags" type="u" direction="in"/> </method> + <method name="CreateWithFiles"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateWithFiles"/> + <arg name="files" type="ah" direction="in"/> + <arg name="flags" type="u" direction="in"/> + </method> <method name="DelIOThread"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDelIOThread"/> diff --git a/src/domain.c b/src/domain.c index 3127f6c..3551e31 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1,6 +1,7 @@ #include "domain.h" #include "util.h" +#include <gio/gunixfdlist.h> #include <libvirt/libvirt.h> static gchar * @@ -735,6 +736,37 @@ virtDBusDomainCreate(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } +static void +virtDBusDomainCreateWithFiles(GVariant *inArgs, + GUnixFDList *inFDs, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs G_GNUC_UNUSED, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect = userData; + g_autoptr(virDomain) domain = NULL; + const gint *files = NULL; + guint nfiles = 0; + guint flags; + + g_variant_get(inArgs, "(ahu)", NULL, &flags); + + if (inFDs) { + nfiles = g_unix_fd_list_get_length(inFDs); + if (nfiles > 0) + files = g_unix_fd_list_peek_fds(inFDs, NULL); + } + + domain = virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainCreateWithFiles(domain, nfiles, (gint *)files, flags) < 0) + virtDBusUtilSetLastVirtError(error); +} + static void virtDBusDomainDelIOThread(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2823,6 +2855,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { { "BlockResize", virtDBusDomainBlockResize }, { "CoreDump", virtDBusDomainCoreDumpWithFormat }, { "Create", virtDBusDomainCreate }, + { "CreateWithFiles", virtDBusDomainCreateWithFiles }, { "DelIOThread", virtDBusDomainDelIOThread }, { "Destroy", virtDBusDomainDestroy }, { "DetachDevice", virtDBusDomainDetachDevice }, -- 2.17.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list