[Libvir] [RFC] Host and guest capabilities

Daniel P. Berrange berrange at redhat.com
Wed Mar 7 17:18:57 UTC 2007

On Wed, Mar 07, 2007 at 09:35:58AM -0500, Daniel Veillard wrote:
> On Wed, Mar 07, 2007 at 12:35:20PM +0000, Richard W.M. Jones wrote:
> > I've been looking into the parts of virtinst which try to probe the 
> > capabilities of the host directly, rather than being abstracted through 
> > libvirt (for example, opening and parsing 
> > /sys/hypervisor/properties/capabilities directly).
> > 
> > Attached is a proposed API for probing the capabilities and supported 
> > guest architectures of the hypervisor / driver.
> > 
> > I've implemented the virCapabilities part already.  My original 
> > implementation of the guest architectures had virCapabilities containing 
> > a list of supported architectures, but that doesn't nearly cover the 
> > richness of what the underlying drivers could support, so I'm currently 
> > separating that out into a separate virConnectGetGuestArchitectures call.
> > 
> > Let me know your opinions of this API.
>   This sounds too variable, adding an entry point per capability of
> some of the hypervisor available will lead to just too many entry points
> once the set of virtualization engines and associated benefits increase.
> That's one of the places where I feel wy more comfortable returning an
> XML description which can then be augmented as more features are added.
> > As an aside, the current virt-manager "choose paravirt / fullvirt" 
> > screen doesn't really capture the full, shall I say, ugliness of the 
> > possible choices for architecture, particularly when we add qemu, kqemu, 
> > and emulation in the mix.  I suspect that presenting a list of 
> > architectures here, perhaps with some options to show only paravirt, 
> > show only fullvirt, show only accelerated ...
>   I'm not sure we should directly add something like the Architectures 
> to the API (I mean the structure), it's very hard to guess now if we know
> all the informations which would be useful to return, and again, I would
> feel way better if this was provided as an XML blob, possibly embedded in
> the host capacities one.
>   Basically just turning the current virtinst lookups into libvirt APIs
> sounds a bit premature to me, I would prefer something more versatile and
> hence future-proof.

For those new to the list, we had a (short) thread on this same subject of
APIs for host capabilities last year


I'm personally still of the opinion we should consider a XML blob describing
the host capabilities. This gives API parity with the way we describe VM
hardware. Looking back at the extensions we've made to the VM XML over the
past year, I think the XML has been very succesful at allowing us to extend
the information returned without breaking clients. Some of the major additions
we've made thus far:

  - New <graphics> device for HVM.
  - More info in <os> block to suppport HVM.
  - Ability to choose driver for virtual disks
  - Attribute to distinguish floppy, cdrom & harddisks 
  - Support for IP addr in VIFs to support routed networking
  - Machine type & architecture in <os> block for QEMU/KVM

While we could certainly maintain compatability by using an opaque struct
and accessor methods, this will lead to a huge number of APIs over time.
To be able to have be able to do this with accessors, we'd need to go for
a finest grain, one-accessor per attribute, and introduce many opaque 
nested sub-objects to give flexibility to add new objects / attributes
whereever needed.

In terms of the virt-manager code, I don't think there's any significant
difference in complexity between using XML vs formal APIs & accessors. C
is a different matter because of its horrible string handling & the libxml
APIs are fairly low level. Even then its possible to make convenience
wrappers around the libxml APIs[1] to turn extracting info from XML into a
single method call providing an XPATH expression & returning a char *.


[1] This is a todo item to cleanup the XML handling inside xend_internal.c
    and the test.c drivers.
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

More information about the libvir-list mailing list