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: specify disks using supported comm

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: specify disks using supported command line syntax for new qemu
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Wed, 06 Apr 2011 00:30:17 +0100
Delivery-date: Tue, 05 Apr 2011 16:32:04 -0700
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 Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1302021288 -3600
# Node ID db421477a0a05773bd84d5cc863d0dd3536ff1a5
# Parent  2666e7f0650d3577f31d2f47618df14ef7a48d7e
libxl: specify disks using supported command line syntax for new qemu

The -hdX syntax is only retained for compatibility reasons and the
-sdX syntax doesn't even exist.

Additionally convert the first four non-SCSI disks to hd[a-d] and
ignore any further non-SCSI disks (since qemu only supports 4 IDE
devices).

SCSI disks are passed through as is. qemu-xen was limited to 7 SCSI
devices but upstream qemu supports 256, therefore do not limit the
number of disks on the libxl side.

qemu-xen did all this itself internally.

Fixes "qemu: -xvda: invalid option" and allows PVHVM to work with
upstream qemu.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r 2666e7f0650d -r db421477a0a0 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Tue Apr 05 17:27:49 2011 +0100
+++ b/tools/libxl/libxl_dm.c    Tue Apr 05 17:34:48 2011 +0100
@@ -175,6 +175,7 @@
                                                   libxl_device_disk *disks, 
int num_disks,
                                                   libxl_device_nic *vifs, int 
num_vifs)
 {
+    libxl_ctx *ctx = libxl__gc_owner(gc);
     flexarray_t *dm_args;
     int i;
 
@@ -312,13 +313,48 @@
 
     if (info->type == XENFV) {
         for (i; i < num_disks; i++) {
+            int disk, part;
+            int dev_number =
+                libxl__device_disk_dev_number(disks[i].vdev, &disk, &part);
+            char *drive;
+
+            if (dev_number == -1) {
+                LIBXL__LOG(ctx, LIBXL__LOG_WARNING, "unable to determine"
+                           " disk number for %s", disks[i].vdev);
+                continue;
+            }
+
             if (disks[i].is_cdrom) {
-                flexarray_append(dm_args, "-cdrom");
-                flexarray_append(dm_args, libxl__strdup(gc, 
disks[i].pdev_path));
+                if (disks[i].format == DISK_FORMAT_EMPTY)
+                    drive = libxl__sprintf
+                        (gc, "if=ide,index=%d,media=cdrom", disk);
+                else
+                    drive = libxl__sprintf
+                        (gc, "file=%s,if=ide,index=%d,media=cdrom",
+                         disks[i].pdev_path, disk);
             } else {
-                flexarray_append(dm_args, libxl__sprintf(gc, "-%s", 
disks[i].vdev));
-                flexarray_append(dm_args, libxl__strdup(gc, 
disks[i].pdev_path));
+                if (disks[i].format == DISK_FORMAT_EMPTY)
+                    continue;
+
+                /*
+                 * Explicit sd disks are passed through as is.
+                 *
+                 * For other disks we translate devices 0..3 into
+                 * hd[a-d] and ignore the rest.
+                 */
+                if (strncmp(disks[i].vdev, "sd", 2) == 0)
+                    drive = libxl__sprintf(gc, "file=%s,if=scsi,bus=0,unit=%d",
+                                           disks[i].pdev_path, disk);
+                else if (disk < 4)
+                    drive = libxl__sprintf
+                        (gc, "file=%s,if=ide,index=%d,media=disk",
+                         disks[i].pdev_path, disk);
+                else
+                    continue; /* Do not emulate this disk */
             }
+
+            flexarray_append(dm_args, "-drive");
+            flexarray_append(dm_args, drive);
         }
     }
     flexarray_append(dm_args, NULL);

_______________________________________________
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: specify disks using supported command line syntax for new qemu, Xen patchbot-unstable <=