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. > > 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. >
> 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 <arm...@redhat.com> > --- 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 <ebl...@redhat.com> > > --- 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" > > /* for hmp_info_irq/pic */ > @@ -928,6 +929,20 @@ EventInfoList *qmp_query_events(Error **errp) > return ev_list; > } > > +/* > + * 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 > }, > > 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 = "query-qmp-schema", > + .args_type = "", > + .mhandler.cmd_new = qmp_query_schema, [1] qmp_query_qmp_schema might match naming conventions better. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature