From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xensource.com
Cc: Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH] tools: libxl: translate xvd[a-d] to hd[a-d] for new qemu
Date: Thu, 31 Mar 2011 12:31:33 +0100 [thread overview]
Message-ID: <d0dd569bfcb0f5f8e2d9.1301571093@localhost.localdomain> (raw)
# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# 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@citrix.com>
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]);
}
next reply other threads:[~2011-03-31 11:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-31 11:31 Ian Campbell [this message]
2011-03-31 18:38 ` [PATCH] tools: libxl: translate xvd[a-d] to hd[a-d] for new qemu Ian Jackson
2011-04-01 12:01 ` Ian Campbell
2011-04-01 13:09 ` Ian Campbell
2011-04-01 15:22 ` Stefano Stabellini
2011-04-01 15:28 ` Ian Campbell
2011-04-04 13:21 ` [PATCH 0 of 5] libxl: fixes to upstream qemu disk configuration Ian Campbell
2011-04-04 13:21 ` [PATCH 1 of 5] libxl: explicitly set disk format in libxl__append_disk_list_of_type Ian Campbell
2011-04-04 13:21 ` [PATCH 2 of 5] libxl: return raw disk and partition number from libxl__device_disk_dev_number Ian Campbell
2011-04-04 13:21 ` [PATCH 3 of 5] libxl: pass list of disks to libxl__build_device_model_args Ian Campbell
2011-04-04 13:21 ` [PATCH 4 of 5] libxl: specify disks using supported command line syntax for new qemu Ian Campbell
2011-04-04 13:21 ` [PATCH 5 of 5] libxl: specific explicit disk image format to " Ian Campbell
2011-04-05 17:18 ` Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d0dd569bfcb0f5f8e2d9.1301571093@localhost.localdomain \
--to=ian.campbell@citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).