[Libvir] Unified Xen patch (incomplete, for discussion)

Richard W.M. Jones rjones at redhat.com
Wed Mar 28 16:19:16 UTC 2007


I've spent the last day or so producing a unified Xen patch.  In such a 
model a connection contains only a single underlying driver, and it is 
the responsibility of the (unified) Xen driver to try all the different 
methods it knows.

Attached is an incomplete patch for this, for discussion, plus the two 
extra files of the unified driver itself (for some reason CVS won't give 
me a diff including these added files).

Some points to note:

The new structure of the drivers is:

<pre>
   libvirt.c
     |
     +------- xen_unified.c
     |           |
     |           +--- xen_internal.c  (hypervisor)
     |           |
     |           +--- proxy_internal.c * (proxy)
     |           |
     |           +--- xend_internal.c * (XenD)
     |           |
     |           +--- xs_internal.c (XenStore)
     |           |
     |           +--- xm_internal.c * (inactive domains)
     |
     +-------- qemu_internal.c *
     |
     +-------- test.c

* = not updated yet, so these don't compile
</pre>

I haven't renamed the Xen sub-drivers.  That's really to make the patch 
easier to read.  There is definitely a case for renaming the drivers 
more logically to reflect the structure above.

All Xen-specific hacks in libvirt.c have been moved to xen_unified.c

Error handling in the case where a driver doesn't support a libvirt 
function is now considerably better.

Each driver keeps its private data private.

At the moment xen_unified pretty much does the "try the drivers in a 
loop until one succeeds" strategy which used to be in libvirt.c.  There 
is a case for making it do direct calls to the "right" driver, but for 
simplicity I haven't gone that far.

Again for simplicity the Xen sub-drivers still use struct virDriver. 
They should use their own custom 'struct virXenDriver' or whatever.  The 
effects of this are slight but noticable - some parameters are now no 
longer used in the sub-drivers, so marked ATTRIBUTE_UNUSED.

There is also a single networkDriver pointer in the connect struct.  We 
should modify the functions to handle the case where this is NULL 
because we couldn't bring up the network functions (all network 
functions in this case would just return an error).  libvirt in CVS 
fails to run if libvirtd isn't up.

I won't be able to get back to this before tomorrow afternoon, so plenty 
of time for discussion!

Rich.

-- 
Emerging Technologies, Red Hat  http://et.redhat.com/~rjones/
64 Baker Street, London, W1U 7DF     Mobile: +44 7866 314 421

Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SI4 1TE, United Kingdom.
Registered in UK and Wales under Company Registration No. 3798903
Directors: Michael Cunningham (USA), Charlie Peters (USA) and David
Owens (Ireland)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xen_unified.c
Type: text/x-csrc
Size: 16003 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070328/f857d7b1/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xen_unified.h
Type: text/x-chdr
Size: 427 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070328/f857d7b1/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvirt-unified-xen-20070328-0.patch
Type: text/x-patch
Size: 109586 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070328/f857d7b1/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070328/f857d7b1/attachment-0007.bin>


More information about the libvir-list mailing list