aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi-disk.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2010-05-27 20:02:28 +0200
committerKevin Wolf <kwolf@redhat.com>2010-07-06 17:05:49 +0200
commit620f862e1c3d0862923997c8d6632c5916da997c (patch)
treebbc7cfc1e33048a2e202342647fd486a5085d1ce /hw/scsi-disk.c
parentbd6c9a617d969752c9d3663f6ad29ae6d6d6c402 (diff)
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-disk.c')
-rw-r--r--hw/scsi-disk.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 3e41011ccb..c30709c550 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -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 (bdrv_get_on_error(s->bs, 1) != BLOCK_ERR_REPORT) {
+ error_report("Device doesn't support drive option rerror");
+ return -1;
+ }
+
if (!s->serial) {
/* try to fall back to value set with legacy -drive serial=... */
dinfo = drive_get_by_blockdev(s->bs);