WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxl: disk specification: special case v

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: disk specification: special case vhd
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Thu, 17 Feb 2011 01:05:20 -0800
Delivery-date: Thu, 17 Feb 2011 01:05:34 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Kamala Narasimhan <kamala.narasimhan@xxxxxxxxxx>
# Date 1297800033 0
# Node ID 2ede5d7934932f61095beeedcb2389c4b664cbe5
# Parent  ae4799bdd42510e24cdf83b275d4675fe3105009
libxl: disk specification: special case vhd

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.

Signed-off-by: Kamala Narasimhan <kamala.narasimhan@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.c |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff -r ae4799bdd425 -r 2ede5d793493 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue Feb 15 19:59:37 2011 +0000
+++ b/tools/libxl/libxl.c       Tue Feb 15 20:00:33 2011 +0000
@@ -863,19 +863,30 @@ 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)
+static int validate_virtual_disk(libxl_ctx *ctx, char *file_name,
+    libxl_device_disk *disk) 
 {
     struct stat stat_buf;
-
-    if ((file_name[0] == '\0') && (format == DISK_FORMAT_EMPTY))
+    char *delimiter;
+
+    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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxl: disk specification: special case vhd, Xen patchbot-unstable <=