RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1525829 - can not boot up a scsi-block passthrough disk via -blockdev with error "cannot get SG_IO version number: Operation not supported. Is this a SCSI device?"
Summary: can not boot up a scsi-block passthrough disk via -blockdev with error "canno...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.5
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Kevin Wolf
QA Contact: CongLi
URL:
Whiteboard:
Depends On:
Blocks: 1782712
TreeView+ depends on / blocked
 
Reported: 2017-12-14 06:50 UTC by CongLi
Modified: 2019-12-12 08:07 UTC (History)
11 users (show)

Fixed In Version: qemu-kvm-rhev-2.12.0-8.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1782712 (view as bug list)
Environment:
Last Closed: 2018-11-01 11:04:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3443 0 None None None 2018-11-01 11:05:51 UTC

Description CongLi 2017-12-14 06:50:07 UTC
Description of problem:
can not boot up a scsi-block passthrough disk via -blockdev with error "cannot get SG_IO version number: Operation not supported.  Is this a SCSI device?" 

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.10.0-12.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. simulate a scsi disk on host:
# modprobe scsi_debug lbpu=1 dev_size_mb=1024
2. check the disk:
# lsscsi 
[0:0:0:0]    storage HP       P420i            7.02  -        
[0:1:0:0]    disk    HP       LOGICAL VOLUME   7.02  /dev/sda 
[3:0:0:0]    cd/dvd  hp       DVDRAM GT80N     EA02  /dev/sr0 
[16:0:0:0]   disk    Linux    scsi_debug       0004  /dev/sdb  
3. passthrough /dev/sdb to guest:
    -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=0x3 \
    -blockdev driver=raw,node-name=drive2,file.driver=file,file.filename=/dev/sdb \
    -device scsi-block,drive=drive2 \

Actual results:
can not boot up the disk via -blockdev with error:
QEMU 2.10.0 monitor - type 'help' for more information
(qemu) qemu-kvm: -device scsi-block,drive=drive2: cannot get SG_IO version number: Operation not supported.  Is this a SCSI device?

Expected results:
should boot up the scsi-block disk via -blockdev successfully

Additional info:
1. scsi-hd + -blockdev works well:
    -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=0x3 \
    -blockdev driver=raw,node-name=drive2,file.driver=file,file.filename=/dev/sdb \
    -device scsi-hd,drive=drive2 \

QEMU 2.10.0 monitor - type 'help' for more information
(qemu) q

2. -drive + scsi_block works well:
    -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=0x3 \
    -drive file=/dev/sdb,if=none,id=drive2,format=raw \
    -device scsi-block,drive=drive2 \

QEMU 2.10.0 monitor - type 'help' for more information
(qemu) q

Comment 2 Paolo Bonzini 2017-12-15 14:15:02 UTC
"-drive" with file.driver=file also doesn't work:

  -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=0x3 \
  -drive format=raw,if=none,id=drive2,file.driver=file,file.filename=/dev/sdc \
  -device scsi-block,drive=drive2

This is unintuitive behavior, and it's not documented anywhere, so we may want to add some workaround or improve the error message.  However, it is intended.  You are specifying "file.driver=file", and files are not SCSI devices. :)  It works with "file.driver=host_device", and that's what libvirt should specify.

Kevin, any ideas?

Comment 3 CongLi 2017-12-18 09:47:13 UTC
(In reply to Paolo Bonzini from comment #2)
> "-drive" with file.driver=file also doesn't work:
> 
>   -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=0x3 \
>   -drive
> format=raw,if=none,id=drive2,file.driver=file,file.filename=/dev/sdc \
>   -device scsi-block,drive=drive2
> 
> This is unintuitive behavior, and it's not documented anywhere, so we may
> want to add some workaround or improve the error message.  However, it is
> intended.  You are specifying "file.driver=file", and files are not SCSI
> devices. :)  It works with "file.driver=host_device", and that's what
> libvirt should specify.

Thanks Paolo for the explanation.
And it would be great that list all driver options in qemu-options.hx. :)

Comment 4 Kevin Wolf 2017-12-18 10:17:24 UTC
(In reply to Paolo Bonzini from comment #2)
> Kevin, any ideas?

Perhaps the file driver can print a warning if you don't give it a regular file? We could possibly even make it an error after a few releases.

Comment 6 Miroslav Rezanina 2018-07-24 14:08:46 UTC
Fix included in qemu-kvm-rhev-2.12.0-8.el7

Comment 8 CongLi 2018-08-01 08:43:10 UTC
Tested with qemu-kvm-rhev-2.12.0-8.el7.x86_64:

Test pass with iotest 226.

1.  driver: file
1.1 directory (/root/test is a directory)
qemu-kvm: -blockdev driver=raw,file.driver=file,node-name=drive2,file.filename=/root/test: Could not open '/root/test': Is a directory

1.2 host device (/dev/sdc is a host device)
qemu-kvm: -blockdev driver=raw,file.driver=file,node-name=drive2,file.filename=/dev/sdc: warning: Opening a block device as a file using the 'file' driver is deprecated

1.3 file --> successfully

2.  driver: host_device
2.1 directory (/root/test is a directory)
qemu-kvm: -blockdev driver=raw,file.driver=host_device,node-name=drive2,file.filename=/root/test: Could not open '/root/test': Is a directory

2.2 file
qemu-kvm: -blockdev driver=qcow2,file.driver=host_device,node-name=drive2,file.filename=/root/test.qcow2: 'host_device' driver expects either a character or block device

2.3 host device --> successfully

3. driver: host_cdrom
qemu-kvm: -blockdev driver=raw,file.driver=host_cdrom,node-name=drive2,file.filename=/root/test: Driver 'host_cdrom' is not whitelisted


Hi Kevin,

QE met 'Driver 'host_cdrom' is not whitelisted' error, I would like to confirm if QEMU downstream support it or it's a missing.

Thanks.

Comment 9 Fam Zheng 2018-08-01 09:20:10 UTC
host_cdrom is disabled on purpose in RHEL7. See also BZ 760885 and BZ 1077302.

Comment 10 CongLi 2018-08-01 10:30:00 UTC
(In reply to Fam Zheng from comment #9)
> host_cdrom is disabled on purpose in RHEL7. See also BZ 760885 and BZ
> 1077302.

Thanks Fam.

Based on comment 8 and comment 9, set this bug to 'VERIFIED'.

Comment 11 errata-xmlrpc 2018-11-01 11:04:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3443


Note You need to log in before you can comment on or make changes to this bug.