[pve-devel] [PATCH qemu-server] tests: add tests for various combinations of configs for usb

Dominik Csapak d.csapak at proxmox.com
Fri Nov 11 07:59:55 CET 2022


q35 + usb passthrough
q35 + usb3 passthrough
q35 + usb3 passthrough with new xhci controller
old machine type + new usb config error
old machine type + q35 + new usb config error
old ostype (w2k) + new usb config error

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 test/cfg2cmd/ostype-usb13-error.conf    | 13 ++++++++++
 test/cfg2cmd/q35-usb13-error.conf       | 14 +++++++++++
 test/cfg2cmd/q35-usb2.conf              | 13 ++++++++++
 test/cfg2cmd/q35-usb2.conf.cmd          | 31 ++++++++++++++++++++++++
 test/cfg2cmd/q35-usb3.conf              | 13 ++++++++++
 test/cfg2cmd/q35-usb3.conf.cmd          | 32 +++++++++++++++++++++++++
 test/cfg2cmd/qemu-xhci-q35-7.1.conf     | 12 ++++++++++
 test/cfg2cmd/qemu-xhci-q35-7.1.conf.cmd | 29 ++++++++++++++++++++++
 test/cfg2cmd/usb13-error.conf           | 13 ++++++++++
 9 files changed, 170 insertions(+)
 create mode 100644 test/cfg2cmd/ostype-usb13-error.conf
 create mode 100644 test/cfg2cmd/q35-usb13-error.conf
 create mode 100644 test/cfg2cmd/q35-usb2.conf
 create mode 100644 test/cfg2cmd/q35-usb2.conf.cmd
 create mode 100644 test/cfg2cmd/q35-usb3.conf
 create mode 100644 test/cfg2cmd/q35-usb3.conf.cmd
 create mode 100644 test/cfg2cmd/qemu-xhci-q35-7.1.conf
 create mode 100644 test/cfg2cmd/qemu-xhci-q35-7.1.conf.cmd
 create mode 100644 test/cfg2cmd/usb13-error.conf

diff --git a/test/cfg2cmd/ostype-usb13-error.conf b/test/cfg2cmd/ostype-usb13-error.conf
new file mode 100644
index 0000000..5c75b62
--- /dev/null
+++ b/test/cfg2cmd/ostype-usb13-error.conf
@@ -0,0 +1,13 @@
+# TEST: Test error for old ostype type with newer usb config
+# QEMU_VERSION: 7.1.0
+# EXPECT_ERROR: using usb13 is only possible with machine type >= 7.1 and ostype l26 or windows > 7
+cores: 2
+memory: 768
+name: q35-usb3-error
+net0: virtio=A2:C0:43:77:08:A1,bridge=vmbr0
+ostype: w2k
+scsihw: virtio-scsi-pci
+smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465
+vmgenid: c773c261-d800-4348-9f5d-167fadd53cf8
+vga: qxl
+usb13: spice
diff --git a/test/cfg2cmd/q35-usb13-error.conf b/test/cfg2cmd/q35-usb13-error.conf
new file mode 100644
index 0000000..a9c25eb
--- /dev/null
+++ b/test/cfg2cmd/q35-usb13-error.conf
@@ -0,0 +1,14 @@
+# TEST: Test usb error for q35 and older machine type
+# QEMU_VERSION: 4.0.0
+# EXPECT_ERROR: using usb13 is only possible with machine type >= 7.1 and ostype l26 or windows > 7
+cores: 2
+memory: 768
+name: q35-usb3-error
+net0: virtio=A2:C0:43:77:08:A1,bridge=vmbr0
+ostype: l26
+machine: q35
+scsihw: virtio-scsi-pci
+smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465
+vmgenid: c773c261-d800-4348-9f5d-167fadd53cf8
+vga: qxl
+usb13: spice
diff --git a/test/cfg2cmd/q35-usb2.conf b/test/cfg2cmd/q35-usb2.conf
new file mode 100644
index 0000000..4d9b28a
--- /dev/null
+++ b/test/cfg2cmd/q35-usb2.conf
@@ -0,0 +1,13 @@
+# TEST: Test Q35 USB2 passthrough combination
+# QEMU_VERSION: 4.0.0
+cores: 2
+memory: 768
+name: q35-usb2
+net0: virtio=A2:C0:43:77:08:A1,bridge=vmbr0
+ostype: l26
+machine: q35
+scsihw: virtio-scsi-pci
+smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465
+vmgenid: c773c261-d800-4348-9f5d-167fadd53cf8
+vga: qxl
+usb1: spice
diff --git a/test/cfg2cmd/q35-usb2.conf.cmd b/test/cfg2cmd/q35-usb2.conf.cmd
new file mode 100644
index 0000000..825f27f
--- /dev/null
+++ b/test/cfg2cmd/q35-usb2.conf.cmd
@@ -0,0 +1,31 @@
+/usr/bin/kvm \
+  -id 8006 \
+  -name 'q35-usb2,debug-threads=on' \
+  -no-shutdown \
+  -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \
+  -mon 'chardev=qmp,mode=control' \
+  -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5' \
+  -mon 'chardev=qmp-event,mode=control' \
+  -pidfile /var/run/qemu-server/8006.pid \
+  -daemonize \
+  -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \
+  -smp '2,sockets=1,cores=2,maxcpus=2' \
+  -nodefaults \
+  -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \
+  -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+  -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \
+  -m 768 \
+  -readconfig /usr/share/qemu-server/pve-q35-4.0.cfg \
+  -device 'vmgenid,guid=c773c261-d800-4348-9f5d-167fadd53cf8' \
+  -chardev 'spicevmc,id=usbredirchardev1,name=usbredir' \
+  -device 'usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=ehci.0' \
+  -device 'qxl-vga,id=vga,bus=pcie.0,addr=0x1' \
+  -device 'virtio-serial,id=spice,bus=pci.0,addr=0x9' \
+  -chardev 'spicevmc,id=vdagent,name=vdagent' \
+  -device 'virtserialport,chardev=vdagent,name=com.redhat.spice.0' \
+  -spice 'tls-port=61000,addr=127.0.0.1,tls-ciphers=HIGH,seamless-migration=on' \
+  -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \
+  -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
+  -netdev 'type=tap,id=net0,ifname=tap8006i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' \
+  -device 'virtio-net-pci,mac=A2:C0:43:77:08:A1,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300' \
+  -machine 'type=q35'
diff --git a/test/cfg2cmd/q35-usb3.conf b/test/cfg2cmd/q35-usb3.conf
new file mode 100644
index 0000000..1046e0e
--- /dev/null
+++ b/test/cfg2cmd/q35-usb3.conf
@@ -0,0 +1,13 @@
+# TEST: Test Q35 USB3 passthrough combination
+# QEMU_VERSION: 4.0.0
+cores: 2
+memory: 768
+name: q35-usb3
+net0: virtio=A2:C0:43:77:08:A1,bridge=vmbr0
+ostype: l26
+machine: q35
+scsihw: virtio-scsi-pci
+smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465
+vmgenid: c773c261-d800-4348-9f5d-167fadd53cf8
+vga: qxl
+usb1: spice,usb3=1
diff --git a/test/cfg2cmd/q35-usb3.conf.cmd b/test/cfg2cmd/q35-usb3.conf.cmd
new file mode 100644
index 0000000..956481f
--- /dev/null
+++ b/test/cfg2cmd/q35-usb3.conf.cmd
@@ -0,0 +1,32 @@
+/usr/bin/kvm \
+  -id 8006 \
+  -name 'q35-usb3,debug-threads=on' \
+  -no-shutdown \
+  -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \
+  -mon 'chardev=qmp,mode=control' \
+  -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5' \
+  -mon 'chardev=qmp-event,mode=control' \
+  -pidfile /var/run/qemu-server/8006.pid \
+  -daemonize \
+  -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \
+  -smp '2,sockets=1,cores=2,maxcpus=2' \
+  -nodefaults \
+  -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \
+  -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+  -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \
+  -m 768 \
+  -readconfig /usr/share/qemu-server/pve-q35-4.0.cfg \
+  -device 'vmgenid,guid=c773c261-d800-4348-9f5d-167fadd53cf8' \
+  -device 'nec-usb-xhci,id=xhci,bus=pci.1,addr=0x1b' \
+  -chardev 'spicevmc,id=usbredirchardev1,name=usbredir' \
+  -device 'usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=xhci.0' \
+  -device 'qxl-vga,id=vga,bus=pcie.0,addr=0x1' \
+  -device 'virtio-serial,id=spice,bus=pci.0,addr=0x9' \
+  -chardev 'spicevmc,id=vdagent,name=vdagent' \
+  -device 'virtserialport,chardev=vdagent,name=com.redhat.spice.0' \
+  -spice 'tls-port=61000,addr=127.0.0.1,tls-ciphers=HIGH,seamless-migration=on' \
+  -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \
+  -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
+  -netdev 'type=tap,id=net0,ifname=tap8006i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' \
+  -device 'virtio-net-pci,mac=A2:C0:43:77:08:A1,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300' \
+  -machine 'type=q35'
diff --git a/test/cfg2cmd/qemu-xhci-q35-7.1.conf b/test/cfg2cmd/qemu-xhci-q35-7.1.conf
new file mode 100644
index 0000000..40a5901
--- /dev/null
+++ b/test/cfg2cmd/qemu-xhci-q35-7.1.conf
@@ -0,0 +1,12 @@
+# TEST: Test Q35 USB passthrough combination with qemu-xhci
+# QEMU_VERSION: 7.1.0
+cores: 2
+memory: 768
+name: q35-qemu-xhci
+net0: virtio=A2:C0:43:77:08:A1,bridge=vmbr0
+ostype: l26
+machine: pc-q35-7.1
+scsihw: virtio-scsi-pci
+smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465
+vmgenid: c773c261-d800-4348-9f5d-167fadd53cf8
+usb1: spice
diff --git a/test/cfg2cmd/qemu-xhci-q35-7.1.conf.cmd b/test/cfg2cmd/qemu-xhci-q35-7.1.conf.cmd
new file mode 100644
index 0000000..1c9f7d5
--- /dev/null
+++ b/test/cfg2cmd/qemu-xhci-q35-7.1.conf.cmd
@@ -0,0 +1,29 @@
+/usr/bin/kvm \
+  -id 8006 \
+  -name 'q35-qemu-xhci,debug-threads=on' \
+  -no-shutdown \
+  -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \
+  -mon 'chardev=qmp,mode=control' \
+  -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5' \
+  -mon 'chardev=qmp-event,mode=control' \
+  -pidfile /var/run/qemu-server/8006.pid \
+  -daemonize \
+  -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \
+  -smp '2,sockets=1,cores=2,maxcpus=2' \
+  -nodefaults \
+  -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \
+  -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+  -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \
+  -m 768 \
+  -readconfig /usr/share/qemu-server/pve-q35-4.0.cfg \
+  -device 'vmgenid,guid=c773c261-d800-4348-9f5d-167fadd53cf8' \
+  -device 'qemu-xhci,p2=15,p3=15,id=xhci,bus=pci.1,addr=0x1b' \
+  -device 'usb-tablet,id=tablet,bus=ehci.0,port=1' \
+  -chardev 'spicevmc,id=usbredirchardev1,name=usbredir' \
+  -device 'usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=xhci.0,port=2' \
+  -device 'VGA,id=vga,bus=pcie.0,addr=0x1' \
+  -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \
+  -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
+  -netdev 'type=tap,id=net0,ifname=tap8006i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' \
+  -device 'virtio-net-pci,mac=A2:C0:43:77:08:A1,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300' \
+  -machine 'type=pc-q35-7.1+pve0'
diff --git a/test/cfg2cmd/usb13-error.conf b/test/cfg2cmd/usb13-error.conf
new file mode 100644
index 0000000..48dedc3
--- /dev/null
+++ b/test/cfg2cmd/usb13-error.conf
@@ -0,0 +1,13 @@
+# TEST: Test error for old machine type with newer usb config
+# QEMU_VERSION: 4.0.0
+# EXPECT_ERROR: using usb13 is only possible with machine type >= 7.1 and ostype l26 or windows > 7
+cores: 2
+memory: 768
+name: q35-usb3-error
+net0: virtio=A2:C0:43:77:08:A1,bridge=vmbr0
+ostype: l26
+scsihw: virtio-scsi-pci
+smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465
+vmgenid: c773c261-d800-4348-9f5d-167fadd53cf8
+vga: qxl
+usb13: spice
-- 
2.30.2






More information about the pve-devel mailing list