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