diff options
| author | Kevin Wolf <kwolf@redhat.com> | 2016-07-14 15:49:43 +0200 |
|---|---|---|
| committer | Kevin Wolf <kwolf@redhat.com> | 2016-09-05 19:06:47 +0200 |
| commit | 9ef6e505f00aaabfccd8f8b0f0685589a74e76ea (patch) | |
| tree | abd91069a02968f25d5c7002ed2ca4b73fae7418 /hw/scsi/scsi-disk.c | |
| parent | 67c75f3dff7fa7776781d93250e1d52f1b009a74 (diff) | |
| download | focaccia-qemu-9ef6e505f00aaabfccd8f8b0f0685589a74e76ea.tar.gz focaccia-qemu-9ef6e505f00aaabfccd8f8b0f0685589a74e76ea.zip | |
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/scsi-disk.c')
| -rw-r--r-- | hw/scsi/scsi-disk.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 836a1553ed..99c9d618da 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; |