Bug 1300919

Summary: Libvirt should check controller value in scsi disk address before attach device
Product: [Community] Virtualization Tools Reporter: Pei Zhang <pzhang>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED DEFERRED QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: crobinso, dyuan, mzhan, rbalakri, xuzhang, yisun
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-21 20:24:34 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:

Description Pei Zhang 2016-01-22 04:55:48 UTC
Description of problem:
Since now libvirt will add scsi controller automatically when attach a scsi disk, it should check the value of controller if it's useful before attach it.

Version-Release number of selected component (if applicable):
libvirt-1.3.2-1.fc24_v1.3.1_29_gdaeace5.x86_64

How reproducible:
100%

Steps to Reproduce:
1.prepare a scsi disk xml like following, the controller is a large value 100
# cat disk/iscsi/disk-net-auth-iscsi.xml
<disk type='network' device='lun' sgio='filtered'>
        <driver name='qemu' type='raw'/>
        <auth username='redhat'>
                <secret type='iscsi' usage='libvirtiscsi'/>
        </auth>
        <source protocol='iscsi' name='iqn.2008-09.5.165.3ffe.104:server.target3/1'>
                <host name='$IP' port='3260'/>
        </source>
        <target dev='sdb' bus='scsi'/>
        <address type='drive' controller='100' bus='0' target='0' unit='0'/>
</disk>

2. attach this disk to guest, fail to attach

# virsh attach-device fd23 disk/iscsi/disk-net-auth-iscsi.xml
error: Failed to attach device from disk/iscsi/disk-net-auth-iscsi.xml
error: internal error: No more available PCI slots

3. check guest xml, it already attached a lot of scsi controllers.

# virsh dumpxml fd23 | grep scsi
      <target dev='sde' bus='scsi'/>
      <alias name='scsi1-0-0'/>
    <controller type='scsi' index='0'>
      <alias name='scsi0'/>
    <controller type='scsi' index='1'>
      <alias name='scsi1'/>
    <controller type='scsi' index='2'>
      <alias name='scsi2'/>
......
   <controller type='scsi' index='23'>
      <alias name='scsi23'/>


Actual results:
As steps 2 and step 3, it fails to attach scsi disk but it attached a lot of scsi controllers.

Expected results:
Libvirt should check scsi disk address and limit the controller before attach device.

Additional info:

Comment 1 Cole Robinson 2016-04-21 20:24:34 UTC
Personally I think this is just one of those 'dont do that' situations :) it's so unlikely someone will hit this in practice that it's not worth tracking the bug or writing libvirt code to handle it IMO