[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: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v3] hmp, qmp: introduce "info memory" and "query-memory" commands |
Date: |
Tue, 27 Jun 2017 09:14:44 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 |
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
signature.asc
Description: OpenPGP digital signature