From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu2Vm-0002dR-V8 for qemu-devel@nongnu.org; Tue, 02 Jul 2013 11:29:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uu2Vk-0006u9-UW for qemu-devel@nongnu.org; Tue, 02 Jul 2013 11:28:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59672) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu2Vk-0006u5-NO for qemu-devel@nongnu.org; Tue, 02 Jul 2013 11:28:56 -0400 Message-ID: <51D2F1B3.1080903@redhat.com> Date: Tue, 02 Jul 2013 09:28:51 -0600 From: Eric Blake MIME-Version: 1.0 References: <1371644677-11041-1-git-send-email-akong@redhat.com> <878v1pqak4.fsf@codemonkey.ws> In-Reply-To: <878v1pqak4.fsf@codemonkey.ws> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2DGRBOKAACGQSIXMQXJFB" Subject: Re: [Qemu-devel] [PATCH] full introspection support for QMP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: armbru@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, qiaonuohan@cn.fujitsu.com, pbonzini@redhat.com, Amos Kong This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2DGRBOKAACGQSIXMQXJFB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/02/2013 08:51 AM, Anthony Liguori wrote: > Amos Kong writes: >=20 >> Introduces new monitor command to query QMP schema information, >> the return data is a nested dict/list, it contains the useful >> metadata. >> >> we can add events definations to qapi-schema.json, then it can >> also be queried. >> >> Signed-off-by: Amos Kong >=20 > Maybe I'm being too meta here, but why not just return qapi-schema.json= > as a string and call it as day? Because qapi-schema.json requires further parsing. For example, how is a client supposed to know that '*foo':'int' means that there is an argument named 'foo' but it is optional? The rule of thumb with QMP is that if you have to post-process JSON output, then the JSON was not designed correctly. >=20 > It's JSON already and since QMP is JSON, the client already has a JSON > parser. Adding another level of complexity doesn't add much value IMHO= =2E qapi-schema.json is not quite JSON, in that it has #comments that we'd have to strip before we attempted a trick like this. I've also been the one arguing that the additional complexity (an array of {"name":"str","type":"str","optional":bool"}) is better for libvirt in that the JSON is then well-suited for scanning (it is easier to scan through an array where the key is a constant "name", and looking for the value that we are interested in, than it is to scan through a dictionary where the keys of the dictionary are the names we are interested in). That is, the JSON in qapi-schema.json is a nice compact representation that works for humans, but may be a bit TOO compact for handling via machines. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2DGRBOKAACGQSIXMQXJFB 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.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJR0vGzAAoJEKeha0olJ0NqLCIIAIFlq2N6PZ4W7iViWq8GYF7l dUjWFCGVyJNaltAF5snqP8ZDC48A8U1OleH/2Sg+TIGMeNPwSCCnJWpD+boYzSwM Nnbq7agU0MGWxfFNJaAz5RUjl7mYrIQPm2j7qOleOlov/VZH+VIEny0wPSNYBtKN 0mkm96pz0jWsWkw5C6hz3gw43z2BQ01MdGn7khL/kSI59VuBQsunUzhAHfEEST0B SzMnTtKKHZJ9Nay4huiSjDUPW8Pa7iponwDQtWnG5Kd1K+M1uK+SJkpNS/v8qW8F tKXsFDCJW0R9GRSQ7TZSOksVQ/BuaAu+BL1Yvv047qjIGAU5ENiBDVLcvCNl5yU= =iylv -----END PGP SIGNATURE----- ------enig2DGRBOKAACGQSIXMQXJFB--