Even though virtio-mmio is no longer the default on either
architecture, and likely nobody is using it at this point, we
still provide a way to opt into virtio-mmio usage and want to
keep existing guests working. Add explicit test suite coverage
for this scenario.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
...h64-virt-headless-mmio.aarch64-latest.args | 48 +++++++++++++
.../aarch64-virt-headless-mmio.xml | 48 +++++++++++++
...v64-virt-headless-mmio.riscv64-latest.args | 43 +++++++++++
.../riscv64-virt-headless-mmio.xml | 43 +++++++++++
tests/qemuxml2argvtest.c | 2 +
...ch64-virt-headless-mmio.aarch64-latest.xml | 71 +++++++++++++++++++
...cv64-virt-headless-mmio.riscv64-latest.xml | 58 +++++++++++++++
tests/qemuxml2xmltest.c | 2 +
8 files changed, 315 insertions(+)
create mode 100644 tests/qemuxml2argvdata/aarch64-virt-headless-mmio.aarch64-latest.args
create mode 100644 tests/qemuxml2argvdata/aarch64-virt-headless-mmio.xml
create mode 100644 tests/qemuxml2argvdata/riscv64-virt-headless-mmio.riscv64-latest.args
create mode 100644 tests/qemuxml2argvdata/riscv64-virt-headless-mmio.xml
create mode 100644
tests/qemuxml2xmloutdata/aarch64-virt-headless-mmio.aarch64-latest.xml
create mode 100644
tests/qemuxml2xmloutdata/riscv64-virt-headless-mmio.riscv64-latest.xml
diff --git a/tests/qemuxml2argvdata/aarch64-virt-headless-mmio.aarch64-latest.args
b/tests/qemuxml2argvdata/aarch64-virt-headless-mmio.aarch64-latest.args
new file mode 100644
index 0000000000..f546cf33c7
--- /dev/null
+++ b/tests/qemuxml2argvdata/aarch64-virt-headless-mmio.aarch64-latest.args
@@ -0,0 +1,48 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-guest \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
+/usr/bin/qemu-system-aarch64 \
+-name guest=guest,debug-threads=on \
+-S \
+-object
'{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}'
\
+-blockdev
'{"driver":"file","filename":"/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.raw","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}'
\
+-blockdev
'{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}'
\
+-blockdev
'{"driver":"file","filename":"/path/to/guest_VARS.raw","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}'
\
+-blockdev
'{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}'
\
+-machine
virt-4.0,usb=off,gic-version=2,dump-guest-core=off,memory-backend=mach-virt.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on
\
+-accel tcg \
+-cpu cortex-a15 \
+-m size=4194304k \
+-object
'{"qom-type":"memory-backend-ram","id":"mach-virt.ram","size":4294967296}'
\
+-overcommit mem-lock=off \
+-smp 4,sockets=4,cores=1,threads=1 \
+-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \
+-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 \
+-boot strict=on \
+-device
'{"driver":"virtio-serial-device","id":"virtio-serial0"}'
\
+-blockdev
'{"driver":"file","filename":"/var/lib/libvirt/images/guest.qcow2","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
\
+-blockdev
'{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage"}'
\
+-device
'{"driver":"virtio-blk-device","drive":"libvirt-1-format","id":"virtio-disk0","bootindex":1}'
\
+-netdev '{"type":"user","id":"hostnet0"}'
\
+-device
'{"driver":"virtio-net-device","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37"}'
\
+-chardev pty,id=charserial0 \
+-serial chardev:charserial0 \
+-chardev socket,id=charchannel0,fd=1729,server=on,wait=off \
+-device
'{"driver":"virtserialport","bus":"virtio-serial0.0","nr":1,"chardev":"charchannel0","id":"channel0","name":"org.qemu.guest_agent.0"}'
\
+-audiodev
'{"id":"audio1","driver":"none"}' \
+-device
'{"driver":"virtio-balloon-device","id":"balloon0"}'
\
+-object
'{"qom-type":"rng-random","id":"objrng0","filename":"/dev/urandom"}'
\
+-device
'{"driver":"virtio-rng-device","rng":"objrng0","id":"rng0"}'
\
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/aarch64-virt-headless-mmio.xml
b/tests/qemuxml2argvdata/aarch64-virt-headless-mmio.xml
new file mode 100644
index 0000000000..4f2519bb1f
--- /dev/null
+++ b/tests/qemuxml2argvdata/aarch64-virt-headless-mmio.xml
@@ -0,0 +1,48 @@
+<domain type='qemu'>
+ <name>guest</name>
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+ <metadata>
+ <libosinfo:libosinfo
xmlns:libosinfo='http://libosinfo.org/xmlns/libvirt/domain/1.0'>
+ <libosinfo:os
id='http://fedoraproject.org/fedora/29'/>
+ </libosinfo:libosinfo>
+ </metadata>
+ <memory>4194304</memory>
+ <currentMemory>4194304</currentMemory>
+ <vcpu>4</vcpu>
+ <os>
+ <type arch='aarch64' machine='virt-4.0'>hvm</type>
+ <loader readonly='yes'
type='pflash'>/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.raw</loader>
+ <nvram>/path/to/guest_VARS.raw</nvram>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <acpi/>
+ </features>
+ <clock offset='utc'/>
+ <devices>
+ <emulator>/usr/bin/qemu-system-aarch64</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/guest.qcow2'/>
+ <target dev='vda' bus='virtio'/>
+ <address type='virtio-mmio'/>
+ </disk>
+ <interface type='user'>
+ <mac address='52:54:00:09:a4:37'/>
+ <model type='virtio'/>
+ <address type='virtio-mmio'/>
+ </interface>
+ <console type='pty'/>
+ <channel type='unix'>
+ <source mode='bind'/>
+ <target type='virtio' name='org.qemu.guest_agent.0'/>
+ </channel>
+ <memballoon model='virtio'>
+ <address type='virtio-mmio'/>
+ </memballoon>
+ <rng model='virtio'>
+ <backend model='random'>/dev/urandom</backend>
+ <address type='virtio-mmio'/>
+ </rng>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/riscv64-virt-headless-mmio.riscv64-latest.args
b/tests/qemuxml2argvdata/riscv64-virt-headless-mmio.riscv64-latest.args
new file mode 100644
index 0000000000..bf7ce2cf9e
--- /dev/null
+++ b/tests/qemuxml2argvdata/riscv64-virt-headless-mmio.riscv64-latest.args
@@ -0,0 +1,43 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-guest \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
+/usr/bin/qemu-system-riscv64 \
+-name guest=guest,debug-threads=on \
+-S \
+-object
'{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}'
\
+-machine virt,usb=off,dump-guest-core=off,memory-backend=riscv_virt_board.ram \
+-accel tcg \
+-m size=4194304k \
+-object
'{"qom-type":"memory-backend-ram","id":"riscv_virt_board.ram","size":4294967296}'
\
+-overcommit mem-lock=off \
+-smp 4,sockets=4,cores=1,threads=1 \
+-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \
+-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 \
+-boot strict=on \
+-device
'{"driver":"virtio-serial-device","id":"virtio-serial0"}'
\
+-blockdev
'{"driver":"file","filename":"/var/lib/libvirt/images/guest.qcow2","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
\
+-blockdev
'{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage"}'
\
+-device
'{"driver":"virtio-blk-device","drive":"libvirt-1-format","id":"virtio-disk0","bootindex":1}'
\
+-netdev '{"type":"user","id":"hostnet0"}'
\
+-device
'{"driver":"virtio-net-device","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37"}'
\
+-chardev pty,id=charserial0 \
+-serial chardev:charserial0 \
+-chardev socket,id=charchannel0,fd=1729,server=on,wait=off \
+-device
'{"driver":"virtserialport","bus":"virtio-serial0.0","nr":1,"chardev":"charchannel0","id":"channel0","name":"org.qemu.guest_agent.0"}'
\
+-audiodev
'{"id":"audio1","driver":"none"}' \
+-device
'{"driver":"virtio-balloon-device","id":"balloon0"}'
\
+-object
'{"qom-type":"rng-random","id":"objrng0","filename":"/dev/urandom"}'
\
+-device
'{"driver":"virtio-rng-device","rng":"objrng0","id":"rng0"}'
\
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/riscv64-virt-headless-mmio.xml
b/tests/qemuxml2argvdata/riscv64-virt-headless-mmio.xml
new file mode 100644
index 0000000000..bcba73e9f1
--- /dev/null
+++ b/tests/qemuxml2argvdata/riscv64-virt-headless-mmio.xml
@@ -0,0 +1,43 @@
+<domain type='qemu'>
+ <name>guest</name>
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+ <metadata>
+ <libosinfo:libosinfo
xmlns:libosinfo='http://libosinfo.org/xmlns/libvirt/domain/1.0'>
+ <libosinfo:os
id='http://fedoraproject.org/fedora/29'/>
+ </libosinfo:libosinfo>
+ </metadata>
+ <memory>4194304</memory>
+ <currentMemory>4194304</currentMemory>
+ <vcpu>4</vcpu>
+ <os>
+ <type arch='riscv64' machine='virt'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <devices>
+ <emulator>/usr/bin/qemu-system-riscv64</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/guest.qcow2'/>
+ <target dev='vda' bus='virtio'/>
+ <address type='virtio-mmio'/>
+ </disk>
+ <interface type='user'>
+ <mac address='52:54:00:09:a4:37'/>
+ <model type='virtio'/>
+ <address type='virtio-mmio'/>
+ </interface>
+ <console type='pty'/>
+ <channel type='unix'>
+ <source mode='bind'/>
+ <target type='virtio' name='org.qemu.guest_agent.0'/>
+ </channel>
+ <memballoon model='virtio'>
+ <address type='virtio-mmio'/>
+ </memballoon>
+ <rng model='virtio'>
+ <backend model='random'>/dev/urandom</backend>
+ <address type='virtio-mmio'/>
+ </rng>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 0987f4c78f..1bc3985aca 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2539,8 +2539,10 @@ mymain(void)
/* Simple headless guests for various architectures */
DO_TEST_CAPS_ARCH_LATEST("aarch64-virt-headless", "aarch64");
+ DO_TEST_CAPS_ARCH_LATEST("aarch64-virt-headless-mmio",
"aarch64");
DO_TEST_CAPS_ARCH_LATEST("ppc64-pseries-headless", "ppc64");
DO_TEST_CAPS_ARCH_LATEST("riscv64-virt-headless", "riscv64");
+ DO_TEST_CAPS_ARCH_LATEST("riscv64-virt-headless-mmio",
"riscv64");
DO_TEST_CAPS_ARCH_LATEST("s390x-ccw-headless", "s390x");
DO_TEST_CAPS_ARCH_LATEST("x86_64-pc-headless", "x86_64");
DO_TEST_CAPS_ARCH_LATEST("x86_64-q35-headless", "x86_64");
diff --git a/tests/qemuxml2xmloutdata/aarch64-virt-headless-mmio.aarch64-latest.xml
b/tests/qemuxml2xmloutdata/aarch64-virt-headless-mmio.aarch64-latest.xml
new file mode 100644
index 0000000000..1b2d6e70bd
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/aarch64-virt-headless-mmio.aarch64-latest.xml
@@ -0,0 +1,71 @@
+<domain type='qemu'>
+ <name>guest</name>
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+ <metadata>
+ <libosinfo:libosinfo
xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0"...
+ <libosinfo:os
id="http://fedoraproject.org/fedora/29"/>
+ </libosinfo:libosinfo>
+ </metadata>
+ <memory unit='KiB'>4194304</memory>
+ <currentMemory unit='KiB'>4194304</currentMemory>
+ <vcpu placement='static'>4</vcpu>
+ <os firmware='efi'>
+ <type arch='aarch64' machine='virt-4.0'>hvm</type>
+ <firmware>
+ <feature enabled='no' name='enrolled-keys'/>
+ <feature enabled='no' name='secure-boot'/>
+ </firmware>
+ <loader readonly='yes'
type='pflash'>/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.raw</loader>
+ <nvram
template='/usr/share/edk2/aarch64/vars-template-pflash.raw'>/path/to/guest_VARS.raw</nvram>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <acpi/>
+ <gic version='2'/>
+ </features>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>cortex-a15</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-aarch64</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/guest.qcow2'/>
+ <target dev='vda' bus='virtio'/>
+ <address type='virtio-mmio'/>
+ </disk>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='virtio-serial' index='0'>
+ <address type='virtio-mmio'/>
+ </controller>
+ <interface type='user'>
+ <mac address='52:54:00:09:a4:37'/>
+ <model type='virtio'/>
+ <address type='virtio-mmio'/>
+ </interface>
+ <serial type='pty'>
+ <target type='system-serial' port='0'>
+ <model name='pl011'/>
+ </target>
+ </serial>
+ <console type='pty'>
+ <target type='serial' port='0'/>
+ </console>
+ <channel type='unix'>
+ <target type='virtio' name='org.qemu.guest_agent.0'/>
+ <address type='virtio-serial' controller='0' bus='0'
port='1'/>
+ </channel>
+ <audio id='1' type='none'/>
+ <memballoon model='virtio'>
+ <address type='virtio-mmio'/>
+ </memballoon>
+ <rng model='virtio'>
+ <backend model='random'>/dev/urandom</backend>
+ <address type='virtio-mmio'/>
+ </rng>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/riscv64-virt-headless-mmio.riscv64-latest.xml
b/tests/qemuxml2xmloutdata/riscv64-virt-headless-mmio.riscv64-latest.xml
new file mode 100644
index 0000000000..445029e82b
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/riscv64-virt-headless-mmio.riscv64-latest.xml
@@ -0,0 +1,58 @@
+<domain type='qemu'>
+ <name>guest</name>
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+ <metadata>
+ <libosinfo:libosinfo
xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0"...
+ <libosinfo:os
id="http://fedoraproject.org/fedora/29"/>
+ </libosinfo:libosinfo>
+ </metadata>
+ <memory unit='KiB'>4194304</memory>
+ <currentMemory unit='KiB'>4194304</currentMemory>
+ <vcpu placement='static'>4</vcpu>
+ <os>
+ <type arch='riscv64' machine='virt'>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-riscv64</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/guest.qcow2'/>
+ <target dev='vda' bus='virtio'/>
+ <address type='virtio-mmio'/>
+ </disk>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='virtio-serial' index='0'>
+ <address type='virtio-mmio'/>
+ </controller>
+ <interface type='user'>
+ <mac address='52:54:00:09:a4:37'/>
+ <model type='virtio'/>
+ <address type='virtio-mmio'/>
+ </interface>
+ <serial type='pty'>
+ <target type='system-serial' port='0'>
+ <model name='16550a'/>
+ </target>
+ </serial>
+ <console type='pty'>
+ <target type='serial' port='0'/>
+ </console>
+ <channel type='unix'>
+ <target type='virtio' name='org.qemu.guest_agent.0'/>
+ <address type='virtio-serial' controller='0' bus='0'
port='1'/>
+ </channel>
+ <audio id='1' type='none'/>
+ <memballoon model='virtio'>
+ <address type='virtio-mmio'/>
+ </memballoon>
+ <rng model='virtio'>
+ <backend model='random'>/dev/urandom</backend>
+ <address type='virtio-mmio'/>
+ </rng>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index dff0241c53..c21e34b477 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -913,8 +913,10 @@ mymain(void)
/* Simple headless guests for various architectures */
DO_TEST_CAPS_ARCH_LATEST("aarch64-virt-headless", "aarch64");
+ DO_TEST_CAPS_ARCH_LATEST("aarch64-virt-headless-mmio",
"aarch64");
DO_TEST_CAPS_ARCH_LATEST("ppc64-pseries-headless", "ppc64");
DO_TEST_CAPS_ARCH_LATEST("riscv64-virt-headless", "riscv64");
+ DO_TEST_CAPS_ARCH_LATEST("riscv64-virt-headless-mmio",
"riscv64");
DO_TEST_CAPS_ARCH_LATEST("s390x-ccw-headless", "s390x");
DO_TEST_CAPS_ARCH_LATEST("x86_64-pc-headless", "x86_64");
DO_TEST_CAPS_ARCH_LATEST("x86_64-q35-headless", "x86_64");
--
2.43.0