[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC v5 30/32] qapi: New QMP command query-qmp-sc
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH RFC v5 30/32] qapi: New QMP command query-qmp-schema for QMP introspection |
Date: |
Tue, 8 Sep 2015 10:11:32 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
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 <address@hidden>
> ---
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 <address@hidden>
>
> --- 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
- [Qemu-devel] [PATCH RFC v5 24/32] qapi-commands: De-duplicate output marshaling functions, (continued)
- [Qemu-devel] [PATCH RFC v5 24/32] qapi-commands: De-duplicate output marshaling functions, Markus Armbruster, 2015/09/07
- [Qemu-devel] [PATCH RFC v5 32/32] qapi-introspect: Hide type names, Markus Armbruster, 2015/09/07
- [Qemu-devel] [PATCH RFC v5 27/32] qom: Don't use 'gen': false for qom-get, qom-set, object-add, Markus Armbruster, 2015/09/07
- [Qemu-devel] [PATCH RFC v5 26/32] qapi: Introduce a first class 'any' type, Markus Armbruster, 2015/09/07
- [Qemu-devel] [PATCH RFC v5 29/32] qapi: Pseudo-type '**' is now unused, drop it, Markus Armbruster, 2015/09/07
- [Qemu-devel] [PATCH RFC v5 21/32] qapi-commands: Rearrange code, Markus Armbruster, 2015/09/07
- [Qemu-devel] [PATCH RFC v5 19/32] qapi: Clean up after recent conversions to QAPISchemaVisitor, Markus Armbruster, 2015/09/07
- [Qemu-devel] [PATCH RFC v5 22/32] qapi: Rename qmp_marshal_input_FOO() to qmp_marshal_FOO(), Markus Armbruster, 2015/09/07
- [Qemu-devel] [PATCH RFC v5 30/32] qapi: New QMP command query-qmp-schema for QMP introspection, Markus Armbruster, 2015/09/07
Re: [Qemu-devel] [PATCH RFC v5 00/32] qapi: QMP introspection, Markus Armbruster, 2015/09/11
Re: [Qemu-devel] [PATCH RFC v5 00/32] qapi: QMP introspection, Markus Armbruster, 2015/09/15