From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZLUo-0000El-QO for qemu-devel@nongnu.org; Tue, 08 Sep 2015 12:11:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZLUk-0003ha-9e for qemu-devel@nongnu.org; Tue, 08 Sep 2015 12:11:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42468) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZLUk-0003gX-28 for qemu-devel@nongnu.org; Tue, 08 Sep 2015 12:11:42 -0400 References: <1441621003-2434-1-git-send-email-armbru@redhat.com> <1441621003-2434-31-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55EF08B4.7090201@redhat.com> Date: Tue, 8 Sep 2015 10:11:32 -0600 MIME-Version: 1.0 In-Reply-To: <1441621003-2434-31-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="FVa38kJX92CaMELrcFQjDm81QRbkWJ0bh" Subject: Re: [Qemu-devel] [PATCH RFC v5 30/32] qapi: New QMP command query-qmp-schema for QMP introspection List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --FVa38kJX92CaMELrcFQjDm81QRbkWJ0bh Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/07/2015 04:16 AM, Markus Armbruster wrote: > qapi/introspect.json defines the introspection schema. It's designed > for QMP introspection, but should do for similar uses, such as QGA. >=20 > The introspection schema does not reflect all the rules and > restrictions that apply to QAPI schemata. A valid QAPI schema has an > introspection value conforming to the introspection schema, but the > converse is not true. >=20 > Right now qmp_query_schema() sends the string literal computed by Should this be spelled qmp_query_qmp_schema()? [1] > qmp-introspect.py. To compute sub-schema at run time, we'd have to > duplicate parts of qapi-introspect.py in C. Unattractive. > Signed-off-by: Markus Armbruster > --- Changes I noticed from v4: Simple unions work now. Documentation improvements. Rename to query-qmp-schema (except perhaps where I marked [1], but I'm not too fussed with either spelling). Use of self._member for internal fields. Reviewed-by: Eric Blake >=20 > --- a/monitor.c > +++ b/monitor.c > @@ -74,6 +74,7 @@ > #include "block/qapi.h" > #include "qapi/qmp-event.h" > #include "qapi-event.h" > +#include "qmp-introspect.h" > #include "sysemu/block-backend.h" > =20 > /* for hmp_info_irq/pic */ > @@ -928,6 +929,20 @@ EventInfoList *qmp_query_events(Error **errp) > return ev_list; > } > =20 > +/* > + * Minor hack: generated marshalling suppressed for this command > + * ('gen': false in the schema) so we can parse the JSON string > + * directly into QObject instead of first parsing it with > + * visit_type_SchemaInfoList() into a SchemaInfoList, then marshal it > + * to QObject with generated output marshallers, every time. Instead,= > + * we do it in test-qmp-input-visitor.c, just to make sure > + * qapi-introspect.py's output actually conforms to the schema. > + */ > +static void qmp_query_schema(QDict *qdict, QObject **ret_data, Error *= *errp) [1] > +++ b/qmp-commands.hx > @@ -2193,6 +2193,23 @@ EQMP > }, > =20 > SQMP > +query-qmp-schema > +---------------- > + > +Return the QMP wire schema. The returned value is a json-array of > +named schema entities. Entities are commands, events and various > +types. See docs/qapi-code-gen.txt for information on their structure > +and intended use. > + > +EQMP > + > + { > + .name =3D "query-qmp-schema", > + .args_type =3D "", > + .mhandler.cmd_new =3D qmp_query_schema, [1] qmp_query_qmp_schema might match naming conventions better. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --FVa38kJX92CaMELrcFQjDm81QRbkWJ0bh 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/ iQEcBAEBCAAGBQJV7wi0AAoJEKeha0olJ0Nq5x4IAIzyirRI5/U0WKcE812Sqsuj KaflcsBDll+4GvyNwJDQAKU6nhcOFOBPNdhU2SanqiSdfim9QVVg1XqVNa0n9z32 Wv3T1mBkkhfOMLElp7sxL6xl+N2qLGed9G+oLY0wmLRwH9fkbS/HZd5f/PZhqzIa Sri4lj/fyle0AImc3J1NYU+wtnIQZ513If5fWhK9Et/97+BJYyqMT78KbbZavybk 2lXXi4Bn8vNpAc54mY5IWqamXcEj01iOxnskfnaMK2e29iW/8ON2/DQghf3ozccD +djJpVC2hcYZAvC+WX6DnrToGY1FrND54p86fe6vjBcGg2oGlbDNHVrXRZ4AgIU= =MF8R -----END PGP SIGNATURE----- --FVa38kJX92CaMELrcFQjDm81QRbkWJ0bh--