aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2014-04-16 10:09:16 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2014-04-28 12:09:12 +0200
commit4bbeb8b173e8116851d5ececb93189ae34c68309 (patch)
tree9ab401a8e35de733d178908c2a8d1ca0d8bf4754 /hw/scsi
parent411f491e0af173cf8f39347574941bd26fbae381 (diff)
scsi-disk: Improve error messager if can't get version number
More often it is that bdrv_ioctl fails due to not supported by driver or whatever reason, in this case we should be specific, because "interface too old" is very confusing. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi')
-rw-r--r--hw/scsi/scsi-disk.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 48a28ae199..d2e532e0ee 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -2463,8 +2463,13 @@ static int scsi_block_initfn(SCSIDevice *dev)
}
/* check we are using a driver managing SG_IO (version 3 and after) */
- if (bdrv_ioctl(s->qdev.conf.bs, SG_GET_VERSION_NUM, &sg_version) < 0 ||
- sg_version < 30000) {
+ rc = bdrv_ioctl(s->qdev.conf.bs, SG_GET_VERSION_NUM, &sg_version);
+ if (rc < 0) {
+ error_report("scsi-block: can not get version number: %s",
+ strerror(-rc));
+ return -1;
+ }
+ if (sg_version < 30000) {
error_report("scsi-block: scsi generic interface too old");
return -1;
}