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

[xen-devel][PATCH] xl - Special case vhd images validation


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Kamala Narasimhan <kamala.narasimhan@xxxxxxxxx>
  • Date: Thu, 10 Feb 2011 12:16:06 -0500
  • Delivery-date: Thu, 10 Feb 2011 09:35:47 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=loG7nv89knyGwdqwGWSYqgURc4n5f9NFi9Oc15T7wx7kbzVVxiqGTiYIYZ/jz41QUm 2pc7yO7jM76zHBrGL2BctzviqHll+v0rPN4iD6IT7HxD/P3/FoiFRN+ywI97mOTADCBz eagnEzFCE0JnRwfxFjq5UAigeql70TWPaU0Oo=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Description - Special case how we validate vhd image files.  Without this patch 
when tap:aio:vhd prefixed image files are specified in the config file, disk 
validation and thus vm creation will fail.

IanJ - Since we decided to not merge disk changes patch 3-5, we need this.

IanC - This patch has the change you suggested to look for DISK_FORMAT_EMPTY.

Signed-off-by: Kamala Narasimhan <kamala.narasimhan@xxxxxxxxxx>

Kamala
diff -r 9e87dfb60bc6 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Thu Feb 10 11:49:27 2011 -0500
+++ b/tools/libxl/libxl.c       Thu Feb 10 11:50:25 2011 -0500
@@ -864,18 +864,29 @@ int libxl_vncviewer_exec(libxl_ctx *ctx,
 
/******************************************************************************/
 
 static int validate_virtual_disk(libxl_ctx *ctx, char *file_name, 
-    libxl_disk_backend backend_type, libxl_disk_format format)
+    libxl_device_disk *disk)
 {
     struct stat stat_buf;
+    char *delimiter;
 
-    if ((file_name[0] == '\0') && (format == DISK_FORMAT_EMPTY))
+    if (disk->format == DISK_FORMAT_EMPTY)
         return 0;
+
+    if (disk->format == DISK_FORMAT_RAW) {
+        delimiter = strchr(file_name, ':');
+        if (delimiter) { 
+            if (!strncmp(file_name, "vhd:", sizeof("vhd:")-1)) {
+                disk->format = DISK_FORMAT_VHD; 
+                file_name = ++delimiter;
+            }
+        }
+    }
 
     if (stat(file_name, &stat_buf) != 0) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to stat %s", 
file_name);
         return ERROR_INVAL;
     }
-    if (backend_type == DISK_BACKEND_PHY) {
+    if (disk->backend == DISK_BACKEND_PHY) {
         if ( !(S_ISBLK(stat_buf.st_mode)) ) {
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Virtual disk %s is not a block 
device!\n",
                 file_name);
@@ -899,8 +910,7 @@ int libxl_device_disk_add(libxl_ctx *ctx
     libxl__device device;
     int major, minor, rc;
 
-    rc = validate_virtual_disk(ctx, disk->pdev_path, disk->backend, 
-             disk->format);
+    rc = validate_virtual_disk(ctx, disk->pdev_path, disk);
     if (rc)
         return rc;
 
_______________________________________________
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®.