On Thu, Nov 24, 2011 at 02:40:07PM +0200, Dor Laor wrote:
Using QMP is an advantage, I agree. However it can be used by another option - move the QMP schema out of qemu.git so all projects like libvirt, agents, vdsm, etc will be able to consume it directly.
This way, adding a new (agent) command will immediately propagate to all of the stack instead of each component to implement it differently (while it would still be possible). That's what libguestfs scheme do today.
I think Dor CC'd me on this because we use aggressive code generation in libguestfs to simplify creating new APIs. For an example see:
http://fedorapeople.org/gitweb?p=rjones/public_git/libguestfs.git;a=commitdi...
The patch is in three parts:
(1) C code to implement the new API. Constructing the command line, parsing the output.
(2) Metadata in the generator to describe the new API (parameters, return, documentation, etc.)
==> From this part *everything* is generated <==
- C header file - bindings in 8+ programming languages - documentation - RPC used over internal virtio-serial connection
(3) A test.
Intelligently generating code like this has been an enormous win.
Here are two slightly more complicated examples demonstrating the same thing:
http://fedorapeople.org/gitweb?p=rjones/public_git/libguestfs.git;a=commitdi... http://fedorapeople.org/gitweb?p=rjones/public_git/libguestfs.git;a=commitdi...
Rich.