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-devel

[Xen-devel] [PATCH] tools: libxl: translate xvd[a-d] to hd[a-d] for new

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] tools: libxl: translate xvd[a-d] to hd[a-d] for new qemu
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Thu, 31 Mar 2011 12:31:33 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Thu, 31 Mar 2011 04:32:51 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.4
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1301571089 -3600
# Node ID d0dd569bfcb0f5f8e2d903c8b6f9999ff1290e96
# Parent  7b5c5a365f2a0a57e83479f69e5b56beb07752c1
tools: libxl: translate xvd[a-d] to hd[a-d] for new qemu

xvde+ are ignored.

Old qemu did this itself internally. Fixes "qemu: -xvda: invalid
option" and allows PVHVM to work with new qemu.

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

diff -r 7b5c5a365f2a -r d0dd569bfcb0 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Thu Mar 31 11:57:29 2011 +0100
+++ b/tools/libxl/libxl_dm.c    Thu Mar 31 12:31:29 2011 +0100
@@ -175,6 +175,7 @@ static char ** libxl__build_device_model
                                                   libxl_device_nic *vifs,
                                                   int num_vifs)
 {
+    libxl_ctx *ctx = libxl__gc_owner(gc);
     flexarray_t *dm_args;
     libxl_device_disk *disks;
     int nb, i;
@@ -318,8 +319,25 @@ static char ** libxl__build_device_model
                 flexarray_append(dm_args, "-cdrom");
                 flexarray_append(dm_args, libxl__strdup(gc, 
disks[i].pdev_path));
             } else {
-                flexarray_append(dm_args, libxl__sprintf(gc, "-%s", 
disks[i].vdev));
-                flexarray_append(dm_args, libxl__strdup(gc, 
disks[i].pdev_path));
+                char hd_dev[] = "hdX";
+                const char *vdev = NULL;
+
+                if (strncmp(disks[i].vdev, "xvd", 3) == 0) {
+                    if (disks[i].vdev[3] >= 'a' && disks[i].vdev[3] <= 'd') {
+                        hd_dev[2] = disks[i].vdev[3];
+                        vdev = &hd_dev[0];
+                        LIBXL__LOG(ctx, LIBXL__LOG_INFO, "translated disk 
device %s to %s", disks[i].vdev, vdev);
+                    } else {
+                        LIBXL__LOG(ctx, LIBXL__LOG_INFO, "ignored disk device 
%s", disks[i].vdev);
+                    }
+                } else {
+                    vdev = disks[i].vdev;
+                }
+
+                if (vdev) {
+                    flexarray_append(dm_args, libxl__sprintf(gc, "-%s", vdev));
+                    flexarray_append(dm_args, libxl__strdup(gc, 
disks[i].pdev_path));
+                }
             }
             libxl_device_disk_destroy(&disks[i]);
         }

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

<Prev in Thread] Current Thread [Next in Thread>