mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-17 21:26:13 -07:00
ide scsi virtio-blk: Reject empty drives unless media is removable
Disks without media make no sense. For SCSI, a Linux guest kernel complains during boot. I didn't try other combinations. scsi-generic doesn't need the additional check, because it already requires bdrv_is_sg(), which fails without media. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
d75d25e34e
commit
98f28ad7a7
3 changed files with 13 additions and 0 deletions
|
|
@ -1059,6 +1059,11 @@ static int scsi_disk_initfn(SCSIDevice *dev)
|
|||
s->bs = s->qdev.conf.bs;
|
||||
is_cd = bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM;
|
||||
|
||||
if (!is_cd && !bdrv_is_inserted(s->bs)) {
|
||||
error_report("Device needs media, but drive is empty");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (bdrv_get_on_error(s->bs, 1) != BLOCK_ERR_REPORT) {
|
||||
error_report("Device doesn't support drive option rerror");
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue