[libvirt PATCH 0/4] Validate spice features without spice graphics

Without spice graphics non of the spicevmc, spiceport and spice audiodev do not make sense. We could also check if the QEMU supports spice, but that check would be a redundant check, which is redundant. Martin Kletzander (4): Remove serial-spiceport-nospice test tests: Adjust for invalid qemu command combinations conf: Add virDomainDefHasSpiceGraphics qemu: Disable spice-related devices without spice graphics src/conf/domain_conf.c | 14 ++++++ src/conf/domain_conf.h | 3 ++ src/libvirt_private.syms | 1 + src/qemu/qemu_validate.c | 34 ++++++++++---- .../audio-spice-best.x86_64-4.1.0.args | 3 +- .../audio-spice-best.x86_64-latest.args | 3 +- tests/qemuxml2argvdata/audio-spice-best.xml | 7 +++ .../audio-spice-full.x86_64-latest.args | 3 +- tests/qemuxml2argvdata/audio-spice-full.xml | 7 +++ .../audio-spice-minimal.x86_64-4.1.0.args | 3 +- .../audio-spice-minimal.x86_64-latest.args | 3 +- .../qemuxml2argvdata/audio-spice-minimal.xml | 7 +++ .../channel-virtio-default.args | 9 ++-- .../channel-virtio-default.xml | 1 + .../serial-spiceport-nospice.args | 33 ------------- ...erial-spiceport-nospice.x86_64-latest.args | 37 --------------- .../serial-spiceport-nospice.xml | 37 --------------- .../smartcard-passthrough-spicevmc.args | 7 +-- .../smartcard-passthrough-spicevmc.xml | 1 + tests/qemuxml2argvdata/usb-redir-boot.args | 7 +-- tests/qemuxml2argvdata/usb-redir-boot.xml | 1 + .../usb-redir-filter-version.args | 7 +-- .../usb-redir-filter-version.xml | 1 + tests/qemuxml2argvdata/usb-redir-filter.args | 7 +-- tests/qemuxml2argvdata/usb-redir-filter.xml | 1 + tests/qemuxml2argvdata/usb-redir.args | 7 +-- tests/qemuxml2argvdata/usb-redir.xml | 1 + tests/qemuxml2argvtest.c | 21 +++++---- .../serial-spiceport-nospice.xml | 47 ------------------- .../smartcard-passthrough-spicevmc.xml | 11 ++++- .../usb-redir-filter-version.xml | 11 ++++- tests/qemuxml2xmloutdata/usb-redir-filter.xml | 11 ++++- tests/qemuxml2xmloutdata/usb-redir.xml | 11 ++++- tests/qemuxml2xmltest.c | 31 ++++++++---- 34 files changed, 178 insertions(+), 210 deletions(-) delete mode 100644 tests/qemuxml2argvdata/serial-spiceport-nospice.args delete mode 100644 tests/qemuxml2argvdata/serial-spiceport-nospice.x86_64-latest.args delete mode 100644 tests/qemuxml2argvdata/serial-spiceport-nospice.xml delete mode 100644 tests/qemuxml2xmloutdata/serial-spiceport-nospice.xml -- 2.35.1

This old test was added by me to allow people to keep the spicevmc channel while changing graphics type from spice to something else. However we do not do this in other places and also now we have all the Validate functions so it is better to show the user they will not have the spicevmc channel available rather than simply not formatting it on the qemu command line. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- .../serial-spiceport-nospice.args | 33 ------------- ...erial-spiceport-nospice.x86_64-latest.args | 37 --------------- .../serial-spiceport-nospice.xml | 37 --------------- tests/qemuxml2argvtest.c | 2 - .../serial-spiceport-nospice.xml | 47 ------------------- tests/qemuxml2xmltest.c | 1 - 6 files changed, 157 deletions(-) delete mode 100644 tests/qemuxml2argvdata/serial-spiceport-nospice.args delete mode 100644 tests/qemuxml2argvdata/serial-spiceport-nospice.x86_64-latest.args delete mode 100644 tests/qemuxml2argvdata/serial-spiceport-nospice.xml delete mode 100644 tests/qemuxml2xmloutdata/serial-spiceport-nospice.xml diff --git a/tests/qemuxml2argvdata/serial-spiceport-nospice.args b/tests/qemuxml2argvdata/serial-spiceport-nospice.args deleted file mode 100644 index 038b660afef6..000000000000 --- a/tests/qemuxml2argvdata/serial-spiceport-nospice.args +++ /dev/null @@ -1,33 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/tmp/lib/domain--1-QEMUGuest1 \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ -XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ -XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-x86_64 \ --name guest=QEMUGuest1,debug-threads=on \ --S \ --object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc,usb=off,dump-guest-core=off \ --accel tcg \ --m 214 \ --overcommit mem-lock=off \ --smp 1,sockets=1,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --boot strict=on \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ --msg timestamp=on diff --git a/tests/qemuxml2argvdata/serial-spiceport-nospice.x86_64-latest.args b/tests/qemuxml2argvdata/serial-spiceport-nospice.x86_64-latest.args deleted file mode 100644 index cee7dcd1a80a..000000000000 --- a/tests/qemuxml2argvdata/serial-spiceport-nospice.x86_64-latest.args +++ /dev/null @@ -1,37 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/tmp/lib/domain--1-QEMUGuest1 \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ -XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ -XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -/usr/bin/qemu-system-x86_64 \ --name guest=QEMUGuest1,debug-threads=on \ --S \ --object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \ --machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \ --accel tcg \ --cpu qemu64 \ --m 214 \ --object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ --overcommit mem-lock=off \ --smp 1,sockets=1,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --boot strict=on \ --device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \ --device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1}' \ --audiodev '{"id":"audio1","driver":"none"}' \ --device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x2"}' \ --sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ --msg timestamp=on diff --git a/tests/qemuxml2argvdata/serial-spiceport-nospice.xml b/tests/qemuxml2argvdata/serial-spiceport-nospice.xml deleted file mode 100644 index 7a5b96ace2d7..000000000000 --- a/tests/qemuxml2argvdata/serial-spiceport-nospice.xml +++ /dev/null @@ -1,37 +0,0 @@ -<domain type='qemu'> - <name>QEMUGuest1</name> - <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> - <memory unit='KiB'>219100</memory> - <currentMemory unit='KiB'>219100</currentMemory> - <vcpu placement='static'>1</vcpu> - <os> - <type arch='x86_64' machine='pc'>hvm</type> - <boot dev='hd'/> - </os> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>/usr/bin/qemu-system-x86_64</emulator> - <disk type='block' device='disk'> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> - <controller type='usb' index='0'/> - <controller type='ide' index='0'/> - <controller type='pci' index='0' model='pci-root'/> - <serial type='spiceport'> - <source channel='org.qemu.console.serial.0'/> - <target port='0'/> - </serial> - <console type='spiceport'> - <source channel='org.qemu.console.serial.0'/> - <target type='serial' port='0'/> - </console> - <input type='mouse' bus='ps2'/> - <input type='keyboard' bus='ps2'/> - <memballoon model='virtio'/> - </devices> -</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 1d6e03490dd9..4ad88f7bd8bb 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1613,7 +1613,6 @@ mymain(void) QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_ISA_SERIAL); - DO_TEST_NOCAPS("serial-spiceport-nospice"); DO_TEST("console-compat", QEMU_CAPS_DEVICE_ISA_SERIAL); @@ -1635,7 +1634,6 @@ mymain(void) QEMU_CAPS_DEVICE_ISA_SERIAL); DO_TEST_CAPS_LATEST("serial-file-log"); DO_TEST_CAPS_LATEST("serial-spiceport"); - DO_TEST_CAPS_LATEST("serial-spiceport-nospice"); DO_TEST_CAPS_LATEST("serial-debugcon"); DO_TEST_CAPS_LATEST("console-compat"); diff --git a/tests/qemuxml2xmloutdata/serial-spiceport-nospice.xml b/tests/qemuxml2xmloutdata/serial-spiceport-nospice.xml deleted file mode 100644 index bdc640be9e00..000000000000 --- a/tests/qemuxml2xmloutdata/serial-spiceport-nospice.xml +++ /dev/null @@ -1,47 +0,0 @@ -<domain type='qemu'> - <name>QEMUGuest1</name> - <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> - <memory unit='KiB'>219100</memory> - <currentMemory unit='KiB'>219100</currentMemory> - <vcpu placement='static'>1</vcpu> - <os> - <type arch='x86_64' machine='pc'>hvm</type> - <boot dev='hd'/> - </os> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>/usr/bin/qemu-system-x86_64</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> - <controller type='usb' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> - </controller> - <controller type='ide' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> - </controller> - <controller type='pci' index='0' model='pci-root'/> - <serial type='spiceport'> - <source channel='org.qemu.console.serial.0'/> - <target type='isa-serial' port='0'> - <model name='isa-serial'/> - </target> - </serial> - <console type='spiceport'> - <source channel='org.qemu.console.serial.0'/> - <target type='serial' port='0'/> - </console> - <input type='mouse' bus='ps2'/> - <input type='keyboard' bus='ps2'/> - <audio id='1' type='none'/> - <memballoon model='virtio'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> - </memballoon> - </devices> -</domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 518842112ec7..dbcbcc21624e 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -499,7 +499,6 @@ mymain(void) QEMU_CAPS_SPICE); cfg->spiceTLS = false; - DO_TEST_NOCAPS("serial-spiceport-nospice"); DO_TEST_NOCAPS("serial-debugcon"); DO_TEST_NOCAPS("console-compat"); DO_TEST_NOCAPS("console-compat2"); -- 2.35.1

Everything spice is not supported (and does not make sense) without spice graphics. For some tests I also added cirrus VGA capability so that the XML stays simple and libvirt can guess a default video model rather than adding too much of an irrelevant XML into the individual tests. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- .../audio-spice-best.x86_64-4.1.0.args | 3 +- .../audio-spice-best.x86_64-latest.args | 3 +- tests/qemuxml2argvdata/audio-spice-best.xml | 7 +++++ .../audio-spice-full.x86_64-latest.args | 3 +- tests/qemuxml2argvdata/audio-spice-full.xml | 7 +++++ .../audio-spice-minimal.x86_64-4.1.0.args | 3 +- .../audio-spice-minimal.x86_64-latest.args | 3 +- .../qemuxml2argvdata/audio-spice-minimal.xml | 7 +++++ .../channel-virtio-default.args | 9 +++--- .../channel-virtio-default.xml | 1 + .../smartcard-passthrough-spicevmc.args | 7 +++-- .../smartcard-passthrough-spicevmc.xml | 1 + tests/qemuxml2argvdata/usb-redir-boot.args | 7 +++-- tests/qemuxml2argvdata/usb-redir-boot.xml | 1 + .../usb-redir-filter-version.args | 7 +++-- .../usb-redir-filter-version.xml | 1 + tests/qemuxml2argvdata/usb-redir-filter.args | 7 +++-- tests/qemuxml2argvdata/usb-redir-filter.xml | 1 + tests/qemuxml2argvdata/usb-redir.args | 7 +++-- tests/qemuxml2argvdata/usb-redir.xml | 1 + tests/qemuxml2argvtest.c | 19 ++++++++---- .../smartcard-passthrough-spicevmc.xml | 11 +++++-- .../usb-redir-filter-version.xml | 11 +++++-- tests/qemuxml2xmloutdata/usb-redir-filter.xml | 11 +++++-- tests/qemuxml2xmloutdata/usb-redir.xml | 11 +++++-- tests/qemuxml2xmltest.c | 30 ++++++++++++++----- 26 files changed, 134 insertions(+), 45 deletions(-) diff --git a/tests/qemuxml2argvdata/audio-spice-best.x86_64-4.1.0.args b/tests/qemuxml2argvdata/audio-spice-best.x86_64-4.1.0.args index d5d42384b1b5..ca1d3ac4cef0 100644 --- a/tests/qemuxml2argvdata/audio-spice-best.x86_64-4.1.0.args +++ b/tests/qemuxml2argvdata/audio-spice-best.x86_64-4.1.0.args @@ -28,7 +28,6 @@ QEMU_AUDIO_DAC_FIXED_FMT=f32 \ -overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ -no-user-config \ -nodefaults \ -chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ @@ -40,5 +39,7 @@ QEMU_AUDIO_DAC_FIXED_FMT=f32 \ -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -drive file=/dev/cdrom,format=raw,if=none,id=drive-ide0-1-0,readonly=on \ -device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1 \ +-spice port=0,seamless-migration=on \ +-device cirrus-vga,id=video0,bus=pci.0,addr=0x2 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/audio-spice-best.x86_64-latest.args b/tests/qemuxml2argvdata/audio-spice-best.x86_64-latest.args index b0d69916e2cc..4fa37d994afb 100644 --- a/tests/qemuxml2argvdata/audio-spice-best.x86_64-latest.args +++ b/tests/qemuxml2argvdata/audio-spice-best.x86_64-latest.args @@ -18,7 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ -no-user-config \ -nodefaults \ -chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ @@ -32,5 +31,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -blockdev '{"node-name":"libvirt-1-format","read-only":true,"driver":"raw","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-cd","bus":"ide.1","unit":0,"drive":"libvirt-1-format","id":"ide0-1-0","bootindex":1}' \ -audiodev '{"id":"audio1","driver":"spice","timer-period":50,"in":{"mixing-engine":true,"fixed-settings":true,"voices":1,"frequency":44100,"channels":2,"format":"s16"},"out":{"mixing-engine":true,"fixed-settings":true,"voices":2,"frequency":22050,"channels":4,"format":"f32"}}' \ +-spice port=0,seamless-migration=on \ +-device '{"driver":"cirrus-vga","id":"video0","bus":"pci.0","addr":"0x2"}' \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/audio-spice-best.xml b/tests/qemuxml2argvdata/audio-spice-best.xml index f38175a913ee..80594ebca65c 100644 --- a/tests/qemuxml2argvdata/audio-spice-best.xml +++ b/tests/qemuxml2argvdata/audio-spice-best.xml @@ -30,6 +30,9 @@ <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> + <graphics type='spice'> + <listen type='none'/> + </graphics> <audio id='1' type='spice' timerPeriod='50'> <input mixingEngine='yes' fixedSettings='yes' voices='1'> <settings frequency='44100' channels='2' format='s16'/> @@ -38,6 +41,10 @@ <settings frequency='22050' channels='4' format='f32'/> </output> </audio> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> <memballoon model='none'/> </devices> </domain> diff --git a/tests/qemuxml2argvdata/audio-spice-full.x86_64-latest.args b/tests/qemuxml2argvdata/audio-spice-full.x86_64-latest.args index 4ceeb99edcb8..f2d060bee789 100644 --- a/tests/qemuxml2argvdata/audio-spice-full.x86_64-latest.args +++ b/tests/qemuxml2argvdata/audio-spice-full.x86_64-latest.args @@ -18,7 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ -no-user-config \ -nodefaults \ -chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ @@ -32,5 +31,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -blockdev '{"node-name":"libvirt-1-format","read-only":true,"driver":"raw","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-cd","bus":"ide.1","unit":0,"drive":"libvirt-1-format","id":"ide0-1-0","bootindex":1}' \ -audiodev '{"id":"audio1","driver":"spice","in":{"mixing-engine":true,"fixed-settings":true,"voices":1,"buffer-length":100,"frequency":44100,"channels":2,"format":"s16"},"out":{"mixing-engine":true,"fixed-settings":true,"voices":2,"buffer-length":200,"frequency":22050,"channels":4,"format":"f32"}}' \ +-spice port=0,seamless-migration=on \ +-device '{"driver":"cirrus-vga","id":"video0","bus":"pci.0","addr":"0x2"}' \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/audio-spice-full.xml b/tests/qemuxml2argvdata/audio-spice-full.xml index c2893ac7feac..c9f00f8c8c32 100644 --- a/tests/qemuxml2argvdata/audio-spice-full.xml +++ b/tests/qemuxml2argvdata/audio-spice-full.xml @@ -30,6 +30,9 @@ <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> + <graphics type='spice'> + <listen type='none'/> + </graphics> <audio id='1' type='spice'> <input mixingEngine='yes' fixedSettings='yes' voices='1' bufferLength='100'> <settings frequency='44100' channels='2' format='s16'/> @@ -38,6 +41,10 @@ <settings frequency='22050' channels='4' format='f32'/> </output> </audio> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> <memballoon model='none'/> </devices> </domain> diff --git a/tests/qemuxml2argvdata/audio-spice-minimal.x86_64-4.1.0.args b/tests/qemuxml2argvdata/audio-spice-minimal.x86_64-4.1.0.args index d8f19972f2bb..0a11d70486b6 100644 --- a/tests/qemuxml2argvdata/audio-spice-minimal.x86_64-4.1.0.args +++ b/tests/qemuxml2argvdata/audio-spice-minimal.x86_64-4.1.0.args @@ -17,7 +17,6 @@ QEMU_AUDIO_DRV=spice \ -overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ -no-user-config \ -nodefaults \ -chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ @@ -29,5 +28,7 @@ QEMU_AUDIO_DRV=spice \ -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -drive file=/dev/cdrom,format=raw,if=none,id=drive-ide0-1-0,readonly=on \ -device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1 \ +-spice port=0,seamless-migration=on \ +-device cirrus-vga,id=video0,bus=pci.0,addr=0x2 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/audio-spice-minimal.x86_64-latest.args b/tests/qemuxml2argvdata/audio-spice-minimal.x86_64-latest.args index a4908c5e0dc6..4774ed0914e5 100644 --- a/tests/qemuxml2argvdata/audio-spice-minimal.x86_64-latest.args +++ b/tests/qemuxml2argvdata/audio-spice-minimal.x86_64-latest.args @@ -18,7 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ -no-user-config \ -nodefaults \ -chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ @@ -32,5 +31,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -blockdev '{"node-name":"libvirt-1-format","read-only":true,"driver":"raw","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-cd","bus":"ide.1","unit":0,"drive":"libvirt-1-format","id":"ide0-1-0","bootindex":1}' \ -audiodev '{"id":"audio1","driver":"spice"}' \ +-spice port=0,seamless-migration=on \ +-device '{"driver":"cirrus-vga","id":"video0","bus":"pci.0","addr":"0x2"}' \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/audio-spice-minimal.xml b/tests/qemuxml2argvdata/audio-spice-minimal.xml index 281a9cd164c8..d5fd97b9ac4b 100644 --- a/tests/qemuxml2argvdata/audio-spice-minimal.xml +++ b/tests/qemuxml2argvdata/audio-spice-minimal.xml @@ -30,7 +30,14 @@ <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> + <graphics type='spice'> + <listen type='none'/> + </graphics> <audio id='1' type='spice'/> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> <memballoon model='none'/> </devices> </domain> diff --git a/tests/qemuxml2argvdata/channel-virtio-default.args b/tests/qemuxml2argvdata/channel-virtio-default.args index 61640bd5e7bb..b4e22e6c6b56 100644 --- a/tests/qemuxml2argvdata/channel-virtio-default.args +++ b/tests/qemuxml2argvdata/channel-virtio-default.args @@ -6,7 +6,7 @@ LOGNAME=test \ XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ +QEMU_AUDIO_DRV=spice \ /usr/bin/qemu-system-i386 \ -name guest=QEMUGuest1,debug-threads=on \ -S \ @@ -17,7 +17,6 @@ QEMU_AUDIO_DRV=none \ -overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ -no-user-config \ -nodefaults \ -chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ @@ -27,7 +26,7 @@ QEMU_AUDIO_DRV=none \ -no-acpi \ -boot strict=on \ -device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \ --device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x2 \ +-device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 \ -usb \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \ @@ -35,5 +34,7 @@ QEMU_AUDIO_DRV=none \ -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0 \ -chardev spicevmc,id=charchannel1,name=vdagent \ -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,id=channel1,name=com.redhat.spice.0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ +-spice port=0,seamless-migration=on \ +-device cirrus-vga,id=video0,bus=pci.0,addr=0x2 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/channel-virtio-default.xml b/tests/qemuxml2argvdata/channel-virtio-default.xml index aab9ce1a976f..28d0b218f8ea 100644 --- a/tests/qemuxml2argvdata/channel-virtio-default.xml +++ b/tests/qemuxml2argvdata/channel-virtio-default.xml @@ -31,6 +31,7 @@ <channel type="spicevmc"> <target type="virtio"/> </channel> + <graphics type='spice'/> <memballoon model='virtio'/> </devices> </domain> diff --git a/tests/qemuxml2argvdata/smartcard-passthrough-spicevmc.args b/tests/qemuxml2argvdata/smartcard-passthrough-spicevmc.args index 166f1f081be3..0de55f9d7192 100644 --- a/tests/qemuxml2argvdata/smartcard-passthrough-spicevmc.args +++ b/tests/qemuxml2argvdata/smartcard-passthrough-spicevmc.args @@ -6,7 +6,7 @@ LOGNAME=test \ XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ +QEMU_AUDIO_DRV=spice \ /usr/bin/qemu-system-i386 \ -name guest=QEMUGuest1,debug-threads=on \ -S \ @@ -17,7 +17,6 @@ QEMU_AUDIO_DRV=none \ -overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ -no-user-config \ -nodefaults \ -chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ @@ -30,5 +29,7 @@ QEMU_AUDIO_DRV=none \ -device usb-ccid,id=ccid0,bus=usb.0,port=1 \ -chardev spicevmc,id=charsmartcard0,name=smartcard \ -device ccid-card-passthru,chardev=charsmartcard0,id=smartcard0,bus=ccid0.0 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ +-spice port=0,seamless-migration=on \ +-device cirrus-vga,id=video0,bus=pci.0,addr=0x2 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/smartcard-passthrough-spicevmc.xml b/tests/qemuxml2argvdata/smartcard-passthrough-spicevmc.xml index c0baa1e34bc4..76e0597a769e 100644 --- a/tests/qemuxml2argvdata/smartcard-passthrough-spicevmc.xml +++ b/tests/qemuxml2argvdata/smartcard-passthrough-spicevmc.xml @@ -12,5 +12,6 @@ <emulator>/usr/bin/qemu-system-i386</emulator> <smartcard mode='passthrough' type='spicevmc'/> <memballoon model='virtio'/> + <graphics type='spice'/> </devices> </domain> diff --git a/tests/qemuxml2argvdata/usb-redir-boot.args b/tests/qemuxml2argvdata/usb-redir-boot.args index b4646a0cd8fe..59edb9705f2c 100644 --- a/tests/qemuxml2argvdata/usb-redir-boot.args +++ b/tests/qemuxml2argvdata/usb-redir-boot.args @@ -6,7 +6,7 @@ LOGNAME=test \ XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ +QEMU_AUDIO_DRV=spice \ /usr/bin/qemu-system-i386 \ -name guest=QEMUGuest1,debug-threads=on \ -S \ @@ -17,7 +17,6 @@ QEMU_AUDIO_DRV=none \ -overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ -no-user-config \ -nodefaults \ -chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ @@ -30,9 +29,11 @@ QEMU_AUDIO_DRV=none \ -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4 \ -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 \ -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 \ +-spice port=0,seamless-migration=on \ +-device cirrus-vga,id=video0,bus=pci.0,addr=0x2 \ -chardev socket,id=charredir0,host=localhost,port=4000 \ -device usb-redir,chardev=charredir0,id=redir0,bootindex=1,bus=usb.0,port=1 \ -chardev spicevmc,id=charredir1,name=usbredir \ -device usb-redir,chardev=charredir1,id=redir1,bootindex=2,bus=usb.0,port=4 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/usb-redir-boot.xml b/tests/qemuxml2argvdata/usb-redir-boot.xml index 9fbcaa2256e1..f6db55ca8115 100644 --- a/tests/qemuxml2argvdata/usb-redir-boot.xml +++ b/tests/qemuxml2argvdata/usb-redir-boot.xml @@ -37,6 +37,7 @@ <address type='usb' bus='0' port='4'/> <boot order='2'/> </redirdev> + <graphics type='spice'/> <memballoon model='virtio'/> </devices> </domain> diff --git a/tests/qemuxml2argvdata/usb-redir-filter-version.args b/tests/qemuxml2argvdata/usb-redir-filter-version.args index d033a639b63b..67e94716946f 100644 --- a/tests/qemuxml2argvdata/usb-redir-filter-version.args +++ b/tests/qemuxml2argvdata/usb-redir-filter-version.args @@ -6,7 +6,7 @@ LOGNAME=test \ XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ +QEMU_AUDIO_DRV=spice \ /usr/bin/qemu-system-i386 \ -name guest=QEMUGuest1,debug-threads=on \ -S \ @@ -17,7 +17,6 @@ QEMU_AUDIO_DRV=none \ -overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ -no-user-config \ -nodefaults \ -chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ @@ -27,9 +26,11 @@ QEMU_AUDIO_DRV=none \ -no-acpi \ -boot strict=on \ -usb \ +-spice port=0,seamless-migration=on \ +-device cirrus-vga,id=video0,bus=pci.0,addr=0x2 \ -chardev spicevmc,id=charredir0,name=usbredir \ -device 'usb-redir,chardev=charredir0,id=redir0,filter=0x08:0x15E1:0x2007:0x0109:1|0x08:0x15E1:0x2007:0x0940:1|-1:-1:-1:-1:0,bus=usb.0,port=1' \ -chardev spicevmc,id=charredir1,name=usbredir \ -device 'usb-redir,chardev=charredir1,id=redir1,filter=0x08:0x15E1:0x2007:0x0109:1|0x08:0x15E1:0x2007:0x0940:1|-1:-1:-1:-1:0,bus=usb.0,port=2' \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/usb-redir-filter-version.xml b/tests/qemuxml2argvdata/usb-redir-filter-version.xml index 2e45517c2f57..35a63d8438c2 100644 --- a/tests/qemuxml2argvdata/usb-redir-filter-version.xml +++ b/tests/qemuxml2argvdata/usb-redir-filter-version.xml @@ -27,6 +27,7 @@ <usbdev class='0x08' vendor='0x15E1' product='0x2007' version='9.4' allow='yes'/> <usbdev allow='no'/> </redirfilter> + <graphics type='spice'/> <memballoon model='virtio'/> </devices> </domain> diff --git a/tests/qemuxml2argvdata/usb-redir-filter.args b/tests/qemuxml2argvdata/usb-redir-filter.args index e45906eae0e2..9b00bc2a9fff 100644 --- a/tests/qemuxml2argvdata/usb-redir-filter.args +++ b/tests/qemuxml2argvdata/usb-redir-filter.args @@ -6,7 +6,7 @@ LOGNAME=test \ XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ +QEMU_AUDIO_DRV=spice \ /usr/bin/qemu-system-i386 \ -name guest=QEMUGuest1,debug-threads=on \ -S \ @@ -17,7 +17,6 @@ QEMU_AUDIO_DRV=none \ -overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ -no-user-config \ -nodefaults \ -chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ @@ -30,9 +29,11 @@ QEMU_AUDIO_DRV=none \ -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4 \ -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 \ -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 \ +-spice port=0,seamless-migration=on \ +-device cirrus-vga,id=video0,bus=pci.0,addr=0x2 \ -chardev spicevmc,id=charredir0,name=usbredir \ -device 'usb-redir,chardev=charredir0,id=redir0,filter=0x08:0x15E1:0x2007:0x0110:1|-1:-1:-1:-1:0,bus=usb.0,port=4' \ -chardev spicevmc,id=charredir1,name=usbredir \ -device 'usb-redir,chardev=charredir1,id=redir1,filter=0x08:0x15E1:0x2007:0x0110:1|-1:-1:-1:-1:0,bus=usb.0,port=5' \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/usb-redir-filter.xml b/tests/qemuxml2argvdata/usb-redir-filter.xml index 791725efb356..30a1c1d7bbea 100644 --- a/tests/qemuxml2argvdata/usb-redir-filter.xml +++ b/tests/qemuxml2argvdata/usb-redir-filter.xml @@ -29,6 +29,7 @@ <master startport='4'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/> </controller> + <graphics type='spice'/> <redirdev bus='usb' type='spicevmc'> <address type='usb' bus='0' port='4'/> </redirdev> diff --git a/tests/qemuxml2argvdata/usb-redir.args b/tests/qemuxml2argvdata/usb-redir.args index 2607860acb8a..d4eb6e137112 100644 --- a/tests/qemuxml2argvdata/usb-redir.args +++ b/tests/qemuxml2argvdata/usb-redir.args @@ -6,7 +6,7 @@ LOGNAME=test \ XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ +QEMU_AUDIO_DRV=spice \ /usr/bin/qemu-system-i386 \ -name guest=QEMUGuest1,debug-threads=on \ -S \ @@ -17,7 +17,6 @@ QEMU_AUDIO_DRV=none \ -overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ -no-user-config \ -nodefaults \ -chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ @@ -30,9 +29,11 @@ QEMU_AUDIO_DRV=none \ -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4 \ -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 \ -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 \ +-spice port=0,seamless-migration=on \ +-device cirrus-vga,id=video0,bus=pci.0,addr=0x2 \ -chardev socket,id=charredir0,host=localhost,port=4000 \ -device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=1 \ -chardev spicevmc,id=charredir1,name=usbredir \ -device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=4 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/usb-redir.xml b/tests/qemuxml2argvdata/usb-redir.xml index b2c805dba8c7..c0758e59faaa 100644 --- a/tests/qemuxml2argvdata/usb-redir.xml +++ b/tests/qemuxml2argvdata/usb-redir.xml @@ -39,6 +39,7 @@ <redirdev bus='usb' type='spicevmc'> <address type='usb' bus='0' port='4'/> </redirdev> + <graphics type='spice'/> <memballoon model='virtio'/> </devices> </domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 4ad88f7bd8bb..829550fbfe38 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1711,7 +1711,8 @@ mymain(void) DO_TEST_CAPS_LATEST("channel-qemu-vdagent"); DO_TEST_CAPS_LATEST("channel-qemu-vdagent-features"); DO_TEST("channel-virtio-default", - QEMU_CAPS_SPICE); + QEMU_CAPS_SPICE, + QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST_NOCAPS("channel-virtio-unix"); DO_TEST("smartcard-host", @@ -1723,7 +1724,9 @@ mymain(void) DO_TEST("smartcard-passthrough-tcp", QEMU_CAPS_CCID_PASSTHRU); DO_TEST("smartcard-passthrough-spicevmc", - QEMU_CAPS_CCID_PASSTHRU); + QEMU_CAPS_CCID_PASSTHRU, + QEMU_CAPS_SPICE, + QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST("smartcard-controller", QEMU_CAPS_CCID_EMULATED); DO_TEST_CAPS_LATEST("smartcard-passthrough-unix"); @@ -1776,22 +1779,26 @@ mymain(void) QEMU_CAPS_USB_HUB, QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR, - QEMU_CAPS_SPICE); + QEMU_CAPS_SPICE, + QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST("usb-redir-boot", QEMU_CAPS_USB_HUB, QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR, - QEMU_CAPS_SPICE); + QEMU_CAPS_SPICE, + QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST("usb-redir-filter", QEMU_CAPS_USB_HUB, QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR, QEMU_CAPS_SPICE, - QEMU_CAPS_USB_REDIR_FILTER); + QEMU_CAPS_USB_REDIR_FILTER, + QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST("usb-redir-filter-version", QEMU_CAPS_USB_REDIR, QEMU_CAPS_SPICE, - QEMU_CAPS_USB_REDIR_FILTER); + QEMU_CAPS_USB_REDIR_FILTER, + QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST_CAPS_LATEST("usb-redir-unix"); DO_TEST("usb1-usb2", QEMU_CAPS_PIIX3_USB_UHCI, diff --git a/tests/qemuxml2xmloutdata/smartcard-passthrough-spicevmc.xml b/tests/qemuxml2xmloutdata/smartcard-passthrough-spicevmc.xml index 9263d1741b16..f1463f2b0dff 100644 --- a/tests/qemuxml2xmloutdata/smartcard-passthrough-spicevmc.xml +++ b/tests/qemuxml2xmloutdata/smartcard-passthrough-spicevmc.xml @@ -24,9 +24,16 @@ </smartcard> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <audio id='1' type='none'/> - <memballoon model='virtio'> + <graphics type='spice'> + <listen type='none'/> + </graphics> + <audio id='1' type='spice'/> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </memballoon> </devices> </domain> diff --git a/tests/qemuxml2xmloutdata/usb-redir-filter-version.xml b/tests/qemuxml2xmloutdata/usb-redir-filter-version.xml index 19561a1c021b..4e5ebca1897b 100644 --- a/tests/qemuxml2xmloutdata/usb-redir-filter-version.xml +++ b/tests/qemuxml2xmloutdata/usb-redir-filter-version.xml @@ -20,7 +20,14 @@ <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <audio id='1' type='none'/> + <graphics type='spice'> + <listen type='none'/> + </graphics> + <audio id='1' type='spice'/> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> <redirdev bus='usb' type='spicevmc'> <address type='usb' bus='0' port='1'/> </redirdev> @@ -33,7 +40,7 @@ <usbdev allow='no'/> </redirfilter> <memballoon model='virtio'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </memballoon> </devices> </domain> diff --git a/tests/qemuxml2xmloutdata/usb-redir-filter.xml b/tests/qemuxml2xmloutdata/usb-redir-filter.xml index ac5a1c509156..d857a89289cc 100644 --- a/tests/qemuxml2xmloutdata/usb-redir-filter.xml +++ b/tests/qemuxml2xmloutdata/usb-redir-filter.xml @@ -32,7 +32,14 @@ <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <audio id='1' type='none'/> + <graphics type='spice'> + <listen type='none'/> + </graphics> + <audio id='1' type='spice'/> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> <redirdev bus='usb' type='spicevmc'> <address type='usb' bus='0' port='4'/> </redirdev> @@ -44,7 +51,7 @@ <usbdev allow='no'/> </redirfilter> <memballoon model='virtio'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </memballoon> </devices> </domain> diff --git a/tests/qemuxml2xmloutdata/usb-redir.xml b/tests/qemuxml2xmloutdata/usb-redir.xml index c57ccc8d4730..95f4d6a1df90 100644 --- a/tests/qemuxml2xmloutdata/usb-redir.xml +++ b/tests/qemuxml2xmloutdata/usb-redir.xml @@ -32,7 +32,14 @@ <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <audio id='1' type='none'/> + <graphics type='spice'> + <listen type='none'/> + </graphics> + <audio id='1' type='spice'/> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> <redirdev bus='usb' type='tcp'> <source mode='connect' host='localhost' service='4000'/> <protocol type='raw'/> @@ -41,7 +48,7 @@ <address type='usb' bus='0' port='4'/> </redirdev> <memballoon model='virtio'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </memballoon> </devices> </domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index dbcbcc21624e..8b655874d130 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -613,13 +613,19 @@ mymain(void) QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_PIIX3_USB_UHCI); DO_TEST("usb-port-missing", QEMU_CAPS_USB_HUB); - DO_TEST("usb-redir", QEMU_CAPS_USB_REDIR); + DO_TEST("usb-redir", QEMU_CAPS_USB_REDIR, + QEMU_CAPS_SPICE, + QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST("usb-redir-filter", QEMU_CAPS_USB_REDIR, - QEMU_CAPS_USB_REDIR_FILTER); + QEMU_CAPS_USB_REDIR_FILTER, + QEMU_CAPS_SPICE, + QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST("usb-redir-filter-version", QEMU_CAPS_USB_REDIR, - QEMU_CAPS_USB_REDIR_FILTER); + QEMU_CAPS_USB_REDIR_FILTER, + QEMU_CAPS_SPICE, + QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST_CAPS_LATEST("blkdeviotune"); DO_TEST_CAPS_LATEST("blkdeviotune-max"); DO_TEST_CAPS_LATEST("blkdeviotune-group-num"); @@ -1301,7 +1307,10 @@ mymain(void) DO_TEST("smartcard-host-certificates-database", QEMU_CAPS_CCID_EMULATED); DO_TEST("smartcard-passthrough-tcp", QEMU_CAPS_CCID_PASSTHRU); - DO_TEST("smartcard-passthrough-spicevmc", QEMU_CAPS_CCID_PASSTHRU); + DO_TEST("smartcard-passthrough-spicevmc", + QEMU_CAPS_CCID_PASSTHRU, + QEMU_CAPS_SPICE, + QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST("smartcard-controller", QEMU_CAPS_CCID_EMULATED); DO_TEST("pseries-cpu-compat-power9", @@ -1402,7 +1411,9 @@ mymain(void) DO_TEST_NOCAPS("audio-oss-minimal"); DO_TEST_NOCAPS("audio-pulseaudio-minimal"); DO_TEST_NOCAPS("audio-sdl-minimal"); - DO_TEST_NOCAPS("audio-spice-minimal"); + DO_TEST("audio-spice-minimal", + QEMU_CAPS_SPICE, + QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST_NOCAPS("audio-file-minimal"); /* Best <audio> still compat with old ENV */ @@ -1412,7 +1423,9 @@ mymain(void) DO_TEST_NOCAPS("audio-oss-best"); DO_TEST_NOCAPS("audio-pulseaudio-best"); DO_TEST_NOCAPS("audio-sdl-best"); - DO_TEST_NOCAPS("audio-spice-best"); + DO_TEST("audio-spice-best", + QEMU_CAPS_SPICE, + QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST_NOCAPS("audio-file-best"); /* Full <audio> only compat with new QEMU -audiodev args */ @@ -1423,7 +1436,10 @@ mymain(void) DO_TEST("audio-oss-full", QEMU_CAPS_AUDIODEV); DO_TEST("audio-pulseaudio-full", QEMU_CAPS_AUDIODEV); DO_TEST("audio-sdl-full", QEMU_CAPS_AUDIODEV); - DO_TEST("audio-spice-full", QEMU_CAPS_AUDIODEV); + DO_TEST("audio-spice-full", + QEMU_CAPS_AUDIODEV, + QEMU_CAPS_SPICE, + QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST("audio-file-full", QEMU_CAPS_AUDIODEV); DO_TEST_CAPS_LATEST("audio-many-backends"); -- 2.35.1

It will be used in future patch in multiple places. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- src/conf/domain_conf.c | 14 ++++++++++++++ src/conf/domain_conf.h | 3 +++ src/libvirt_private.syms | 1 + 3 files changed, 18 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 298ae183ce3f..d9b55c80aafb 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -31558,3 +31558,17 @@ virDomainObjGetMessages(virDomainObj *vm, return rv; } + +bool +virDomainDefHasSpiceGraphics(const virDomainDef *def) +{ + size_t i = 0; + + for (i = 0; i < def->ngraphics; i++) { + if (def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { + return true; + } + } + + return false; +} diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index f5d9df3fab1f..2e2da0c69c3b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -4277,3 +4277,6 @@ int virDomainObjGetMessages(virDomainObj *vm, char ***msgs, unsigned int flags); + +bool +virDomainDefHasSpiceGraphics(const virDomainDef *def); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index ee4dd8493c3a..93092597516f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -333,6 +333,7 @@ virDomainDefHasMemoryHotplug; virDomainDefHasNVMeDisk; virDomainDefHasOldStyleROUEFI; virDomainDefHasOldStyleUEFI; +virDomainDefHasSpiceGraphics; virDomainDefHasUSB; virDomainDefHasVcpusOffline; virDomainDefHasVDPANet; -- 2.35.1

For most of them qemu errors out with unclear message, and for the audiodev qemu just falls back to timer-based audio with a warning message, and will possibly also error out in the future. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2035163 Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- src/qemu/qemu_validate.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 094ebce9c65e..6ff61d91faf1 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1965,6 +1965,7 @@ qemuValidateDomainChrTargetDef(const virDomainChrDef *chr) static int qemuValidateDomainChrSourceDef(const virDomainChrSourceDef *def, + const virDomainDef *vmdef, virQEMUCaps *qemuCaps) { switch ((virDomainChrType)def->type) { @@ -1996,6 +1997,16 @@ qemuValidateDomainChrSourceDef(const virDomainChrSourceDef *def, } break; + case VIR_DOMAIN_CHR_TYPE_SPICEVMC: + case VIR_DOMAIN_CHR_TYPE_SPICEPORT: + if (!virDomainDefHasSpiceGraphics(vmdef)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("chardev '%s' not supported without spice graphics"), + virDomainChrTypeToString(def->type)); + return -1; + } + break; + case VIR_DOMAIN_CHR_TYPE_NULL: case VIR_DOMAIN_CHR_TYPE_VC: case VIR_DOMAIN_CHR_TYPE_PTY: @@ -2003,8 +2014,6 @@ qemuValidateDomainChrSourceDef(const virDomainChrSourceDef *def, case VIR_DOMAIN_CHR_TYPE_PIPE: case VIR_DOMAIN_CHR_TYPE_STDIO: case VIR_DOMAIN_CHR_TYPE_UDP: - case VIR_DOMAIN_CHR_TYPE_SPICEVMC: - case VIR_DOMAIN_CHR_TYPE_SPICEPORT: case VIR_DOMAIN_CHR_TYPE_NMDM: case VIR_DOMAIN_CHR_TYPE_LAST: break; @@ -2027,7 +2036,7 @@ qemuValidateDomainChrDef(const virDomainChrDef *dev, const virDomainDef *def, virQEMUCaps *qemuCaps) { - if (qemuValidateDomainChrSourceDef(dev->source, qemuCaps) < 0) + if (qemuValidateDomainChrSourceDef(dev->source, def, qemuCaps) < 0) return -1; if (qemuValidateDomainChrTargetDef(dev) < 0) @@ -2120,7 +2129,7 @@ qemuValidateDomainSmartcardDef(const virDomainSmartcardDef *smartcard, return -1; } - if (qemuValidateDomainChrSourceDef(smartcard->data.passthru, qemuCaps) < 0) + if (qemuValidateDomainChrSourceDef(smartcard->data.passthru, def, qemuCaps) < 0) return -1; break; @@ -2136,6 +2145,7 @@ qemuValidateDomainSmartcardDef(const virDomainSmartcardDef *smartcard, static int qemuValidateDomainRNGDef(const virDomainRNGDef *def, + const virDomainDef *vmdef, virQEMUCaps *qemuCaps) { virDomainCapsDeviceRNG rngCaps = { 0 }; @@ -2158,7 +2168,9 @@ qemuValidateDomainRNGDef(const virDomainRNGDef *def, return -1; } - if (qemuValidateDomainChrSourceDef(def->source.chardev, qemuCaps) < 0) + if (qemuValidateDomainChrSourceDef(def->source.chardev, + vmdef, + qemuCaps) < 0) return -1; break; @@ -2199,7 +2211,7 @@ qemuValidateDomainRedirdevDef(const virDomainRedirdevDef *dev, const virDomainDef *def, virQEMUCaps *qemuCaps) { - if (qemuValidateDomainChrSourceDef(dev->source, qemuCaps) < 0) + if (qemuValidateDomainChrSourceDef(dev->source, def, qemuCaps) < 0) return -1; if (dev->bus != VIR_DOMAIN_REDIRDEV_BUS_USB) { @@ -4379,6 +4391,7 @@ qemuValidateDomainDeviceDefFS(virDomainFSDef *fs, static int qemuValidateDomainDeviceDefAudio(virDomainAudioDef *audio, + const virDomainDef *def, virQEMUCaps *qemuCaps G_GNUC_UNUSED) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_AUDIODEV)) { @@ -4483,6 +4496,11 @@ qemuValidateDomainDeviceDefAudio(virDomainAudioDef *audio, break; case VIR_DOMAIN_AUDIO_TYPE_SPICE: + if (!virDomainDefHasSpiceGraphics(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Spice audio is not supported without spice graphics")); + return -1; + } break; case VIR_DOMAIN_AUDIO_TYPE_FILE: @@ -5146,7 +5164,7 @@ qemuValidateDomainDeviceDef(const virDomainDeviceDef *dev, return qemuValidateDomainSmartcardDef(dev->data.smartcard, def, qemuCaps); case VIR_DOMAIN_DEVICE_RNG: - return qemuValidateDomainRNGDef(dev->data.rng, qemuCaps); + return qemuValidateDomainRNGDef(dev->data.rng, def, qemuCaps); case VIR_DOMAIN_DEVICE_REDIRDEV: return qemuValidateDomainRedirdevDef(dev->data.redirdev, def, qemuCaps); @@ -5206,7 +5224,7 @@ qemuValidateDomainDeviceDef(const virDomainDeviceDef *dev, return qemuValidateDomainDeviceDefShmem(dev->data.shmem, qemuCaps); case VIR_DOMAIN_DEVICE_AUDIO: - return qemuValidateDomainDeviceDefAudio(dev->data.audio, qemuCaps); + return qemuValidateDomainDeviceDefAudio(dev->data.audio, def, qemuCaps); case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_PANIC: -- 2.35.1

On 5/12/22 09:55, Martin Kletzander wrote:
Without spice graphics non of the spicevmc, spiceport and spice audiodev do not make sense. We could also check if the QEMU supports spice, but that check would be a redundant check, which is redundant.
Martin Kletzander (4): Remove serial-spiceport-nospice test tests: Adjust for invalid qemu command combinations conf: Add virDomainDefHasSpiceGraphics qemu: Disable spice-related devices without spice graphics
src/conf/domain_conf.c | 14 ++++++ src/conf/domain_conf.h | 3 ++ src/libvirt_private.syms | 1 + src/qemu/qemu_validate.c | 34 ++++++++++---- .../audio-spice-best.x86_64-4.1.0.args | 3 +- .../audio-spice-best.x86_64-latest.args | 3 +- tests/qemuxml2argvdata/audio-spice-best.xml | 7 +++ .../audio-spice-full.x86_64-latest.args | 3 +- tests/qemuxml2argvdata/audio-spice-full.xml | 7 +++ .../audio-spice-minimal.x86_64-4.1.0.args | 3 +- .../audio-spice-minimal.x86_64-latest.args | 3 +- .../qemuxml2argvdata/audio-spice-minimal.xml | 7 +++ .../channel-virtio-default.args | 9 ++-- .../channel-virtio-default.xml | 1 + .../serial-spiceport-nospice.args | 33 ------------- ...erial-spiceport-nospice.x86_64-latest.args | 37 --------------- .../serial-spiceport-nospice.xml | 37 --------------- .../smartcard-passthrough-spicevmc.args | 7 +-- .../smartcard-passthrough-spicevmc.xml | 1 + tests/qemuxml2argvdata/usb-redir-boot.args | 7 +-- tests/qemuxml2argvdata/usb-redir-boot.xml | 1 + .../usb-redir-filter-version.args | 7 +-- .../usb-redir-filter-version.xml | 1 + tests/qemuxml2argvdata/usb-redir-filter.args | 7 +-- tests/qemuxml2argvdata/usb-redir-filter.xml | 1 + tests/qemuxml2argvdata/usb-redir.args | 7 +-- tests/qemuxml2argvdata/usb-redir.xml | 1 + tests/qemuxml2argvtest.c | 21 +++++---- .../serial-spiceport-nospice.xml | 47 ------------------- .../smartcard-passthrough-spicevmc.xml | 11 ++++- .../usb-redir-filter-version.xml | 11 ++++- tests/qemuxml2xmloutdata/usb-redir-filter.xml | 11 ++++- tests/qemuxml2xmloutdata/usb-redir.xml | 11 ++++- tests/qemuxml2xmltest.c | 31 ++++++++---- 34 files changed, 178 insertions(+), 210 deletions(-) delete mode 100644 tests/qemuxml2argvdata/serial-spiceport-nospice.args delete mode 100644 tests/qemuxml2argvdata/serial-spiceport-nospice.x86_64-latest.args delete mode 100644 tests/qemuxml2argvdata/serial-spiceport-nospice.xml delete mode 100644 tests/qemuxml2xmloutdata/serial-spiceport-nospice.xml
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Michal
participants (2)
-
Martin Kletzander
-
Michal Prívozník