[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 2 of 7] libxl: make fallback from blktap2 to qdisk more explicit



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1302167195 -3600
# Node ID 76d363a113e5ee6111bc9e0eca5a314644ce6295
# Parent  29af1669de3ab2e7d41078eb33a0dfa9b69f09bb
libxl: make fallback from blktap2 to qdisk more explicit.

When blktap2 is not present we fallback to qdisk, instead of falling
through a switch statement instead make this explicit, with a comment,
prior to the switch statement.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 29af1669de3a -r 76d363a113e5 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Thu Apr 07 10:06:12 2011 +0100
+++ b/tools/libxl/libxl.c       Thu Apr 07 10:06:35 2011 +0100
@@ -979,6 +979,10 @@ int libxl_device_disk_add(libxl_ctx *ctx
     device.domid = domid;
     device.kind = DEVICE_VBD;
 
+    /* If blktap is not available then fallback to qdisk */
+    if (disk->backend == DISK_BACKEND_TAP && !libxl__blktap_enabled(&gc))
+        disk->backend = DISK_BACKEND_QDISK;
+
     switch (disk->backend) {
         case DISK_BACKEND_PHY: 
             libxl__device_physdisk_major_minor(disk->pdev_path, &major, 
&minor);
@@ -991,7 +995,7 @@ int libxl_device_disk_add(libxl_ctx *ctx
             device.backend_kind = DEVICE_VBD;
             break;
         case DISK_BACKEND_TAP:
-            if (libxl__blktap_enabled(&gc) && disk->format != 
DISK_FORMAT_EMPTY) {
+            if (disk->format != DISK_FORMAT_EMPTY) {
                 const char *dev = libxl__blktap_devpath(&gc,
                                                disk->pdev_path, disk->format);
                 if (!dev) {
@@ -1012,7 +1016,8 @@ int libxl_device_disk_add(libxl_ctx *ctx
 
                 break;
             }
-        case DISK_BACKEND_QDISK: 
+            break;
+        case DISK_BACKEND_QDISK:
             flexarray_append(back, "params");
             flexarray_append(back, libxl__sprintf(&gc, "%s:%s",
                           libxl__device_disk_string_of_format(disk->format), 
disk->pdev_path));

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.