aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorCornelia Huck <cohuck@redhat.com>2018-07-06 15:06:19 +0200
committerKevin Wolf <kwolf@redhat.com>2018-07-10 14:36:12 +0200
commit75f4cd297922e1ac352625badf548d4a1bb96089 (patch)
tree283ab653522c1920780ac15c0cc5e5938c866b96 /blockdev.c
parent44e8b4689c6e3aba4df08a1201f02ac7bf3d2fdb (diff)
Revert "block: Remove deprecated -drive option addr"
This reverts commit eae3bd1eb7c6b105d30ec06008b3bc3dfc5f45bb. Reverted to avoid conflicts for geometry options revert. Signed-off-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/blockdev.c b/blockdev.c
index 6c530769fd..c23587b075 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -731,6 +731,10 @@ QemuOptsList qemu_legacy_drive_opts = {
.type = QEMU_OPT_STRING,
.help = "interface (ide, scsi, sd, mtd, floppy, pflash, virtio)",
},{
+ .name = "addr",
+ .type = QEMU_OPT_STRING,
+ .help = "pci address (virtio only)",
+ },{
.name = "serial",
.type = QEMU_OPT_STRING,
.help = "disk serial number",
@@ -773,6 +777,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
DriveMediaType media = MEDIA_DISK;
BlockInterfaceType type;
int max_devs, bus_id, unit_id, index;
+ const char *devaddr;
const char *werror, *rerror;
bool read_only = false;
bool copy_on_read;
@@ -781,7 +786,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
Error *local_err = NULL;
int i;
const char *deprecated[] = {
- "serial"
+ "serial", "addr"
};
/* Change legacy command line options into QMP ones */
@@ -971,6 +976,12 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
}
/* Add virtio block device */
+ devaddr = qemu_opt_get(legacy_opts, "addr");
+ if (devaddr && type != IF_VIRTIO) {
+ error_report("addr is not supported by this bus type");
+ goto fail;
+ }
+
if (type == IF_VIRTIO) {
QemuOpts *devopts;
devopts = qemu_opts_create(qemu_find_opts("device"), NULL, 0,
@@ -982,6 +993,9 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
}
qemu_opt_set(devopts, "drive", qdict_get_str(bs_opts, "id"),
&error_abort);
+ if (devaddr) {
+ qemu_opt_set(devopts, "addr", devaddr, &error_abort);
+ }
}
filename = qemu_opt_get(legacy_opts, "file");
@@ -1026,6 +1040,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
dinfo->type = type;
dinfo->bus = bus_id;
dinfo->unit = unit_id;
+ dinfo->devaddr = devaddr;
dinfo->serial = g_strdup(serial);
blk_set_legacy_dinfo(blk, dinfo);