diff options
author | Cornelia Huck <cohuck@redhat.com> | 2018-07-06 15:06:18 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2018-07-10 14:36:11 +0200 |
commit | 44e8b4689c6e3aba4df08a1201f02ac7bf3d2fdb (patch) | |
tree | 62015cc3b8e10be81be4ae78ba07eced8791b14c /hw/block | |
parent | 19a49c5637a3d7c2c61ba9d1149a4f6ee419988a (diff) | |
download | qemu-44e8b4689c6e3aba4df08a1201f02ac7bf3d2fdb.zip qemu-44e8b4689c6e3aba4df08a1201f02ac7bf3d2fdb.tar.gz qemu-44e8b4689c6e3aba4df08a1201f02ac7bf3d2fdb.tar.bz2 |
Revert "block: Remove deprecated -drive option serial"
This reverts commit b0083267444a5e0f28391f6c2831a539f878d424.
Hold off removing this for one more QEMU release (current libvirt
release still uses it.)
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/block')
-rw-r--r-- | hw/block/block.c | 13 | ||||
-rw-r--r-- | hw/block/nvme.c | 1 | ||||
-rw-r--r-- | hw/block/virtio-blk.c | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/hw/block/block.c b/hw/block/block.c index cf0eb82..b6c80ab 100644 --- a/hw/block/block.c +++ b/hw/block/block.c @@ -15,6 +15,19 @@ #include "qapi/qapi-types-block.h" #include "qemu/error-report.h" +void blkconf_serial(BlockConf *conf, char **serial) +{ + DriveInfo *dinfo; + + if (!*serial) { + /* try to fall back to value set with legacy -drive serial=... */ + dinfo = blk_legacy_dinfo(conf->blk); + if (dinfo) { + *serial = g_strdup(dinfo->serial); + } + } +} + void blkconf_blocksizes(BlockConf *conf) { BlockBackend *blk = conf->blk; diff --git a/hw/block/nvme.c b/hw/block/nvme.c index fc7dacb..5e508ab 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1217,6 +1217,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp) return; } + blkconf_serial(&n->conf, &n->serial); if (!n->serial) { error_setg(errp, "serial property not set"); return; diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 225fe44..50b5c86 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -935,6 +935,7 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp) return; } + blkconf_serial(&conf->conf, &conf->serial); if (!blkconf_apply_backend_options(&conf->conf, blk_is_read_only(conf->conf.blk), true, errp)) { |