On 06/27/2017 09:05 AM, Igor Mammedov wrote: > On Wed, 14 Jun 2017 17:21:06 +0200 > Vadim Galitsyn <vadim.galit...@profitbricks.com> 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