From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPrGZ-0000OQ-63 for qemu-devel@nongnu.org; Tue, 27 Jun 2017 10:14:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPrGV-0000rB-2n for qemu-devel@nongnu.org; Tue, 27 Jun 2017 10:14:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38088) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dPrGU-0000hx-Pa for qemu-devel@nongnu.org; Tue, 27 Jun 2017 10:14:50 -0400 References: <20170614152106.25533-1-vadim.galitsyn@profitbricks.com> <20170627160512.705f6d8e@nial.brq.redhat.com> From: Eric Blake Message-ID: <4a4aa9ac-39d2-c549-4955-0d18fa30fd14@redhat.com> Date: Tue, 27 Jun 2017 09:14:44 -0500 MIME-Version: 1.0 In-Reply-To: <20170627160512.705f6d8e@nial.brq.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Dd3HHjB1Mp1il9BDMF6VCuJD5MsT15MqG" Subject: Re: [Qemu-devel] [PATCH v3] hmp, qmp: introduce "info memory" and "query-memory" commands List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov , Vadim Galitsyn Cc: Mohammed Gamal , Markus Armbruster , qemu-devel@nongnu.org, "Dr . David Alan Gilbert" , Vasilis Liaskovitis , Eduardo Otubo This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Dd3HHjB1Mp1il9BDMF6VCuJD5MsT15MqG From: Eric Blake To: Igor Mammedov , Vadim Galitsyn Cc: Mohammed Gamal , Markus Armbruster , qemu-devel@nongnu.org, "Dr . David Alan Gilbert" , Vasilis Liaskovitis , Eduardo Otubo Message-ID: <4a4aa9ac-39d2-c549-4955-0d18fa30fd14@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3] hmp, qmp: introduce "info memory" and "query-memory" commands References: <20170614152106.25533-1-vadim.galitsyn@profitbricks.com> <20170627160512.705f6d8e@nial.brq.redhat.com> In-Reply-To: <20170627160512.705f6d8e@nial.brq.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/27/2017 09:05 AM, Igor Mammedov wrote: > On Wed, 14 Jun 2017 17:21:06 +0200 > Vadim Galitsyn wrote: >=20 >> +void hmp_info_memory(Monitor *mon, const QDict *qdict) >> +{ >> + Error *err =3D NULL; >> + MemoryInfo *info =3D 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. >=20 >> + monitor_printf(mon, "ballooned-actual-memory: %" PRIu64 "\n",= >> + info->ballooned_actual_memory); >> + g_free(info); >=20 > 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 ba= llooning. >> +# >> +# 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 >=20 >> + '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. --=20 Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org --Dd3HHjB1Mp1il9BDMF6VCuJD5MsT15MqG Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJZUmhUAAoJEKeha0olJ0NqaKIH+wRvzT0XRvDgpk88vDETJKTh qu8D6za7o5xPQh4kc03ZPIDxDv3PgyTt9zlgFgb0FwIMFM2du2xK1NH5swWL/Uqq XvmwMBG4zkFPpaa28opn1VNxnTG1+UE1wDLWMmPDYAGZ6+e8hcKACyj9lKKhRb4i YRwpBgjZhrH1pWgFTwoijUX7bDyiS/iLKaugSNft2Lt0NUf3ASKLtTKr0O0ZSzav cY7FbLWXC6cw+vhLSyARS3Pu+MrXAu9KpEvdx4teay52T2XwHJMlEdJlsq+jqLbm 38h6LpQq+PWMrJUOb9OFIvqa2vpLwODdu1yPw/888BGprPPS67dS31lAL0KZyKM= =rx/E -----END PGP SIGNATURE----- --Dd3HHjB1Mp1il9BDMF6VCuJD5MsT15MqG--