Created
May 5, 2014 03:20
-
-
Save archerslaw/1b0151b776a834df3ef5 to your computer and use it in GitHub Desktop.
Support Maximum pcie devices(256)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
MACHINE=q35 | |
SMP=4,cores=2,threads=2,sockets=1 | |
MEM=2G | |
GUEST_IMG=/home/RHEL7.0.raw | |
IMG_FORMAT=raw | |
CLI="/usr/libexec/qemu-kvm -enable-kvm -M $MACHINE -smp $SMP -m $MEM -name vm1 -drive file=$GUEST_IMG,if=none,id=guest-img,format=$GUEST_IMG,werror=stop,rerror=stop -device ide-hd,drive=guest-img,bus=ide.0,unit=0,id=os-disk,bootindex=1 -spice port=5931,disable-ticketing -vga qxl -monitor stdio -qmp tcp:0:6666,server,nowait -boot menu=on" | |
while [ ${i:=0} -lt ${1:-0} ] | |
do | |
dstreamId=$((i)) | |
ustreamId=$((dstreamId/32)) | |
chassisId=$((dstreamId+1)) | |
blkDiskId=$((dstreamId)) | |
if [ $((dstreamId%32)) -eq 0 ] | |
then | |
CLI="$CLI -device ioh3420,bus=pcie.0,id=root.$ustreamId,slot=$ustreamId" | |
CLI="$CLI -device x3130-upstream,bus=root.$ustreamId,id=upstream$ustreamId" | |
fi | |
CLI="$CLI -device xio3130-downstream,bus=upstream$ustreamId,id=downstream$dstreamId,chassis=$chassisId" | |
CLI="$CLI -drive file=/home/disk/disk$blkDiskId,if=none,id=disk$blkDiskId,format=qcow2 " | |
CLI="$CLI -device virtio-blk-pci,scsi=off,drive=disk$blkDiskId,id=virtio-blk$blkDiskId,bus=downstream$dstreamId" | |
i=$((i+1)) | |
done | |
$CLI |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment