qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3] hmp, qmp: introduce "info memory" and "query


From: Vadim Galitsyn
Subject: Re: [Qemu-devel] [PATCH v3] hmp, qmp: introduce "info memory" and "query-memory" commands
Date: Fri, 30 Jun 2017 16:00:22 +0200

Hi Guys,

Thank you for the input. Please find updated patch v4 at
http://lists.nongnu.org/archive/html/qemu-devel/2017-06/msg07065.html.

Vadim

On Tue, Jun 27, 2017 at 4:14 PM, Eric Blake <address@hidden> wrote:

> On 06/27/2017 09:05 AM, Igor Mammedov wrote:
> > On Wed, 14 Jun 2017 17:21:06 +0200
> > Vadim Galitsyn <address@hidden> wrote:
> >
>
> >> +void hmp_info_memory(Monitor *mon, const QDict *qdict)
> >> +{
> >> +    Error *err = NULL;
> >> +    MemoryInfo *info = qmp_query_memory(&err);
> >> +    if (info) {
> >> +        monitor_printf(mon, "base-memory: %" PRIu64 "\n",
> >> +                       info->base_memory);
> >> +        monitor_printf(mon, "hot-plug-memory: %" PRIu64 "\n",
> >> +                       info->hot_plug_memory);
> > it shouldn't be printed if hotplug is not enabled
>
> In which case, the QAPI change in the .json file should mark it as
> '*hot-plug-memory', to make it an optional field, and you'll need to
> check/set info->has_hot_plug_memory as appropriate.
>
> >
> >> +        monitor_printf(mon, "ballooned-actual-memory: %" PRIu64 "\n",
> >> +                       info->ballooned_actual_memory);
> >> +        g_free(info);
> >
> > probably there is autogenerated qapi_free_FOO() for MemInfo type
>
> Yes, there is.
>
> > since it's QAPI type, it should be used here instead of g_free() if it
> exists.
>
> Yes, that is correct.
>
>
> >> +#
> >> +# @ballooned-actual-memory: amount of guest memory available after
> ballooning.
> >> +#
> >> +# Since: 2.10.0
> >> +##
> >> +{ 'struct': 'MemoryInfo',
> >> +  'data'  : { 'base-memory': 'int',
> >> 'hot-plug-memory': 'int',
> > should be optional and shown only if hotplug is actually enabled
> >
> >> +              'ballooned-actual-memory': 'int' } }
> > maybe the same for ballooning
>
> Yes, that makes sense to have both of those stats be optional, since
> they are opt-in configurations.
>
> --
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.           +1-919-301-3266
> Virtualization:  qemu.org | libvirt.org
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]