On Wed, May 02, 2018 at 12:34:42PM +0200, Katerina Koukiou wrote: > Signed-off-by: Katerina Koukiou <kkouk...@redhat.com> > --- > data/org.libvirt.Connect.xml | 6 ++++++ > src/connect.c | 44 > ++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 50 insertions(+) > > diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml > index c62d107..4a1ee4a 100644 > --- a/data/org.libvirt.Connect.xml > +++ b/data/org.libvirt.Connect.xml > @@ -189,6 +189,12 @@ > <arg name="flags" type="u" direction="in"/> > <arg name="memoryParameters" type="a{sv}" direction="out"/> > </method> > + <method name="NodeGetMemoryStats"> > + <annotation name="org.gtk.GDBus.DocString" > + value="See > https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetMemoryStats"/> > + <arg name="flags" type="u" direction="in"/> > + <arg name="stats" type="a{st}" direction="out"/> > + </method>
In the review of v1 I've stated that we should drop the cellNum argument, that was wrong. I thought that this API will report stats for all numa nodes, but that's not true. This is similar to the NodeGetCPUStats API so it should be same. Sorry about that. > <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 f2c6d45..0ecb333 100644 > --- a/src/connect.c > +++ b/src/connect.c > @@ -966,6 +966,49 @@ virtDBusConnectNodeGetMemoryParameters(GVariant *inArgs, > *outArgs = g_variant_new_tuple(&grecords, 1); > } > > +static void > +virtDBusConnectNodeGetMemoryStats(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_autofree virNodeMemoryStatsPtr params = NULL; > + gint nparams = 0; > + gint cellNum = VIR_NODE_MEMORY_STATS_ALL_CELLS; > + guint flags; > + gint ret; > + GVariantBuilder builder; > + GVariant *res; > + > + g_variant_get(inArgs, "(u)", &flags); > + > + if (!virtDBusConnectOpen(connect, error)) > + return; > + > + ret = virNodeGetMemoryStats(connect->connection, cellNum, NULL, > + &nparams, flags); > + if (ret < 0) > + return virtDBusUtilSetLastVirtError(error); I would put an empty line here. > + if (nparams != 0) { > + params = g_new0(virNodeMemoryStats, nparams); > + if (virNodeGetMemoryStats(connect->connection, cellNum, params, > + &nparams, flags) < 0) { > + return virtDBusUtilSetLastVirtError(error); > + } > + } Reviewed-by: Pavel Hrdina <phrd...@redhat.com> to the v1 patch with the error check fix as it was pointed out for the v1 patch.
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list