From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46021) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WATxO-00038k-19 for qemu-devel@nongnu.org; Mon, 03 Feb 2014 19:33:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WATxJ-0005M4-CB for qemu-devel@nongnu.org; Mon, 03 Feb 2014 19:33:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WATxJ-0005Kw-3k for qemu-devel@nongnu.org; Mon, 03 Feb 2014 19:33:37 -0500 Message-ID: <52F03559.7020502@redhat.com> Date: Mon, 03 Feb 2014 17:33:29 -0700 From: Eric Blake MIME-Version: 1.0 References: <1390488396-16538-1-git-send-email-akong@redhat.com> <1390488396-16538-5-git-send-email-akong@redhat.com> In-Reply-To: <1390488396-16538-5-git-send-email-akong@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="muqLh6fCeavMjHQFiCtDiTetboIONvglv" Subject: Re: [Qemu-devel] [PATCH v4 4/5] qmp: full introspection support for QMP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amos Kong , qemu-devel@nongnu.org Cc: qiaonuohan@cn.fujitsu.com, lcapitulino@redhat.com, mdroth@linux.vnet.ibm.com, xiawenc@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --muqLh6fCeavMjHQFiCtDiTetboIONvglv Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/23/2014 07:46 AM, Amos Kong wrote: > This patch introduces a new monitor command to query QMP schema > information, the return data is a range of schema structs, which > contains the useful metadata to help management to check supported > features, QMP commands detail, etc. >=20 > We use qapi-introspect.py to parse all json definition in > qapi-schema.json, and generate a range of dictionaries with metadata. > The query command will visit the dictionaries and fill the data > to allocated struct tree. Then QMP infrastructure will convert > the tree to json string and return to QMP client. >=20 > TODO: Do we still want this TODO in the commit message? It would be nice to get both of these features (introspection, and events described in qapi) in for 2.0; I'm trying to spend some review time to help get us there. > Wenchao Xia is working to convert QMP events to qapi-schema.json, > then event can also be queried by this interface. >=20 > I will introduce another command 'query-qga-schema' to query QGA > schema information, it's easy to add this support based on this > patch. Yes, we want that too :) Have you started that patch, or are you trying to get more feedback on this patch to make sure you're on the right track= ? >=20 > Signed-off-by: Amos Kong > --- > qapi-schema.json | 11 +++ > qmp-commands.hx | 42 +++++++++++ > qmp.c | 215 +++++++++++++++++++++++++++++++++++++++++++++++= ++++++++ > 3 files changed, 268 insertions(+) >=20 > diff --git a/qapi-schema.json b/qapi-schema.json > index c63f0ca..6033383 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -4411,3 +4411,14 @@ > 'reference-type': 'String', > 'type': 'DataObjectType', > 'unionobj': 'DataObjectUnion' } } > + > +## > +# @query-qmp-schema > +# > +# Query QMP schema information > +# > +# @returns: list of @DataObject > +# > +# Since: 1.8 2.0 And here's where an optional bool on whether to expand may be worthwhile, as well as an optional argument allowing callers to filter da= ta. > +## > +{ 'command': 'query-qmp-schema', 'returns': ['DataObject'] } > +Return a json-object with the following information: > + > +- "name": qmp schema name (json-string) > +- "type": qmp schema type, it can be 'comand', 'type', 'enum', 'union'= s/comand/command/ > +++ b/qmp.c > +static DataObjectMember *qobject_to_dataobjmem(QObject *data) > +{ > + > + DataObjectMember *member =3D g_malloc0(sizeof(DataObjectMember)); The blank line here looks unusual. I didn't look at the code very closely; I want to look at the generated =2Eh file first. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --muqLh6fCeavMjHQFiCtDiTetboIONvglv 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJS8DVZAAoJEKeha0olJ0NqCZcH/2t67NXnGqhR6eRAGuNjiKdy CzbYy1jk42clfoPZmygluL9lNfwBl5IJZoGPSUEvrMPGC1h0g0dpxpPYdnxKSntS hojMUSdXfqpbSO6w9WbDq33teqpkS98DxpEQ77qfTYwXYP1qQdT6Aymu5x1ok3Is adICAQ2kgnXvbW2hrl858Ti1ZH8YE1sMVuOjElWZWmpDIhFnWqrnBVFihEVUjkg3 8Fs6CM1cPKtRy/WE4JRYrN4w3+pqhBmVCLYQb0uwi3MRbg5MAKo8fTWV8yVzE9Qp pRea7+V/7dzvQtDnKvrXPTTaf4bKV0qT2koJYSJLcW9BSjSnwVXOMV1UhzKJVSs= =r4xi -----END PGP SIGNATURE----- --muqLh6fCeavMjHQFiCtDiTetboIONvglv--