Description of problem: If we try to attach the 256 Virtio-scsi [qcow2] drives it fails with an error as "error: Failed to attach disk" "error: internal error No more available PCI addresses" I reckon any linux machine supports 256 luns. Please refer to the below link: https://community.emc.com/thread/90269 I have checked this issue on rhel and sles guests. I could add only 214 devices and started getting from 215th lun: formatting '/home/images/virtio-scsi215.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off error: Failed to attach disk error: internal error No more available PCI addresses 26 scsi controllers were added for these 214 devices. <controller type='scsi' index='23'> <address type='pci' domain='0x0000' bus='0x00' slot='0x1c' function='0x0'/> </controller> <controller type='scsi' index='24'> <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0'/> </controller> <controller type='scsi' index='25'> <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/> </controller> <controller type='scsi' index='26'> <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/> </controller>
Script to create 256 volumes and attach to the guest. #################################################### #!/usr/bin/bash if [ x$1 != x ]; then cmd=$1 c=1 while [ $c -le 256 ] do qemu-img create -f qcow2 /home/virtio-scsi$c.qcow2 1G #sleep 1 i="`cat file | head -$c | tail -1`" virsh attach-disk $cmd /home/images/virtio-scsi$c.qcow2 $i --persistent --cache writethrough --sourcetype file --driver qemu --subdriver qcow2 #virsh detach-disk $cmd $i ((c++)) done else echo "enter the vm name" fi ####################################################
There's some more info here about scsi controller limitations: https://www.redhat.com/archives/libvir-list/2013-November/msg01122.html And FWIW running your script, but using virt-xml instead of virsh, works fine: Domain 'scsi-test' defined successfully. Disk #256 Domain 'scsi-test' defined successfully.