From: Paolo Bonzini <pbonzini@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] scsi: turn "is this a SCSI device?" into a conditional hint
Date: Wed, 21 Mar 2018 13:27:53 +0100 [thread overview]
Message-ID: <8f27a973-3ac1-b0b9-626f-dbde7bf67421@redhat.com> (raw)
In-Reply-To: <0b772d6c-d0df-f466-053e-29f0304ad52a@redhat.com>
On 21/03/2018 13:17, Laurent Vivier wrote:
> On 21/03/2018 11:58, Paolo Bonzini wrote:
>> 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>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>> hw/scsi/scsi-disk.c | 7 ++++---
>> hw/scsi/scsi-generic.c | 7 ++++---
>> 2 files changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
>> index 94043ed024..ccc245589a 100644
>> --- a/hw/scsi/scsi-disk.c
>> +++ b/hw/scsi/scsi-disk.c
>> @@ -2637,9 +2637,10 @@ static void scsi_block_realize(SCSIDevice *dev, Error **errp)
>> /* check we are using a driver managing SG_IO (version 3 and after) */
>> rc = blk_ioctl(s->qdev.conf.blk, SG_GET_VERSION_NUM, &sg_version);
>> if (rc < 0) {
>> - error_setg(errp, "cannot get SG_IO version number: %s. "
>> - "Is this a SCSI device?",
>> - strerror(-rc));
>> + error_setg(errp, "cannot get SG_IO version number: %s", strerror(-rc));
>
>
> You could use:
>
> error_setg_errno(errp, -rc, "cannot get SG_IO version number");
Nice, thanks. Will do.
Paolo
next prev parent reply other threads:[~2018-03-21 12:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-21 10:58 [Qemu-devel] [PATCH] scsi: turn "is this a SCSI device?" into a conditional hint Paolo Bonzini
2018-03-21 12:17 ` Laurent Vivier
2018-03-21 12:27 ` Paolo Bonzini [this message]
2018-03-21 12:35 ` Eric Blake
2018-03-22 2:12 ` Fam Zheng
-- strict thread matches above, loose matches on Subject: below --
2018-03-21 12:54 Paolo Bonzini
2018-03-21 12:55 ` Laurent Vivier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8f27a973-3ac1-b0b9-626f-dbde7bf67421@redhat.com \
--to=pbonzini@redhat.com \
--cc=lvivier@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).