Bug 1656362

Summary: when <shareable/> removed from scsi hostdev xml, related chardev's unpriv_sgio not set back to zero.
Product: Red Hat Enterprise Linux 8 Reporter: yisun
Component: libvirtAssignee: John Ferlan <jferlan>
Status: CLOSED CURRENTRELEASE QA Contact: yisun
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: dyuan, dzheng, jdenemar, jen, jferlan, jsuchane, knoel, lmen, rbalakri, wchadwic, xuzhang, yisun
Target Milestone: rcFlags: rule-engine: mirror+
Target Release: 8.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-4.5.0-17.el8 Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: 1656360 Environment:
Last Closed: 2019-06-14 00:53:15 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: 1582424, 1631733, 1656360    
Bug Blocks:    

Comment 7 yisun 2019-01-08 10:57:58 UTC
Verified with:
kernel-4.18.0-58.el8.x86_64
libvirt-4.5.0-17.module+el8+2625+db702f9d.x86_64

1. having a scsi device on host:
[root@dell-per730-58 device]# lsscsi
...
[5:0:0:0]    disk    IBM      2145             0000  /dev/sdb 
...

[root@dell-per730-58 device]# pwd
/sys/block/sdb/device


2. add following xml to vm:
[root@dell-per730-58 device]# virsh dumpxml avocado-vt-vm1 | grep hostdev -A10
    <hostdev mode='subsystem' type='scsi' managed='no' sgio='unfiltered'>
      <source>
        <adapter name='scsi_host5'/>
        <address bus='0' target='0' unit='0'/>
      </source>
      <shareable/>
      <alias name='hostdev0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </hostdev>

3. start the vm and check the unpriv_sgio value for sdb
[root@dell-per730-58 device]# virsh start avocado-vt-vm1
Domain avocado-vt-vm1 started

[root@dell-per730-58 device]# cat unpriv_sgio 
1

4. remove the <shareable/> tag in hostdev xml, destroy and start the vm again
[root@dell-per730-58 device]# virsh destroy avocado-vt-vm1
Domain avocado-vt-vm1 destroyed

[root@dell-per730-58 device]# virsh edit avocado-vt-vm1
...
    <hostdev mode='subsystem' type='scsi' managed='no' sgio='unfiltered'>
      <source>
        <adapter name='scsi_host5'/>
        <address bus='0' target='0' unit='0'/>
      </source>
      <alias name='hostdev0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </hostdev>
...

[root@dell-per730-58 device]# virsh start avocado-vt-vm1
Domain avocado-vt-vm1 started

[root@dell-per730-58 device]# cat unpriv_sgio 
0
<===== changed back to 0 when <shareable/> removed, this is expected.