[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/39] blockdev: Move 'serial' option to drive_init()
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 03/39] blockdev: Move 'serial' option to drive_init() |
Date: |
Mon, 16 Jun 2014 19:23:27 +0800 |
From: Kevin Wolf <address@hidden>
It is not available with blockdev-add.
Signed-off-by: Kevin Wolf <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
blockdev.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 4cbcc56..0505f9d 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -329,7 +329,6 @@ static DriveInfo *blockdev_init(const char *file, QDict
*bs_opts,
Error **errp)
{
const char *buf;
- const char *serial;
int ro = 0;
int bdrv_flags = 0;
int on_read_error, on_write_error;
@@ -371,8 +370,6 @@ static DriveInfo *blockdev_init(const char *file, QDict
*bs_opts,
ro = qemu_opt_get_bool(opts, "read-only", 0);
copy_on_read = qemu_opt_get_bool(opts, "copy-on-read", false);
- serial = qemu_opt_get(opts, "serial");
-
if ((buf = qemu_opt_get(opts, "discard")) != NULL) {
if (bdrv_parse_discard_flags(buf, &bdrv_flags) != 0) {
error_setg(errp, "invalid discard option");
@@ -501,9 +498,6 @@ static DriveInfo *blockdev_init(const char *file, QDict
*bs_opts,
dinfo->bdrv->read_only = ro;
dinfo->bdrv->detect_zeroes = detect_zeroes;
dinfo->refcount = 1;
- if (serial != NULL) {
- dinfo->serial = g_strdup(serial);
- }
QTAILQ_INSERT_TAIL(&drives, dinfo, next);
bdrv_set_on_error(dinfo->bdrv, on_read_error, on_write_error);
@@ -630,6 +624,10 @@ QemuOptsList qemu_legacy_drive_opts = {
.type = QEMU_OPT_STRING,
.help = "pci address (virtio only)",
},{
+ .name = "serial",
+ .type = QEMU_OPT_STRING,
+ .help = "disk serial number",
+ },{
.name = "file",
.type = QEMU_OPT_STRING,
.help = "file name",
@@ -672,6 +670,7 @@ DriveInfo *drive_init(QemuOpts *all_opts,
BlockInterfaceType block_default_type)
const char *werror, *rerror;
bool read_only = false;
bool copy_on_read;
+ const char *serial;
const char *filename;
Error *local_err = NULL;
@@ -875,6 +874,9 @@ DriveInfo *drive_init(QemuOpts *all_opts,
BlockInterfaceType block_default_type)
goto fail;
}
+ /* Serial number */
+ serial = qemu_opt_get(legacy_opts, "serial");
+
/* no id supplied -> create one */
if (qemu_opts_id(all_opts) == NULL) {
char *new_id;
@@ -965,6 +967,8 @@ DriveInfo *drive_init(QemuOpts *all_opts,
BlockInterfaceType block_default_type)
dinfo->unit = unit_id;
dinfo->devaddr = devaddr;
+ dinfo->serial = g_strdup(serial);
+
switch(type) {
case IF_IDE:
case IF_SCSI:
@@ -2438,10 +2442,6 @@ QemuOptsList qemu_common_drive_opts = {
.type = QEMU_OPT_STRING,
.help = "disk format (raw, qcow2, ...)",
},{
- .name = "serial",
- .type = QEMU_OPT_STRING,
- .help = "disk serial number",
- },{
.name = "rerror",
.type = QEMU_OPT_STRING,
.help = "read error action",
--
1.9.3
- [Qemu-devel] [PULL 00/39] Block patches, Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 01/39] configure: Enable dead code (lzo, snappy, quorum), Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 02/39] block: Drop superfluous conditionals around g_free(), Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 03/39] blockdev: Move 'serial' option to drive_init(),
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 04/39] blockdev: Rename drive_init(), drive_uninit() to drive_new(), drive_del(), Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 05/39] blockdev: Remove unused DriveInfo reference count, Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 07/39] QemuOpts: move find_desc_by_name ahead for later calling, Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 06/39] block/nfs: fix potential segfault on early callback, Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 08/39] QemuOpts: repurpose qemu_opts_print to replace print_option_parameters, Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 09/39] QemuOpts: add def_value_str to QemuOptDesc, Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 10/39] qapi: output def_value_str when query command line options, Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 11/39] QemuOpts: change opt->name|str from (const char *) to (char *), Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 12/39] QemuOpts: move qemu_opt_del ahead for later calling, Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 13/39] QemuOpts: add qemu_opt_get_*_del functions for replace work, Stefan Hajnoczi, 2014/06/16