[libvirt] [PATCH v4 4/5] qmp: full introspection support for QMP

Paolo Bonzini pbonzini at redhat.com
Tue Jan 28 11:14:58 UTC 2014

Il 28/01/2014 11:45, Amos Kong ha scritto:
> > My question is why is this generate-and-parse necessary?
> It's request of Libvirt, actually we can directly return the raw
> schema to Libvirt without extending/parsing, then Libvirt parse
> by itself.
> > Can we achieve it with less duplication?
> Let's see the feedback of Eric.

Eric's feedback is certainly useful, but I think we need to look at it 
from the QEMU perspective more than the libvirt perspective.

Passing the raw schema and letting libvirt parse it is a Really Bad idea 
from the QEMU perspective, in my opinion, even if it means a little more 
work now and even if libvirt is willing to add the parser.

First and foremost, the current "pseudo-JSON" encoding of the schema is 
nothing but a QEMU implementation detail.  The "pseudo-JSON" syntax 
definitely shouldn't percolate to the QAPI documentation.  Using normal 
QAPI structs means that the normal tool for documentation 
(qapi-schema.json doc comments) applies just as well to QAPI schema 

Second, if one day we were to change the schema representation from 
"pseudo-JSON" to something else, we would have to carry a "pseudo-JSON" 
serializer for backwards compatibility.  Building QAPI structs and 
relying on the normal formatting machinery is very different from 
putting together strings manually.

The schema must be emitted as JSON data, not as a string.  I'm not 
willing to compromise on this point. :)


More information about the libvir-list mailing list