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

[Xen-changelog] [xen-unstable] libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work



# HG changeset patch
# User Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
# Date 1309259950 -3600
# Node ID 3173b68c8a945deaeb2642f8bdb97c52ca0eaec7
# Parent  598f1d9cfc8b972ab73412e9bd979004118de716
libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work

libxl callers should not be required to specify the backend if they
don't want to.  So LIBXL_DISK_BACKEND_UNKNOWN should instruct libxl to
choose the backend for itself.

For now, we do this by simply treating it the same as BACKEND_TAP,
which itself falls back to other methods.

More thorough fixes for the disk handling will follow.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---


diff -r 598f1d9cfc8b -r 3173b68c8a94 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue Jun 28 09:26:24 2011 +0100
+++ b/tools/libxl/libxl.c       Tue Jun 28 12:19:10 2011 +0100
@@ -991,6 +991,21 @@
     device.domid = domid;
     device.kind = DEVICE_VBD;
 
+
+    /*
+     * Fixing the incoming backend type to try to decide on which
+     * backend to use.  Unfortunately at the moment this code is
+     * utterly broken, but it more or less works.
+     */
+
+    /*
+     * Backend type UNKNOWN should mean "caller does not want to specify",
+     * not "break pointlessely".  (Callers should not be required to
+     * specify the backend if they don't want to.)
+     */
+    if (disk->backend == LIBXL_DISK_BACKEND_UNKNOWN)
+        disk->backend = LIBXL_DISK_BACKEND_TAP;
+
     /* If blktap is not available then fallback to qdisk */
     if (disk->backend == LIBXL_DISK_BACKEND_TAP && !libxl__blktap_enabled(&gc))
         disk->backend = LIBXL_DISK_BACKEND_QDISK;
@@ -1124,6 +1139,20 @@
     char *dev = NULL;
     char *ret = NULL;
 
+    /*
+     * Fixing the incoming backend type to try to decide on which
+     * backend to use.  Unfortunately at the moment this code is
+     * utterly broken, but it more or less works.
+     */
+
+    /*
+     * Backend type UNKNOWN should mean "caller does not want to specify",
+     * not "break pointlessely".  (Callers should not be required to
+     * specify the backend if they don't want to.)
+     */
+    if (disk->backend == LIBXL_DISK_BACKEND_UNKNOWN)
+        disk->backend = LIBXL_DISK_BACKEND_TAP;
+
     switch (disk->backend) {
         case LIBXL_DISK_BACKEND_PHY:
             if (disk->format != LIBXL_DISK_FORMAT_RAW) {
@@ -1173,7 +1202,6 @@
                 disk->pdev_path);
             dev = disk->pdev_path;
             break;
-        case LIBXL_DISK_BACKEND_UNKNOWN:
         default:
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk backend "
                 "type: %d", disk->backend);

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


 


Rackspace

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