On Thu, Apr 26, 2018 at 04:54:12PM +0200, Katerina Koukiou wrote: > Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> > --- > data/org.libvirt.Connect.xml | 6 ++++++ > src/connect.c | 36 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 42 insertions(+) > > diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml > index 2e65f8b..62a65ae 100644 > --- a/data/org.libvirt.Connect.xml > +++ b/data/org.libvirt.Connect.xml > @@ -190,6 +190,12 @@ > value="See https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetInfo"/> > <arg name="info" type="(stuuuuuu)" direction="out"/> > </method> > + <method name="NodeGetMemoryParameters"> > + <annotation name="org.gtk.GDBus.DocString" > + value="See https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetMemoryParameters"/> > + <arg name="flags" type="u" direction="in"/> > + <arg name="memoryParameters" type="a{sv}" direction="out"/> > + </method> > <signal name="DomainEvent"> > <annotation name="org.gtk.GDBus.DocString" > value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEventCallback"/> > diff --git a/src/connect.c b/src/connect.c > index bb9bd46..8a168f4 100644 > --- a/src/connect.c > +++ b/src/connect.c > @@ -968,6 +968,41 @@ virtDBusConnectNodeGetInfo(GVariant *inArgs G_GNUC_UNUSED, > info.cores, info.threads); > } > > +static void > +virtDBusConnectNodeGetMemoryParameters(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_auto(virtDBusUtilTypedParams) params = { 0 }; > + guint flags; > + gint ret; > + GVariant *grecords; > + > + g_variant_get(inArgs, "(u)", &flags); > + > + if (!virtDBusConnectOpen(connect, error)) > + return; > + > + ret = virNodeGetMemoryParameters(connect->connection, NULL, > + ¶ms.nparams, flags); This can fail so we should check for 'ret < 0' and set an error. > + if (ret == 0 && params.nparams != 0) { and in that case there is no need to check ret here. Pavel
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list