[libvirt] [Qemu-devel] Re: Supporting hypervisor specific APIs in libvirt

Markus Armbruster armbru at redhat.com
Fri Mar 26 07:37:33 UTC 2010

Anthony Liguori <anthony at codemonkey.ws> writes:

> On 03/25/2010 11:50 AM, Markus Armbruster wrote:
>>> The point is, C is a lowest common denominator and it's important to
>>> support in a proper way.
>> No.  The lowest truly common denominator is plain text.  And we got that
>> covered already.
>> A developer encountered the problem of talking a simple text protocol.
>> He thought "I know, I'll create a 1:1 C API for that".  Now he got two
>> problems.
> I've done a poor job communicating in this thread.
> The C API's primary purpose is *not* to providing 1:1 wrapping
> functions for QMP functions.  That's a minor, add on feature, that I
> really would like, but it not at all useful for high level languages.
> The importances of libqemu is:
> 1) Providing a common QMP transport implementation that is extensible
> by third parties
> 2) Providing a set of common transports that support automatic
> discovery of command line launched guests
> 3) Providing a generic QMP dispatch function

Adding to this C wrappers for QMP commands threatens to make QMP command
arguments part of the library ABI.  Compatible QMP evolution (like
adding an optional argument) turns into a libqmp soname bump.
Counter-productive.  How do you plan to avoid that?

> Yes, this means you can't just create a JSON-RPC object in Python and
> talk QMP that way, but that's less desirable than you think it is.
> You could if you really wanted to, but you wouldn't get the benefits
> of the common transports.
> IOW, imagine qemu-cmd.  You want it to support:
> # qmp_new_by_name("Fedora")
> qemu-cmd Fedora set_link on
> # libqemu-ssh.so - ssh_qmp_new()
> qemu-cmd ssh://anthony@lab1.ibm/Fedora set_link on
> # qmp_new_by_fd()
> qemu-cmd -c /path/to/domain/socket set_link on
> # libvirt-qemu.so - virDomainGetQMP()
> qemu-cmd -b qemu+ssh://lab1.ibm/system Fedora set_link on
> This requires a high level transport.

All I'd want from such a transport is a file descriptor.  No need to
drag in yet another JSON library via libqmp.

More information about the libvir-list mailing list