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)