summaryrefslogtreecommitdiffstats
path: root/hw/scsi-generic.c
diff options
context:
space:
mode:
authorMarkus Armbruster2010-05-27 20:02:28 +0200
committerKevin Wolf2010-07-06 17:05:49 +0200
commit620f862e1c3d0862923997c8d6632c5916da997c (patch)
treebbc7cfc1e33048a2e202342647fd486a5085d1ce /hw/scsi-generic.c
parentqdev: Don't hw_error() in qdev_init_nofail() (diff)
downloadqemu-620f862e1c3d0862923997c8d6632c5916da997c.tar.gz
qemu-620f862e1c3d0862923997c8d6632c5916da997c.tar.xz
qemu-620f862e1c3d0862923997c8d6632c5916da997c.zip
scsi: Reject unimplemented error actions
drive_init() doesn't permit rerror for if=scsi, but that's worthless: we get it via if=none and -device. Moreover, scsi-generic doesn't support werror. Since drive_init() doesn't catch that, option werror was silently ignored even with if=scsi. Wart: unlike drive_init(), we don't reject the default action when it's explicitly specified. That's because we can't distinguish "no rerror option" from "rerror=report", or "no werror" from "rerror=enospc". Left for another day. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/scsi-generic.c')
-rw-r--r--hw/scsi-generic.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index 3915e7844e..a8b4176d80 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -474,6 +474,15 @@ static int scsi_generic_initfn(SCSIDevice *dev)
return -1;
}
+ if (bdrv_get_on_error(s->bs, 0) != BLOCK_ERR_STOP_ENOSPC) {
+ error_report("Device doesn't support drive option werror");
+ return -1;
+ }
+ if (bdrv_get_on_error(s->bs, 1) != BLOCK_ERR_REPORT) {
+ error_report("Device doesn't support drive option rerror");
+ return -1;
+ }
+
/* check we are using a driver managing SG_IO (version 3 and after */
if (bdrv_ioctl(s->bs, SG_GET_VERSION_NUM, &sg_version) < 0 ||
sg_version < 30000) {