qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 0/1] Get the list of arguments from a QMP comman


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH 0/1] Get the list of arguments from a QMP command
Date: Wed, 11 Mar 2015 11:39:06 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Am 11.03.2015 um 11:21 hat Markus Armbruster geschrieben:
> Cc'ing Amos, who grappled with this in the past.
> 
> Alberto Garcia <address@hidden> writes:
> 
> > On Fri, Mar 06, 2015 at 10:11:39AM -0700, Eric Blake wrote:
> >
> >> I'm still thinking about the actual patch, and whether we want
> >> to commit to this or just bite the bullet and go for full
> >> introspection.  At any rate, it's a bit late for 2.3, so we have the
> >> full 2.4 cycle to get it right.
> >
> > I understand your concerns. I can actually try to implement full
> > introspection support, but I would like to know what API you would
> > like. Something like this?
> >
> >    'query-commands'
> >    'query-enums'
> >    'query-events'
> >    'query-types'
> >    'query-unions'
> 
> Observe that we already have a machine-readable interface description:
> the QAPI schema.  It's JSON, so we could have a query-schema return it
> verbatim (minus the comments, of course).

It's an awful structure for an external interface.

Things like designating optional fields with *name are great for humans
because they allow concise definitions where each field is just one dict
entry instead of a whole struct, and this keeps things readable.

This is important for the schema as it doesn't only serve as the source
for the code generator, but is edited by humans and used as an API
documentation. So we want to keep that.

But I'm pretty sure we don't want to send it as part of an external API.

> You propose a separate query-FOO for each kind of thing in the schema:
> command, event, the various types.  Not fundamentally different to a
> single query-schema.  We can discuss which of the two approaches is
> easier to use.  But first we need to address a number problems with the
> exposed schema's syntax and semantics.
> 
> Introspection by exposing the QAPI schema makes schema syntax and
> semantics an external interface.  Trouble is these are ill-defined.
> We'd have to fix that (good idea anyway), and review the result with
> compatible extensibility in mind.  Eric's stalled series "[PATCH v4
> 00/19] drop qapi nested structs" is a start:
> https://lists.nongnu.org/archive/html/qemu-devel/2014-09/msg04022.html

Cleanups on the surface won't change any of the points above. I'm not
convinced that the schema could be friendly for humans and suitable as
an external API at the same time.

> The QAPI schema describes a union of internal interfaces and the
> external QMP interface.  Unfortunate, because it makes the external
> interface hard to see.  Naturally, QMP introspection should only expose
> the QMP interface.  So we'd have to extract that part.
> 
> Here's how I'd try to do that.  Treat the schema as a graph, its nodes
> are the definitions of types, commands and events are nodes, and a use
> of a type adds an edge from the node containing the use to the type.
> The external interface is exactly the sub-graph reachable QMP command
> and event nodes.

Yes, that's how I would do it, too.

Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]