Bug 1021480

Summary: Can specify <serial> within type='lun' disk
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: libvirtAssignee: John Ferlan <jferlan>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: chayang, dyuan, eblake, fdelorey, jdenemar, juzhang, michen, mkenneth, mzhan, pbonzini, pzhang, qzhang, rbalakri, rpacheco, shyu, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.2.17-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1021483 (view as bug list) Environment:
Last Closed: 2015-11-19 05:44:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1021483, 1392746    

Description Sibiao Luo 2013-10-21 11:38:39 UTC
Description of problem:
scsi-block has no serial property because it uses the physical drive's serial number, the QEMU still can boot when specified the serial number for the scs-block drive.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm
2.6.32-424.el6.x86_64
qemu-kvm-0.12.1.2-2.414.el6.x86_64
guest info:
2.6.32-424.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.boot guest with specified serial number for scsi-block device.
e.g:...-drive file=/dev/disk/by-path/ip-10.66.90.100\:3260-iscsi-iqn.2001-05.com.equallogic\:0-8a0906-0971f7d03-1dff49b26885073d-s2-sluo-172259-lun-0,if=none,id=drive-data-disk,format=raw,aio=native -device virtio-scsi-pci,bus=pci.0,addr=0x7,id=scsi0,num_queues=4 -device scsi-block,drive=drive-data-disk,id=data-disk,bus=scsi0.0,*serial=sluo_disk*
qemu-kvm: -device scsi-block,drive=drive-data-disk,id=data-disk,bus=scsi0.0,serial=sluo_disk: Property 'scsi-block.serial' not found
2.boot guest with specified serial number for scsi-block drive.
e.g:...-drive file=/dev/disk/by-path/ip-10.66.90.100\:3260-iscsi-iqn.2001-05.com.equallogic\:0-8a0906-0971f7d03-1dff49b26885073d-s2-sluo-172259-lun-0,if=none,id=drive-data-disk,format=raw,aio=native,*serial=sluo_disk* -device virtio-scsi-pci,bus=pci.0,addr=0x7,id=scsi0,num_queues=4 -device scsi-block,drive=drive-data-disk,id=data-disk,bus=scsi0.0

Actual results:
after step 1, QEMU will quit with prompt message : Property 'scsi-block.serial' not found.
after step 2, it can boot up guest successfully.

Expected results:
QEMU should also disable specified the serial number for the scs-block drive.

Additional info:
# /usr/libexec/qemu-kvm -device scsi-block,?
scsi-block.drive=drive
scsi-block.bootindex=int32
scsi-block.channel=uint32
scsi-block.scsi-id=uint32
scsi-block.lun=uint32

Comment 2 Paolo Bonzini 2013-10-24 23:20:15 UTC
The serial property of -drive will be deprecated in RHEL7.  I don't think this bug is important enough to fix.

Please check that specifying a serial number with libvirt and type='lun' gives an error, though.

Comment 3 Sibiao Luo 2013-10-28 09:41:56 UTC
(In reply to Paolo Bonzini from comment #2)
> The serial property of -drive will be deprecated in RHEL7.  I don't think
> this bug is important enough to fix.
> 
> Please check that specifying a serial number with libvirt and type='lun'
> gives an error, though.
Also tried as your instructor but still can boot up guest without any error message prompt if specify a serial number with libvirt and type='lun', and the passthrough disk worked well in guest.

xml example:
...
<disk type='block' device='lun'>
      <driver name='qemu' type='raw' cache='none'/>
      <source dev='/dev/disk/by-path/ip-10.66.90.100:3260-iscsi-iqn.2001-05.com.equallogic:0-8a0906-6eb1f7d03-30cf49b25f24f94d-libvirt-1-150313-lun-0'/>
      <target dev='sdd' bus='scsi'/>
      <serial>WD-WMAP9A966149</serial>
      <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='0x08' function='0x0'/>
   </controller>
...

# ps axu | grep qemu-kvm
...-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x8 -drive file=/dev/disk/by-path/ip-10.66.90.100:3260-iscsi-iqn.2001-05.com.equallogic:0-8a0906-6eb1f7d03-30cf49b25f24f94d-libvirt-1-150313-lun-0,if=none,id=drive-scsi0-0-0-3,format=raw,serial=WD-WMAP9A966149,cache=none -device scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=3,drive=drive-scsi0-0-0-3,id=scsi0-0-0-3

Best Regards,
sluo

Comment 5 Jiri Denemark 2014-04-04 21:38:09 UTC
This bug was not selected to be addressed in Red Hat Enterprise Linux 6. We will look at it again within the Red Hat Enterprise Linux 7 product.

Comment 9 John Ferlan 2015-06-09 21:02:48 UTC
Guess I should have looked through this bug more closely a while ago...

Anyway, even though -serial was deprecated and providing it doesn't seem to harm anything, I've posted a patch upstream in order to cause an error from libvirt:

http://www.redhat.com/archives/libvir-list/2015-June/msg00388.html

Comment 10 John Ferlan 2015-06-15 11:33:17 UTC
Patch pushed upstream:

commit 4fce9e84798be1441d8bc5b96f0ed68589e85222
Author: John Ferlan <jferlan>
Date:   Tue Jun 9 16:49:00 2015 -0400

    qemu: Do not support 'serial' scsi-block 'lun' devices
      
    Seems the property has been deprecated for qemu, although seemingly ignored.
    
    This patch enforces from a libvirt perspective that a scsi-block 'lun'
    device should not provide the 'serial' property.

$ git describe 4fce9e84798be1441d8bc5b96f0ed68589e85222
v1.2.16-149-g4fce9e8

Comment 12 Pei Zhang 2015-08-18 03:50:46 UTC
I can reproduce it with libvirt-1.2.16-1.el7.x86_64. and verify it like following: 

verify version:
libvirt-1.2.17-5.el7.x86_64
qemu-kvm-rhev-2.3.0-18.el7.x86_64

verify steps:
check formatdomain.xml:
1.open 
file:///usr/share/doc/libvirt-docs-1.2.17/html/formatdomain.xml
serial
Not supported for scsi-block devices, that is those using disk type 'block' using device 'lun' on bus 'scsi'.

check define start and hot plug :
1.define start a guest has a scsi-block lun device with serial. 

# virsh dumpxml r708 | grep disk -A 8
 <disk type='block' device='lun'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/disk/by-path/ip-$IP:3260-iscsi-iqn.2008-09.5.165.3ffe.104:server.target3-lun-1'/>
      <target dev='sda' bus='scsi'/>
      <serial>WD-WMAP9A966149</serial>
      <address type='drive' controller='0' bus='0' target='3' unit='0'/>
    </disk>
#virsh start r708

error: Failed to start domain r708
error: unsupported configuration: scsi-block 'lun' devices do not support the serial property

2.hot plug  attach-disk / attach-device

2.1 prepare a disk xml like following :
# cat blk-lun-scsi.xml 
<disk type='block' device='lun'>
<driver name='qemu' type='raw'/>
<source dev='/dev/disk/by-path/ip-10.66.5.165:3260-iscsi-iqn.2008-09.5.165.3ffe.104:server.target3-lun-1'/>
<serial>WD-WMAP9A966149</serial>
<target dev='sda' bus='scsi'/>
<address type='drive' controller='0' bus='0' target='3' unit='0'/>
</disk>

# virsh attach-device r708 blk-lun-scsi.xml 
error: Failed to attach device from blk-lun-scsi.xml
error: unsupported configuration: scsi-block 'lun' devices do not support the serial property

2.2 attach-disk with --serial for scsi-block device.

#lsblk
......
sdc                                                   8:32   0    30G  0 disk  
...

# virsh attach-disk r708 /dev/sdc sdb --sourcetype block --type lun --targetbus scsi --serial WD-WMAP9A966149
error: Failed to attach disk
error: unsupported configuration: scsi-block 'lun' devices do not support the serial property

attach block-scsi 'disk' device is successful.
# virsh attach-disk r708 /dev/sdc sdb --sourcetype block --type disk --targetbus scsi --serial WD-WMAP9A966149
Disk attached successfully

now, scsi-block lun device do not support the serial property. move to verified.

Comment 14 errata-xmlrpc 2015-11-19 05:44: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://rhn.redhat.com/errata/RHBA-2015-2202.html

Comment 15 Eric Blake 2016-01-13 21:52:13 UTC
Now bug 1291930 is asking whether this tightening of the parse to reject something that was previously ignored is a regression. :(