[Libvir] [PATCH 0/2] Re-organize generation / handling of capabilities data

Daniel P. Berrange berrange at redhat.com
Tue Feb 26 04:57:56 UTC 2008


Earlier today I started the 'simple' task of extending the QEMU driver to
support Xenner for running Xen paravirt guests under KVM. This was at first
glance easy because it basically looks like QEMU - in fact all we needed
was to extend the capabilities XML for the QEMU driver to include data 
about Xen guests if Xenner is available.

Unfortunately this was easier said than done...

 - The code generating the XML in qemu_driver.c was a mix of string
   formatting for the XML, and functional logic for determining runtime
   capabilities (kvm, kqemu, etc).
 - More runtime logic was in the qemu_conf.c file and stuff that should
   be runtime logic was static.

I attempted to fix up the QEMU code for capabilities but it quickly turned
into a horrible mess of spaghetti.

Looking at the Xen driver, the situation was pretty much the same, but
with the capabilities XML generation spread out over 3 files (xml.c, 
xen_internal.c and xend_internal.c).

So I decided that we needed to have a internal API & structure to allow
drivers to formally register & query their capabilities , and also add a
central method for serializing it to XML. The following 2 patches implement
this idea, and porting the Xen, QEMU and Test drivers to use it. 

This removes a lot of code duplication in XML formatting and makes the
resulting code easier to follow, and should make it much quicker to
adding capabilities info to new drivers too.

Dan.
-- 
|=- 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