From 2f56f69f7f7e0e4bbaa96158f65a7f463898490f Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Thu, 2 Mar 2023 17:59:01 +0100 Subject: [PATCH] tests: Create privileged config for QEMU driver Our QEMU test suite effectively covers the qemu:///system scenario, and we have to partially replace the unprivileged config with its privileged equivalent after the fact to keep up the illusion. Instead of jumping through these extra hoops, we can simply start with a privileged configuration matching the privileged driver we're creating for test programs. This change highlights that we were missing a couple of overrides, specifically in the tests for passt and dbus. Now that we're creating a privileged config, this kind of issue shouldn't be able to slip into the test suite. Signed-off-by: Andrea Bolognani Reviewed-by: Martin Kletzander --- tests/qemuxml2argvdata/graphics-dbus.args | 2 +- tests/qemuxml2argvdata/net-user-passt.x86_64-7.2.0.args | 2 +- tests/qemuxml2argvdata/net-user-passt.x86_64-latest.args | 2 +- tests/testutilsqemu.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/qemuxml2argvdata/graphics-dbus.args b/tests/qemuxml2argvdata/graphics-dbus.args index a804ae06ee..89b4ff78c6 100644 --- a/tests/qemuxml2argvdata/graphics-dbus.args +++ b/tests/qemuxml2argvdata/graphics-dbus.args @@ -25,6 +25,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -no-acpi \ -boot strict=on \ -usb \ --display dbus,addr=unix:path=/bad-test-used-env-xdg-runtime-dir/libvirt/qemu/run/dbus/-1-QEMUGuest1-dbus.sock \ +-display dbus,addr=unix:path=/var/run/libvirt/qemu/dbus/-1-QEMUGuest1-dbus.sock \ -device cirrus-vga,id=video0,bus=pci.0,addr=0x2 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/net-user-passt.x86_64-7.2.0.args b/tests/qemuxml2argvdata/net-user-passt.x86_64-7.2.0.args index 037dabb87d..eb165abb90 100644 --- a/tests/qemuxml2argvdata/net-user-passt.x86_64-7.2.0.args +++ b/tests/qemuxml2argvdata/net-user-passt.x86_64-7.2.0.args @@ -30,7 +30,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -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}' \ --netdev '{"type":"stream","addr":{"type":"unix","path":"/bad-test-used-env-xdg-runtime-dir/libvirt/qemu/run/passt/-1-QEMUGuest1-net0.socket"},"server":false,"id":"hostnet0"}' \ +-netdev '{"type":"stream","addr":{"type":"unix","path":"/var/run/libvirt/qemu/passt/-1-QEMUGuest1-net0.socket"},"server":false,"id":"hostnet0"}' \ -device '{"driver":"rtl8139","netdev":"hostnet0","id":"net0","mac":"00:11:22:33:44:55","bus":"pci.0","addr":"0x2"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ diff --git a/tests/qemuxml2argvdata/net-user-passt.x86_64-latest.args b/tests/qemuxml2argvdata/net-user-passt.x86_64-latest.args index 88e1ff26a6..d2e8fc4440 100644 --- a/tests/qemuxml2argvdata/net-user-passt.x86_64-latest.args +++ b/tests/qemuxml2argvdata/net-user-passt.x86_64-latest.args @@ -29,7 +29,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -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}' \ --netdev '{"type":"stream","addr":{"type":"unix","path":"/bad-test-used-env-xdg-runtime-dir/libvirt/qemu/run/passt/-1-QEMUGuest1-net0.socket"},"server":false,"reconnect":5,"id":"hostnet0"}' \ +-netdev '{"type":"stream","addr":{"type":"unix","path":"/var/run/libvirt/qemu/passt/-1-QEMUGuest1-net0.socket"},"server":false,"reconnect":5,"id":"hostnet0"}' \ -device '{"driver":"rtl8139","netdev":"hostnet0","id":"net0","mac":"00:11:22:33:44:55","bus":"pci.0","addr":"0x2"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 9983130399..073a86c708 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -629,7 +629,7 @@ int qemuTestDriverInit(virQEMUDriver *driver) return -1; driver->hostarch = virArchFromHost(); - driver->config = virQEMUDriverConfigNew(false, NULL); + driver->config = virQEMUDriverConfigNew(true, NULL); if (!driver->config) goto error;