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 1379196 - Provide proper error message if lun device + scsi bus does not work with qcow2 format
Summary: Provide proper error message if lun device + scsi bus does not work with qcow...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: Unspecified
OS: Unspecified
low
unspecified
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: lijuan men
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-26 02:41 UTC by Yang Yang
Modified: 2017-08-01 23:57 UTC (History)
9 users (show)

Fixed In Version: libvirt-2.5.0-1.el7
Doc Type: Bug Fix
Doc Text:
Cause: Incorrectly configured XML for disk device causes qemu error on start. Consequence: Domain would fail to start with QEMU error. Fix: Add a check for a disk configuration using a block, lun device and the scsi bus using a non raw format for the device. Result: Error message from libvirt is displayed: "disk device 'lun' using target 'scsi' must use 'raw' format"
Clone Of:
Environment:
Last Closed: 2017-08-01 17:16:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2017:1846 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2017-08-01 18:02:50 UTC

Description Yang Yang 2016-09-26 02:41:52 UTC
Description of problem:
QEMU error out when starting vm with lun device + qcow2 format + scsi bus. And the error message does not clear enough. Libvirt should provide proper error message if lun device + scsi bus does not work with qcow2 format

Version-Release number of selected component (if applicable):
libvirt-2.0.0-10.el7.x86_64
qemu-kvm-rhev-2.6.0-27.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. start vm with lun device + qcow2 format + scsi bus
<disk type='block' device='lun'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source dev='/dev/sdl'/>
      <target dev='sda' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

#virsh start vm1
error: Failed to start domain vm1
error: internal error: qemu unexpectedly closed the monitor: 2016-09-26T02:34:47.304915Z qemu-kvm: -device scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1: cannot get SG_IO version number: Operation not supported.  Is this a SCSI device?


2.
3.

Actual results:
Qemu error out when starting vm with lun device + qcow2 format + scsi bus

Expected results:
Libvirt provides proper error message if lun device + scsi bus does not work with qcow2 format

Additional info:

Comment 1 Laine Stump 2016-09-26 18:42:29 UTC
Paolo,

Was this always an illegal combination? Is it a requirement that the device be backed by real SCSI hardware in order for scsi=on to be useful?

Comment 2 Paolo Bonzini 2016-09-27 13:45:06 UTC
This is not scsi=on, it's using virtio-scsi.  This one has always been illegal (it wasn't illegal for virtio-blk SCSI support, and that's one reason why it was messy).

Comment 3 John Ferlan 2016-10-31 15:10:10 UTC
The following doesn't fail:

<disk type='block' device='lun'>
  <driver name='qemu' type='raw' cache='none'/>
  <source dev='/dev/sdi'/>
  <target dev='sda' bus='scsi'/>
  <address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='scsi' index='0' model='virtio-scsi'/>

... in a running VM:...

-drive file=/dev/sdi,format=raw,if=none,id=drive-scsi0-0-0-0,cache=none 
-device scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 
...

However, by just using a qcow2 formatted /dev/sdj - that is a failure...  

Yuck, makes an ugly libvirt check!

Comment 4 John Ferlan 2016-10-31 20:20:57 UTC
and of course I hit save too fast...

Using:

<disk type='block' device='lun'>
  <driver name='qemu' type='qcow2' cache='none'/>
  <source dev='/dev/sdj'/>
  <target dev='vdd' bus='virtio'/>
</disk>

succeeds as well. So that matches the virtio-blk comment.

Still, the question for Paolo is, would it be a "safe" assumption then to say that only "<driver ... type='raw'.../>" may be used when "<disk type='block' device='lun'> and "<target ... bus='scsi'/>" (IOW: 'scsi-block')? I see that qcow2 and qed certainly don't work. History on what can be used seems to be sparse and rather than continue to get bz's on "this format doesn't work", it just seems like a larger hammer is required.

In qemu format - does only 'raw' work for the following:

-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x9

-drive file=/dev/sdj,format=%s,if=none,id=drive=scsi0-0-0-0,cache=none

[where %s is raw, dir, bochs, cloop, dmg, iso, vpc, vdi, fat, vhd, ploop, cow, qcow, qcow2, qed, or vmdk]

-device scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0

Comment 5 Paolo Bonzini 2016-10-31 22:49:21 UTC
> would it be a "safe" assumption then to say that only "<driver ... 
> type='raw'.../>" may be used when "<disk type='block' device='lun'>
> and "<target ... bus='scsi'/>"

Yes, it's a safe assumption.  Anything else shouldn't start at all (for bus='scsi') or only starts because of historical reasons (for bus='virtio').

Comment 6 John Ferlan 2016-11-08 11:46:57 UTC
Patch posted upstream:

http://www.redhat.com/archives/libvir-list/2016-November/msg00388.html

and pushed after ACK:

$ git show
commit f694f3ff6bd8a94d71582adab669b0dcd1f7bfe5
Author: John Ferlan <jferlan>
Date:   Mon Oct 31 15:44:34 2016 -0400

    qemu: Only allow 'raw' format for scsi-block using virtio-scsi
    
...
    
    Add check in qemuCheckDiskConfig for an invalid combination
    of using the 'scsi' bus for a block 'lun' device and any disk
    source format other than 'raw'.

$ git describe f694f3ff6bd8a94d71582adab669b0dcd1f7bfe5
v2.4.0-29-gf694f3f
$

Comment 8 lijuan men 2017-02-21 09:11:02 UTC
verify the bug

version:
libvirt-3.0.0-1.el7.x86_64
qemu-kvm-rhev-2.8.0-3.el7.x86_64

steps:
1.prepare another partition in the host,such as sdb.
2.change the format of the partition as qcow2
#qemu-img convert /dev/sdb -O qcow2 /dev/sdb
3.start a guest with the xml:
...
 <disk type='block' device='lun'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source dev='/dev/sdb'/>
      <target dev='sdd' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='3'/>
    </disk>
...
  <controller type='scsi' index='0' model='virtio-scsi'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </controller>
...

# virsh start qq
error: Failed to start domain qq
error: unsupported configuration: disk device 'lun' using target 'scsi' must use 'raw' format

Comment 9 errata-xmlrpc 2017-08-01 17:16:43 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/RHEA-2017:1846

Comment 10 errata-xmlrpc 2017-08-01 23:57:38 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/RHEA-2017:1846


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