Bug 1801139

Summary: can't start two guests with passthrough of an iscsi lun with "shareable" element
Product: Red Hat Enterprise Linux 7 Reporter: gaojianan <jgao>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED ERRATA QA Contact: gaojianan <jgao>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.8CC: jdenemar, jen, jgao, jtomko, libvirt-maint, lmen, lmiksik, yisun
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-4.5.0-33.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-31 19:59:02 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:
Attachments:
Description Flags
Libvirtd log none

Description gaojianan 2020-02-10 10:50:25 UTC
Created attachment 1662115 [details]
Libvirtd log

Description of problem:
As subject

Version-Release number of selected component (if applicable):
libvirt-4.5.0-32.virtcov.el7.x86_64
qemu-kvm-rhev-2.12.0-44.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Prepare an iscsi server and login the target in the host
# iscsiadm -m session
tcp: [1] 10.66.85.243:3260,1 iqn.2015-01.com.fred:444 (non-flash)
tcp: [2] 10.66.85.243:3260,1 iqn.2016-03.com.virttest:logical-pool.target6 (non-flash)

# lsscsi
...
[5:0:0:0]    disk    LIO-ORG  device.logical-  4.0   /dev/sdc 

2.Passthrough the disk to two guests
For the 1st :
# cat attach.xml 
<hostdev managed="no" mode="subsystem" type="scsi">
<source>
<adapter name="scsi_host5" />
<address bus="0" target="0" unit="0" />
</source>
<shareable/>             --------------with shareable
</hostdev>

# virsh attach-device vm2 attach.xml                                                                                                                                                                         
Device attached successfully

For the 2nd with the same xml:
# virsh attach-device avocado-vt-vm1 attach.xml
error: Failed to attach device from attach.xml
error: Failed to read file '/dev/sdc': Value too large for defined data type

3.In the 2nd guest,you can also hit the issue by:
# virsh attach-device avocado-vt-vm1 attach.xml --config
Device attached successfully

# virsh start avocado-vt-vm1
error: Failed to start domain avocado-vt-vm1
error: Failed to read file '/dev/sdc': Value too large for defined data type

Actual results:
As step 2 and 3

Expected results:
The 2nd guest should be started without error

Additional info:

Comment 9 gaojianan 2020-02-14 11:22:35 UTC
Verified on:
libvirt-4.5.0-33.el7.x86_64
qemu-kvm-rhev-2.12.0-44.el7.x86_64

Sc1:hot-plug the device to two guests
1.Prepare an iscsi server and login the target in the host
# iscsiadm -m session
tcp: [1] 10.66.85.243:3260,1 iqn.2015-01.com.fred:444 (non-flash)
tcp: [2] 10.66.85.243:3260,1 iqn.2016-03.com.virttest:logical-pool.target6 (non-flash)

# lsscsi
...
[5:0:0:0]    disk    LIO-ORG  device.logical-  4.0   /dev/sdc 

2.Passthrough the disk to two guests
For the 1st :
# cat attach.xml 
<hostdev managed="no" mode="subsystem" type="scsi">
<source>
<adapter name="scsi_host5" />
<address bus="0" target="0" unit="0" />
</source>
<shareable/>             --------------with shareable
</hostdev>

# virsh attach-device vm2 attach.xml                                                                                                                                                                         
Device attached successfully

For the 2nd with the same xml:
# virsh attach-device avocado-vt-vm1 attach.xml
Device attached successfully

Login the guest ,the disk works well

Sc2:cold-plug the device to two guests:
# virsh attach-device avocado-vt-vm1 attach.xml --config 
Device attached successfully

# virsh attach-device vm2 attach.xml --config 
Device attached successfully

# virsh start vm2
Domain vm2 started

# virsh start avocado-vt-vm1 
Domain avocado-vt-vm1 started

and then detach the device and attach again,
# virsh detach-device vm2 attach.xml 
Device detached successfully

# virsh attach-device vm2 attach.xml 
Device attached successfully

Work as expected

Comment 12 errata-xmlrpc 2020-03-31 19:59:02 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-2020:1094