|
|
9ae3a8 |
From d3346d7e6dea698bc00eb18be4e174e9036ebeee Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Date: Tue, 5 Nov 2013 14:09:05 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 52/87] blockdev: Move parsing of 'if' option to drive_init
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1383660558-32096-12-git-send-email-kwolf@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 55390
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.0 qemu-kvm PATCH 11/24] blockdev: Move parsing of 'if' option to drive_init
|
|
|
9ae3a8 |
Bugzilla: 978402
|
|
|
9ae3a8 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
It's always IF_NONE for blockdev-add.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Benoit Canet <benoit@irqsave.net>
|
|
|
9ae3a8 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 593d464bd43900c2a0c8800b76212f6a93e99a0d)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
blockdev.c | 40 ++++++++++++++++++++++------------------
|
|
|
9ae3a8 |
1 file changed, 22 insertions(+), 18 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
blockdev.c | 40 ++++++++++++++++++++++------------------
|
|
|
9ae3a8 |
1 files changed, 22 insertions(+), 18 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/blockdev.c b/blockdev.c
|
|
|
9ae3a8 |
index e6d3c15..9bc3417 100644
|
|
|
9ae3a8 |
--- a/blockdev.c
|
|
|
9ae3a8 |
+++ b/blockdev.c
|
|
|
9ae3a8 |
@@ -328,14 +328,13 @@ typedef enum { MEDIA_DISK, MEDIA_CDROM } DriveMediaType;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/* Takes the ownership of bs_opts */
|
|
|
9ae3a8 |
static DriveInfo *blockdev_init(QDict *bs_opts,
|
|
|
9ae3a8 |
- BlockInterfaceType block_default_type,
|
|
|
9ae3a8 |
+ BlockInterfaceType type,
|
|
|
9ae3a8 |
DriveMediaType media)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
const char *buf;
|
|
|
9ae3a8 |
const char *file = NULL;
|
|
|
9ae3a8 |
const char *serial;
|
|
|
9ae3a8 |
const char *mediastr = "";
|
|
|
9ae3a8 |
- BlockInterfaceType type;
|
|
|
9ae3a8 |
int bus_id, unit_id;
|
|
|
9ae3a8 |
int cyls, heads, secs, translation;
|
|
|
9ae3a8 |
int max_devs;
|
|
|
9ae3a8 |
@@ -396,17 +395,6 @@ static DriveInfo *blockdev_init(QDict *bs_opts,
|
|
|
9ae3a8 |
file = qemu_opt_get(opts, "file");
|
|
|
9ae3a8 |
serial = qemu_opt_get(opts, "serial");
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- if ((buf = qemu_opt_get(opts, "if")) != NULL) {
|
|
|
9ae3a8 |
- for (type = 0; type < IF_COUNT && strcmp(buf, if_name[type]); type++)
|
|
|
9ae3a8 |
- ;
|
|
|
9ae3a8 |
- if (type == IF_COUNT) {
|
|
|
9ae3a8 |
- error_report("unsupported bus type '%s'", buf);
|
|
|
9ae3a8 |
- return NULL;
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
- } else {
|
|
|
9ae3a8 |
- type = block_default_type;
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
max_devs = if_max_devs[type];
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (cyls || heads || secs) {
|
|
|
9ae3a8 |
@@ -753,6 +741,10 @@ QemuOptsList qemu_legacy_drive_opts = {
|
|
|
9ae3a8 |
.name = "media",
|
|
|
9ae3a8 |
.type = QEMU_OPT_STRING,
|
|
|
9ae3a8 |
.help = "media type (disk, cdrom)",
|
|
|
9ae3a8 |
+ },{
|
|
|
9ae3a8 |
+ .name = "if",
|
|
|
9ae3a8 |
+ .type = QEMU_OPT_STRING,
|
|
|
9ae3a8 |
+ .help = "interface (ide, scsi, sd, mtd, floppy, pflash, virtio)",
|
|
|
9ae3a8 |
},
|
|
|
9ae3a8 |
{ /* end of list */ }
|
|
|
9ae3a8 |
},
|
|
|
9ae3a8 |
@@ -765,6 +757,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
|
|
9ae3a8 |
QDict *bs_opts;
|
|
|
9ae3a8 |
QemuOpts *legacy_opts;
|
|
|
9ae3a8 |
DriveMediaType media = MEDIA_DISK;
|
|
|
9ae3a8 |
+ BlockInterfaceType type;
|
|
|
9ae3a8 |
Error *local_err = NULL;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/* Change legacy command line options into QMP ones */
|
|
|
9ae3a8 |
@@ -828,8 +821,23 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ /* Controller type */
|
|
|
9ae3a8 |
+ value = qemu_opt_get(legacy_opts, "if");
|
|
|
9ae3a8 |
+ if (value) {
|
|
|
9ae3a8 |
+ for (type = 0;
|
|
|
9ae3a8 |
+ type < IF_COUNT && strcmp(value, if_name[type]);
|
|
|
9ae3a8 |
+ type++) {
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ if (type == IF_COUNT) {
|
|
|
9ae3a8 |
+ error_report("unsupported bus type '%s'", value);
|
|
|
9ae3a8 |
+ goto fail;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ } else {
|
|
|
9ae3a8 |
+ type = block_default_type;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
/* Actual block device init: Functionality shared with blockdev-add */
|
|
|
9ae3a8 |
- dinfo = blockdev_init(bs_opts, block_default_type, media);
|
|
|
9ae3a8 |
+ dinfo = blockdev_init(bs_opts, type, media);
|
|
|
9ae3a8 |
if (dinfo == NULL) {
|
|
|
9ae3a8 |
goto fail;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -1781,10 +1789,6 @@ QemuOptsList qemu_common_drive_opts = {
|
|
|
9ae3a8 |
.type = QEMU_OPT_NUMBER,
|
|
|
9ae3a8 |
.help = "unit number (i.e. lun for scsi)",
|
|
|
9ae3a8 |
},{
|
|
|
9ae3a8 |
- .name = "if",
|
|
|
9ae3a8 |
- .type = QEMU_OPT_STRING,
|
|
|
9ae3a8 |
- .help = "interface (ide, scsi, sd, mtd, floppy, pflash, virtio)",
|
|
|
9ae3a8 |
- },{
|
|
|
9ae3a8 |
.name = "index",
|
|
|
9ae3a8 |
.type = QEMU_OPT_NUMBER,
|
|
|
9ae3a8 |
.help = "index number",
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|