OSDN Git Service

scsi: turn "is this a SCSI device?" into a conditional hint
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 21 Mar 2018 10:57:26 +0000 (11:57 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 26 Mar 2018 12:37:15 +0000 (14:37 +0200)
commit09c2c6ffda7f8f7c64869bc465c2d1715769ebae
tree10202e7c8d50c89815b3122878a3d12a147ff731
parentff82fab792cba01f29a700e4c4ac660753961fbb
scsi: turn "is this a SCSI device?" into a conditional hint

If the user does not have permissions to send ioctls to the device (due to
SELinux or cgroups, for example), the output can look like

qemu-kvm: -device scsi-block,drive=disk: cannot get SG_IO version number:
  Operation not permitted.  Is this a SCSI device?

but this is confusing because the ioctl was blocked _before_ the device
even received the SG_GET_VERSION_NUM ioctl.  Therefore, for EPERM errors
the suggestion should be eliminated.  To make that simpler, change the
code to use error_append_hint.

Reported-by: Ala Hino <ahino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/scsi/scsi-disk.c
hw/scsi/scsi-generic.c