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>
This commit is contained in:
parent
67c75f3dff
commit
9ef6e505f0
|
@ -2359,6 +2359,11 @@ static void scsi_hd_realize(SCSIDevice *dev, Error **errp)
|
||||||
static void scsi_cd_realize(SCSIDevice *dev, Error **errp)
|
static void scsi_cd_realize(SCSIDevice *dev, Error **errp)
|
||||||
{
|
{
|
||||||
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
|
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
|
||||||
|
|
||||||
|
if (!dev->conf.blk) {
|
||||||
|
dev->conf.blk = blk_new();
|
||||||
|
}
|
||||||
|
|
||||||
s->qdev.blocksize = 2048;
|
s->qdev.blocksize = 2048;
|
||||||
s->qdev.type = TYPE_ROM;
|
s->qdev.type = TYPE_ROM;
|
||||||
s->features |= 1 << SCSI_DISK_F_REMOVABLE;
|
s->features |= 1 << SCSI_DISK_F_REMOVABLE;
|
||||||
|
|
Loading…
Reference in New Issue