On Mon, 14 Feb 2011, Jim Fehlig wrote:
Hi All,
Here's a first cut of libxenlight driver for libvirt. The driver is
stateful and provides functionality for managed (persistent) domains.
The driver only maintains state for and manages domains under its
control, ignoring domains created by other libxenlight clients, e.g. xl.
As you can see, a fair number of the driver functions are implemented,
at least what I think constitutes a minimal set for upstream inclusion.
Are there any required functions missing?
I'm still looking into a problem with failure to restart a domain,
persistent or otherwise. E.g. virsh start|create domU; virsh shutdown
domU; virsh start|create domU. The second start/create fails in
libxenlight, but I've not yet tracked down the cause. Also, I've not
yet handled restart of libvirtd if domains are running - not sure if
this is a requirement for initial inclusion.
TIA for your review and comment.
Regards,
Jim
Add a new xen driver based on libxenlight [1], which is the primary
toolstack starting with Xen 4.1.0. The driver is stateful, runs
privileged only, and is accessed with libxl:/// URI.
---8<---
+static int
+libxlMakeDiskList(virDomainDefPtr def, libxl_domain_config *d_config)
+{
+ virDomainDiskDefPtr *l_disks = def->disks;
+ int ndisks = def->ndisks;
+ libxl_device_disk *x_disks;
+ int i;
+
+ if (VIR_ALLOC_N(x_disks, ndisks) < 0) {
+ virReportOOMError();
+ return -1;
+ }
+
+ for (i = 0; i < ndisks; i++) {
+ if (l_disks[i]->src &&
+ (x_disks[i].physpath = strdup(l_disks[i]->src)) == NULL) {
+ virReportOOMError();
+ goto error;
+ }
+
+ if (l_disks[i]->dst &&
+ (x_disks[i].virtpath = strdup(l_disks[i]->dst)) == NULL) {
+ virReportOOMError();
+ goto error;
+ }
+
+ if (l_disks[i]->driverName) {
+ if (STREQ(l_disks[i]->driverName, "tap") ||
+ STREQ(l_disks[i]->driverName, "tap2")) {
+ if (l_disks[i]->driverType &&
+ STREQ(l_disks[i]->driverType, "qcow2"))
+ x_disks[i].phystype = PHYSTYPE_QCOW2;
+ else if (l_disks[i]->driverType &&
+ STREQ(l_disks[i]->driverType, "aio"))
+ x_disks[i].phystype = PHYSTYPE_AIO;
+ else if (l_disks[i]->driverType &&
+ STREQ(l_disks[i]->driverType, "vhd"))
+ x_disks[i].phystype = PHYSTYPE_VHD;
+ } else if (STREQ(l_disks[i]->driverName, "file")) {
+ x_disks[i].phystype = PHYSTYPE_FILE;
+ } else if (STREQ(l_disks[i]->driverName, "phy")) {
+ x_disks[i].phystype = PHYSTYPE_PHY;
+ }
+ } else {
+ /* Default to file?? */
+ x_disks[i].phystype = PHYSTYPE_FILE;
+ }
Just an heads up on disk parsing: we are about to change the disk API,
before the xen 4.1 release. That's because we realized that the current
API entangles the disk backend and the disk format together; so we are
going to separate them, using two separate fields: backend and format.
An change in the xl disk config parser will also follow, that should
help you make the corresponding changes to this function.
Everything else on the libxenlight side looks good!