aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-07-14 15:49:43 +0200
committerKevin Wolf <kwolf@redhat.com>2016-09-05 19:06:47 +0200
commit9ef6e505f00aaabfccd8f8b0f0685589a74e76ea (patch)
treeabd91069a02968f25d5c7002ed2ca4b73fae7418 /hw/scsi
parent67c75f3dff7fa7776781d93250e1d52f1b009a74 (diff)
downloadqemu-9ef6e505f00aaabfccd8f8b0f0685589a74e76ea.zip
qemu-9ef6e505f00aaabfccd8f8b0f0685589a74e76ea.tar.gz
qemu-9ef6e505f00aaabfccd8f8b0f0685589a74e76ea.tar.bz2
scsi: scsi-cd without drive property for empty drive
This allows the creation of an empty scsi-cd device without manually creating a BlockBackend. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'hw/scsi')
-rw-r--r--hw/scsi/scsi-disk.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 836a155..99c9d61 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -2359,6 +2359,11 @@ static void scsi_hd_realize(SCSIDevice *dev, Error **errp)
static void scsi_cd_realize(SCSIDevice *dev, Error **errp)
{
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
+
+ if (!dev->conf.blk) {
+ dev->conf.blk = blk_new();
+ }
+
s->qdev.blocksize = 2048;
s->qdev.type = TYPE_ROM;
s->features |= 1 << SCSI_DISK_F_REMOVABLE;