[Qemu-devel] wiki summary
Richard W.M. Jones
rjones at redhat.com
Thu Nov 24 16:47:04 UTC 2011
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=commitdiff;h=cbd1c45d95c530c8d94103dcc2c521bf5501ef59
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=commitdiff;h=c4bd6bba8d88ecf1ebf4a9c2c80a407d9971aaf7
http://fedorapeople.org/gitweb?p=rjones/public_git/libguestfs.git;a=commitdiff;h=c11a92751e003b3d4bc3584b598afc9bd9d9e703
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
More information about the Arch
mailing list