Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save archerslaw/4e2167f0028383a480c7 to your computer and use it in GitHub Desktop.
Save archerslaw/4e2167f0028383a480c7 to your computer and use it in GitHub Desktop.
Test support maximum disks(Max pci-bridge devices number for rhel7) in one guest.
#Currently, support Max pci bridge devices number is 930.
#!/bin/sh
MACHINE=pc-i440fx-rhel7.0.0
MEM=20G
IMG=/home/xuhan/rhel7cp2.qcow2_v3
CLI="/usr/libexec/qemu-kvm -vga none -net none -M $MACHINE -smp 2,core=2,thread=1,socket=1 -m $MEM -name vm1 -vnc :1 -monitor stdio -device pci-bridge,chassis_nr=1,id=bridge0,addr=0x02 -drive file=$IMG,if=none,id=hd,format=qcow2,werror=stop,rerror=stop -device virtio-blk-pci,scsi=off,drive=hd,id=os-disk,bus=bridge0,addr=0x01,bootindex=1 -serial unix:/tmp/bridge-con,server,nowait"
while [ ${i:=1} -lt ${1:-0} ]
do
createBr=$((i%31))
bridgeId=$((i/31))
slotId=$((i%31+1))
if [ $createBr -eq 0 ]
then
CLI="$CLI -device pci-bridge,chassis_nr=$((bridgeId+1)),id=bridge$bridgeId,addr=0x$(printf "%02x" $((bridgeId+2)))"
fi
CLI="$CLI -drive file=/home/disk/disk$i,if=none,id=disk$i"
CLI="$CLI -device virtio-blk-pci,bus=bridge$bridgeId,drive=disk$i,id=blk$i,addr=0x$(printf "%02x" $slotId)"
((i++))
done
$CLI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment