Skip to content

Commit

Permalink
Provide usbs into VMs
Browse files Browse the repository at this point in the history
In order to test usb pass-through we need
few usb devices available in the VM.

Signed-off-by: L. Pivarc <[email protected]>
  • Loading branch information
xpivarc committed Apr 6, 2023
1 parent 054c0ed commit 424b6a0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cluster-provision/centos9/scripts/vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ for size in ${SCSI_DISK_SIZES[@]}; do
let "disk_num+=1"
done

echo "Creating 3 usb disk"
for i in {1..3}; do
diskPath="/usb"${i}".img"
qemu-img create -f raw $diskPath 20M
done

exec qemu-system-x86_64 -enable-kvm -drive format=qcow2,file=${next},if=virtio,cache=unsafe ${block_dev_arg} \
-device virtio-net-pci,netdev=network0,mac=52:55:00:d1:55:${n} \
-netdev tap,id=network0,ifname=tap${n},script=no,downscript=no \
Expand All @@ -151,5 +157,10 @@ exec qemu-system-x86_64 -enable-kvm -drive format=qcow2,file=${next},if=virtio,c
-vnc :${n} -cpu host,migratable=no,+invtsc -m ${MEMORY} -smp ${CPU} \
-serial pty -M q35,accel=kvm,kernel_irqchip=split \
-device intel-iommu,intremap=on,caching-mode=on -device intel-hda -device hda-duplex -device AC97 \
-device qemu-xhci,id=bus1 -device qemu-xhci,id=bus2 \
-drive if=none,id=stick1,format=raw,file=/usb1.img -drive if=none,id=stick2,format=raw,file=/usb2.img \
-drive if=none,id=stick3,format=raw,file=/usb3.img \
-device usb-storage,bus=bus1.0,drive=stick1 -device usb-storage,bus=bus1.0,drive=stick2 \
-device usb-storage,bus=bus2.0,drive=stick3 \
-uuid $(cat /proc/sys/kernel/random/uuid) \
${QEMU_ARGS}

0 comments on commit 424b6a0

Please sign in to comment.