From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VkzGc-00009X-Vk for qemu-devel@nongnu.org; Mon, 25 Nov 2013 11:44:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VkzGX-0007MG-Ds for qemu-devel@nongnu.org; Mon, 25 Nov 2013 11:44:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46858) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VkzGX-0007LW-4q for qemu-devel@nongnu.org; Mon, 25 Nov 2013 11:44:05 -0500 Message-ID: <52937E44.10503@redhat.com> Date: Mon, 25 Nov 2013 09:43:48 -0700 From: Eric Blake MIME-Version: 1.0 References: <1385001528-12003-1-git-send-email-imammedo@redhat.com> <1385001528-12003-6-git-send-email-imammedo@redhat.com> <87r4aaxdqt.fsf@blackfin.pond.sub.org> <20131125163642.4d832fd5@nial.usersys.redhat.com> <20131125160337.GB10326@redhat.com> <52937BA2.6020605@redhat.com> In-Reply-To: <52937BA2.6020605@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9vmeWRxhmHCJENnHnucIoi52u1dH09njw" Subject: Re: [Qemu-devel] [PATCH 05/27] qapi: add SIZE type parser to string_input_visitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , "Michael S. Tsirkin" Cc: peter.maydell@linaro.org, stefanha@redhat.com, quintela@redhat.com, qemu-devel@nongnu.org, hutao@cn.fujitsu.com, stefanb@linux.vnet.ibm.com, mjt@tls.msk.ru, mdroth@linux.vnet.ibm.com, Markus Armbruster , vasilis.liaskovitis@profitbricks.com, kraxel@redhat.com, aliguori@amazon.com, Igor Mammedov , marcel.a@redhat.com, lcapitulino@redhat.com, chegu_vinod@hp.com, afaerber@suse.de This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --9vmeWRxhmHCJENnHnucIoi52u1dH09njw Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 11/25/2013 09:32 AM, Paolo Bonzini wrote: >> Yes please. Firing up a calculator to figure out how much is 1G is not= >> friendly, neither is firing it up to figure out what did management do= >> with QMP. It should be a text based interface not a binary one. Right now, QMP takes an 'int', which does not allow a suffix. Libvirt prefers passing a value in 'bytes', rather than risking confusion on whether a value in G was rounded (up, down? to nearest power of 10 or power of 2?). Unfortunately, yes, that means you need a calculator when parsing QMP logs to see whether the 1073741824 passed by libvirt is the 1G you had in mind. HMP, qtest, and any other decent shell around raw QMP is more than welcome to provide human-usable wrappers that takes "1G" as a string and turns it into the raw int used by the underlying QMP. In fact, I encourage it. > This is unfortunately a counter-example to the rule that HMP commands > should always be implemented in terms of their QMP counterparts. I do > not believe this is really a problem. It can be fixed later; for now, = I > think "perfect is the enemy of good" applies. Hey - I just realized that now that we have anonymous unions, we could theoretically extend QMP to allow a union between 'int' and 'string' - if an 'int' is passed, it is in bytes; if a 'string' is passed, then parse it the way HMP would (so the string "1G" would be equivalent to the raw int 1073741824). But I don't know if it will help you (libvirt will still prefer to use raw ints in any QMP log you read off of libvirt interactions). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --9vmeWRxhmHCJENnHnucIoi52u1dH09njw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSk35EAAoJEKeha0olJ0NqyfEH/ilfBHLtM+4e7JitNKXNRCBV fBBQTl5NQICdHlQxnNCjctdbCvgVmr4kCJ0uzo2n2Rbqjcilu9t35w3MW1iyHFAH +jLybTT47eTorNeicKgA02n+4v94e/BT/T8KBsOY3DLtkcbwMLX9B46Q1tSWRGI5 ZNg3nJHpcgS+gfP1l3JEEKiPlvw8HOxhXyeV2nLOi+kimMrbvlSaFvbXepnGkOHm SSSnohvq3XBpzG8/eQbWyG0rPkM0zaTdSRI/lR4A/jBnDg0AfIWRrlvUQw6gQWLs +GbbBOhwhR6JmhFixcsIOQ0MzBrhFZZihLSE82ibekRZUpNuu3Oe7+uzOKDjaqw= =g5k2 -----END PGP SIGNATURE----- --9vmeWRxhmHCJENnHnucIoi52u1dH09njw--