Skip to content

Commit

Permalink
scsi: scsi-cd without drive property for empty drive
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kevmw committed Sep 5, 2016
1 parent 67c75f3 commit 9ef6e50
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hw/scsi/scsi-disk.c
Expand Up @@ -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;
Expand Down

0 comments on commit 9ef6e50

Please sign in to comment.