Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.Domain.xml | 7 +++++++ src/domain.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 1324db8..84ef3bf 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -215,6 +215,13 @@ <arg name="flags" type="u" direction="in"/> <arg name="hostname" type="s" direction="out"/> </method> + <method name="GetInterfaceParameters"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetInterfaceParameters"/> + <arg name="device" type="s" direction="in"/> + <arg name="flags" type="u" direction="in"/> + <arg name="interfaceParameters" type="a{sv}" direction="out"/> + </method> <method name="GetJobInfo"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetJobInfo"/> diff --git a/src/domain.c b/src/domain.c index 18ca7aa..3c1fec7 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1179,6 +1179,46 @@ virtDBusDomainGetHostname(GVariant *inArgs, *outArgs = g_variant_new("(s)", hostname); } +static void +virtDBusDomainGetInterfaceParameters(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect = userData; + g_autoptr(virDomain) domain = NULL; + g_auto(virtDBusUtilTypedParams) params = { 0 }; + const gchar *device; + guint flags; + gint ret; + GVariant *grecords; + + g_variant_get(inArgs, "(&su)", &device, &flags); + + domain = virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + ret = virDomainGetInterfaceParameters(domain, device, NULL, + ¶ms.nparams, flags); + if (ret < 0) + return virtDBusUtilSetLastVirtError(error); + if (ret == 0 && params.nparams != 0) { + params.params = g_new0(virTypedParameter, params.nparams); + if (virDomainGetInterfaceParameters(domain, device, params.params, + ¶ms.nparams, flags) < 0) { + return virtDBusUtilSetLastVirtError(error); + } + } + + grecords = virtDBusUtilTypedParamsToGVariant(params.params, params.nparams); + + *outArgs = g_variant_new_tuple(&grecords, 1); +} + static void virtDBusDomainGetJobInfo(GVariant *inArgs G_GNUC_UNUSED, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2261,6 +2301,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { { "GetFSInfo", virtDBusDomainGetFSInfo }, { "GetGuestVcpus", virtDBusDomainGetGuestVcpus }, { "GetHostname", virtDBusDomainGetHostname }, + { "GetInterfaceParameters", virtDBusDomainGetInterfaceParameters }, { "GetJobInfo", virtDBusDomainGetJobInfo }, { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters }, -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list