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

[Xen-devel] [PATCH, v2] xl block-detach: allow other than numeric-decimal specification of the disk


  • To: "xen-devel" <xen-devel@xxxxxxxxxxxxx>
  • From: "Jan Beulich" <JBeulich@xxxxxxxx>
  • Date: Tue, 06 Mar 2012 14:50:03 +0000
  • Delivery-date: Tue, 06 Mar 2012 14:50:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

... to be in sync with block-attach.

[v2: slightly rename function as suggested by IanC]
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1475,13 +1475,17 @@ static void libxl__device_disk_from_xs_b
     disk->format = LIBXL_DISK_FORMAT_UNKNOWN;
 }
 
-int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid,
-                               int devid, libxl_device_disk *disk)
+int libxl_vdev_to_device_disk(libxl_ctx *ctx, uint32_t domid,
+                              const char *vdev, libxl_device_disk *disk)
 {
     GC_INIT(ctx);
     char *dompath, *path;
+    int devid = libxl__device_disk_dev_number(vdev, NULL, NULL);
     int rc = ERROR_FAIL;
 
+    if (devid < 0)
+        return ERROR_INVAL;
+
     libxl_device_disk_init(disk);
 
     dompath = libxl__xs_get_dompath(gc, domid);
--- a/tools/libxl/libxl_utils.h
+++ b/tools/libxl/libxl_utils.h
@@ -61,7 +61,7 @@ int libxl_mac_to_device_nic(libxl_ctx *c
 int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t domid, int devid,
                               libxl_device_nic *nic);
 
-int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid, int devid,
+int libxl_vdev_to_device_disk(libxl_ctx *ctx, uint32_t domid, const char *vdev,
                                libxl_device_disk *disk);
 
 int libxl_cpumap_alloc(libxl_ctx *ctx, libxl_cpumap *cpumap);
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -4804,7 +4804,7 @@ int main_blockdetach(int argc, char **ar
         fprintf(stderr, "%s is an invalid domain identifier\n", argv[optind]);
         return 1;
     }
-    if (libxl_devid_to_device_disk(ctx, domid, atoi(argv[optind+1]), &disk)) {
+    if (libxl_vdev_to_device_disk(ctx, domid, argv[optind+1], &disk)) {
         fprintf(stderr, "Error: Device %s not connected.\n", argv[optind+1]);
         return 1;
     }



Attachment: xl-block-detach.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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