From 9ef6e505f00aaabfccd8f8b0f0685589a74e76ea Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 14 Jul 2016 15:49:43 +0200 Subject: [PATCH] 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 Reviewed-by: Eric Blake --- hw/scsi/scsi-disk.c | 5 +++++ 1 file changed, 5 insertions(+) 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;