[libvirt] [dbus PATCH 09/15] Implement GetInterfaceParameters method for Domain Interface
Pavel Hrdina
phrdina at redhat.com
Wed Apr 25 16:08:19 UTC 2018
On Wed, Apr 25, 2018 at 12:20:24PM +0200, Katerina Koukiou wrote:
> Signed-off-by: Katerina Koukiou <kkoukiou at redhat.com>
> ---
> 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) {
There is no need to check the 'ret' variable here.
Reviewed-by: Pavel Hrdina <phrdina at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180425/2bc60f73/attachment-0001.sig>
More information about the libvir-list
mailing list