[libvirt] [dbus PATCH v2 04/22] Implement MemoryStats for Domain Interface
Pavel Hrdina
phrdina at redhat.com
Fri Apr 13 08:09:19 UTC 2018
On Thu, Apr 12, 2018 at 04:32:43PM +0200, Katerina Koukiou wrote:
> This method is not tested for now since the test driver
> doesn't support this API.
>
> Signed-off-by: Katerina Koukiou <kkoukiou at redhat.com>
> ---
> data/org.libvirt.Domain.xml | 7 ++++++
> src/domain.c | 52 +++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 59 insertions(+)
[...]
> +static void
> +virtDBusDomainMemoryStats(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_autofree virDomainMemoryStatPtr stats = NULL;
> + guint max_stats;
> + gint nr_stats;
> + guint flags;
> + GVariant *gstats;
> +
> + g_variant_get(inArgs, "(uu)", &max_stats, &flags);
> +
> + domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
> + if (!domain)
> + return;
> +
> + stats = g_new0(virDomainMemoryStatStruct, max_stats);
> + nr_stats = virDomainMemoryStats(domain, stats, max_stats, flags);
> + if (nr_stats == -1)
One more thing, 'nr_stats < 0' is preferred form.
Pavel
-------------- 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/20180413/a2dd23e5/attachment-0001.sig>
More information about the libvir-list
mailing list