aboutsummaryrefslogtreecommitdiff
path: root/hw/xen_devconfig.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2012-06-13 10:11:49 +0200
committerKevin Wolf <kwolf@redhat.com>2012-06-15 14:03:43 +0200
commit8814a05112632ec30f0b5b41d7b2cc639199c7f9 (patch)
treea1a03114250715daa6f397bb830428909e7cea5c /hw/xen_devconfig.c
parentf8d6bba1c1f56217d9ee71b7aee5f94f46c8f148 (diff)
xen: Don't change -drive if=xen device name during machine init
A "top" BlockDriverState has a non-empty device_name. If the user doesn't specify one with -drive parameter id, the system supplies a default name. xen_config_dev_blk() changes this name, during machine initialization. Naughty. Don't do that. Signed-off-by: Markus Armbruster <armbru@redhat.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/xen_devconfig.c')
-rw-r--r--hw/xen_devconfig.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/hw/xen_devconfig.c b/hw/xen_devconfig.c
index 41accbbfa9..7b7b0a2bf0 100644
--- a/hw/xen_devconfig.c
+++ b/hw/xen_devconfig.c
@@ -94,16 +94,15 @@ static int xen_config_dev_all(char *fe, char *be)
int xen_config_dev_blk(DriveInfo *disk)
{
- char fe[256], be[256];
+ char fe[256], be[256], device_name[32];
int vdev = 202 * 256 + 16 * disk->unit;
int cdrom = disk->media_cd;
const char *devtype = cdrom ? "cdrom" : "disk";
const char *mode = cdrom ? "r" : "w";
- snprintf(disk->bdrv->device_name, sizeof(disk->bdrv->device_name),
- "xvd%c", 'a' + disk->unit);
+ snprintf(device_name, sizeof(device_name), "xvd%c", 'a' + disk->unit);
xen_be_printf(NULL, 1, "config disk %d [%s]: %s\n",
- disk->unit, disk->bdrv->device_name, disk->bdrv->filename);
+ disk->unit, device_name, disk->bdrv->filename);
xen_config_dev_dirs("vbd", "qdisk", vdev, fe, be, sizeof(fe));
/* frontend */
@@ -111,7 +110,7 @@ int xen_config_dev_blk(DriveInfo *disk)
xenstore_write_str(fe, "device-type", devtype);
/* backend */
- xenstore_write_str(be, "dev", disk->bdrv->device_name);
+ xenstore_write_str(be, "dev", device_name);
xenstore_write_str(be, "type", "file");
xenstore_write_str(be, "params", disk->bdrv->filename);
xenstore_write_str(be, "mode", mode);