Commit Graph

1603 Commits

Author SHA1 Message Date
Peter Krempa
5887466ec6 qemuxml2argvtest: Convert rest of s390 tests to real caps
Convert the rest of the outstanding tests to use real capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-03 09:19:07 +02:00
Peter Krempa
2572d991ee qemuxml2argvtest: Modernize s390 cpu tests
Use real capabilities for the CPU test. The negative test case for QEMUs
without QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION is removed as the feature is
now supported by all supported qemu versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-03 09:19:07 +02:00
Peter Krempa
85a30c7570 qemuxml2argvtest: Modernize all s390 'loadparm' tests
Use latest caps for the tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-03 09:19:07 +02:00
Peter Krempa
3429ddf6ec qemuxml2argvtest: Modernize all s390 'keywrap' tests
Use latest caps for the tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-03 09:19:07 +02:00
Peter Krempa
5203380907 qemuxml2argvtest: Remove obsolete negative tests
The 'hostdev-subsys-mdev-vfio-ccw', 'hostdev-vfio-zpci', and
'hostdev-vfio-zpci-autogenerate-fids' test cases have negative versions
which are invoked without capabilities. This does not make sense going
forward as the tests are going to be switched to real capabilities.

Remove them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-03 09:19:07 +02:00
Peter Krempa
c523377e19 qemuxml2argvtest: Use real capabilities for negative test cases for ppc64 architecture
Convert the last outstanding test cases for ppc64 to use real
capabilities.

In couple cases this actually fixes the test case to test what it was
intending to do.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-03 09:19:07 +02:00
Peter Krempa
21b9f65ec0 qemuxml2argvtest: Drop negative test cases for 'pseries' machine features
All of the tested features are always present in the 'pseries' machine
with oldest-supported qemu-4.2, thus the tests don't make sense any
more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-03 09:19:07 +02:00
Peter Krempa
8f430f453b qemuxml2argvtest: Add '4.2.0' version of 'pseries-features' test case
Add an example case showing that every feature in the 'pseries-features'
test works also with the oldest supported qemu version.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-03 09:19:07 +02:00
Peter Krempa
dba5bad2a7 qemuxml2argvtest: Modernize all 'ppc64' remaining test cases
Switch them to use latest caps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-03 09:19:07 +02:00
Peter Krempa
83967a9ed2 testQemuGetRealCaps: Integrate fetching of QMP schema
Move the lookup of the corresponding QMP schema used for validation of
QMP commands from 'testCompareXMLToArgvValidateSchema' to
testQemuGetRealCaps as an optional step.

This will simplify using QMP command validation in other tests which
will use testQemuGetRealCaps.

'testutilsqemuschema' module is now linked into 'test_utils_qemu' as it
contains no monitor-specific code itself and after this patch it's
referenced directly from that module.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-03 09:19:07 +02:00
Peter Krempa
8704a59e21 qemuxml2argvtest: Remove infrastructure for fake-caps testing on OSX
The last tests using it were refactored to use real capabilities and no
new tests should ever use it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-03 09:19:07 +02:00
Peter Krempa
131493cf68 qemuxml2(argv|xml): Convert "hvf-aarch64-virt-headless" test case to real capabilities
Rather than using fake data and faking the host use the newly introduced
support for test variants to test the OSX HVF qemu version with real
data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-03 09:19:07 +02:00
Peter Krempa
1d1f22f478 qemuxml2(argv|xml): Convert "hvf-x86_64-q35-headless" test case to real capabilities
Rather than using fake data and faking the host use the newly introduced
support for test variants to test the OSX HVF qemu version with real
data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-03 09:19:07 +02:00
Andrea Bolognani
6bafa74d62 tests: Add firmware-auto-efi-abi-update-aarch64 test case
The input is identical to that of the existing
firmware-auto-efi-aarch64 test, but in this case we want to
cover the scenario in which that input is used to define a new
domain rather than loading the definition of an existing domain
from disk.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-03-28 12:41:32 +02:00
Andrea Bolognani
d7aaa715bd tests: Introduce DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE()
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-03-28 12:41:05 +02:00
Andrea Bolognani
ccf4aa37a0 conf: Remove some firmware validation checks
libvirt 8.6.0 introduced these checks and very clearly delineated
two possible firmware selection scenarios: manual firmware
selection, where the user is responsible for providing all
information, and firmware autoselection, where a list of desired
features is provided and everything else is handled by libvirt.

In the interest of maintaining the clear separation between these
two scenarios, setting most attributes when firmware autoselection
is active will result in the configuration being rejected.

This works fine, but is unnecessarily restrictive: in most cases,
the additional information that the user has provided matches
the information that libvirt would have discovered on its own by
looking at firmware descriptors, and asking the user to scrub it
from the XML only result in pointless friction.

Remove these checks entirely.

Unsurprisingly, this results in a few test cases that were
rejected until now to suddenly start working and producing
sensible results.

The firmware-auto-efi-loader-path-nonstandard test case is
notable: while we can now enable the xml2xml part of the test,
the xml2argv part is still failing, although in a slightly
different way. This is expected: since the firmware binary is a
non-standard one, libvirt is unable to figure out the missing
information from a firmware descriptor, and the configuration
is still ultimately an invalid one. However, if we were to find
such a configuration on disk at daemon startup, we would not
ignore it completely and instead would offer the user a chance
to fix it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-03-22 13:49:53 +01:00
Andrea Bolognani
bf6a6f90a9 tests: Add more tests for manual Secure Boot configuration
These cover the same scenarios as the matching test cases for
autoselection.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-03-22 13:49:53 +01:00
Andrea Bolognani
66e5c43a03 tests: Add firmware-auto-efi-loader-path
This is identical to the existing
firmware-auto-efi-loader-path-nonstandard test case, but uses
a standard firmware path.

Right now the two test cases behave identically, but that's
going to change in the future.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-03-22 13:49:53 +01:00
Andrea Bolognani
bfb507853a tests: Rename a few firmware tests
This unifies the naming between the manual and automatic
selection cases, clarifies the contents of the tests and makes
room for more tests being added in the future.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-03-22 13:49:53 +01:00
Or Ozeri
5589a3e1f3 qemu: add luks-any encryption support for RBD images
The newly added luks-any rbd encryption format in qemu
allows for opening both LUKS and LUKS2 encryption formats.
This commit enables libvirt uses to use this wildcard format.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2023-03-16 15:19:36 +01:00
Or Ozeri
77c9663d72 qemu: add support for librbd layered encryption
This commit enables libvirt users to use layered encryption
of RBD images, using the librbd encryption engine.
This allows opening of an encrypted cloned image
whose parent is encrypted with a possibly different encryption key.
To open such images, multiple encryption secrets are expected
to be defined under the encryption XML tag.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2023-03-16 15:19:36 +01:00
Michal Privoznik
28ec9d86b3 qemuxml2argvtest: Use virnuma mock
While no part of cmd line building process currently depends on a
host NUMA configuration, this will change soon. Use freshly
changed virnumamock from qemuxml2argvtest and make the mock read
NUMA data from vircaps2xmldata which seems to have the most rich
NUMA configuration.

This also means, we have to start building virnumamock
unconditionally. But this is not a problem, since nothing inside
of the mock relies on Linux specificity. The whole mock is merely
just reading files and parsing them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2023-03-15 12:46:24 +01:00
Eric Farman
97dddef48c qemuAppendLoadparmMachineParm: add loadparm from hostdev
Commit 54fa1b44af ("conf: Add loadparm boot option for a boot device")
added the ability to specify a loadparm parameter on a <boot/> tag, while
commit 29ba41c2d4 ("qemu: Add loadparm to qemu command line string")
added that value to the QEMU "-machine" command line parameters.

Unfortunately, the latter commit only looked at disks and network
devices for boot information, even though anything with
VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT could potentially have this tag.
In practice, a <hostdev> tag pointing to a passthrough (SCSI or DASD)
disk device can be used in this way, which means the loadparm is
accepted, but not given to QEMU.

Correct this, and add some XML/argv tests.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-03-10 08:54:05 +01:00
Jonathon Jongsma
168b0ca3fc qemu: Implement 'blob' support for virtio gpu
This can improve performance for some guests since it reduces copying of
display data between host and guest. Requires udmabuf on the host.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-08 13:05:05 -06:00
Peter Krempa
c0e60063c9 qemu: capabilities: Remove unused virQEMUCapsInitQMPBasicArch
The function doesn't set any capability and we don't want to add
arch-dependent always-peresent capabilities in the future.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-07 12:26:33 +01:00
Peter Krempa
1f01ce1e29 qemuxml2argvtest: Remove always asserted s390 capabilities
QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP and QEMU_CAPS_LOADPARM
are always asserted via virQEMUCapsInitQMPBasicArch thus don't need to
be explicitly enabled by tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-07 12:26:32 +01:00
Peter Krempa
f2212f4c2a qemuxml2argvtest: Don't set QEMU_CAPS_MACH_VIRT_GIC_VERSION
testUpdateQEMUCaps calls virQEMUCapsInitQMPBasicArch which already sets
it. Purge the capability from the testing code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-07 12:26:32 +01:00
Peter Krempa
9f805d3757 tests: qemuxml2argvdata: Port 'qemu-system-arm' cases with fake tests to 'qemu-system-aarch64'
'qemu-system-aarch64' is superset of the soon to be deprecated
'qemu-system-arm' binary. We can move over all of our fake-caps tests to
real caps on aarch64.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-06 20:55:50 +01:00
Peter Krempa
85644c24c8 qemu: Always assume QEMU_CAPS_CPU_AARCH64_OFF
We always assert the flag for aarch64 qemus and in qemu the 'aarch64'
cpu property doesn't seem to be optional.

Remove checks and remove impossible test case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-06 20:55:50 +01:00
Peter Krempa
b8fe04562f qemuxml2argvdata: Convert test cases for 'ppc' architecture to latest caps
Convert the 'ppc-dtb' and 'ppce500-serial' to use real capabilities
albeit captured from a non-native machine. Thus the XML needs to be
converted to use virt type 'qemu'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-06 20:55:50 +01:00
Peter Krempa
fe9b95d97d qemuxml2(argv|xml)test: Convert last fake-caps riscv64 tests to real caps
Preserve testing of the MMIO use case in case when GPEX is complied out
of qemu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-06 20:55:50 +01:00
Peter Krempa
27a69cc73c qemuxml2argvtest: Convert 'sparc-minimal' case to DO_TEST_CAPS_ARCH_LATEST
Convert the only outstanding test case for a 'sparc' machine to modern
test infrastructure.

'sparc' machine type also needs to be added to the list of supported
arches in testQemuGetLatestCaps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-06 20:55:50 +01:00
Peter Krempa
f0fec72e3f qemuTestCapsCacheInsert*: Drop the file cache rather than poisoning it
Make callers use virFileCacheClear to clear the cache before populating
it rather than trying to overwrite what's in it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-06 20:55:50 +01:00
Peter Krempa
856166a268 qemuxml2argvtest: Fix serial-unix-missing-source case
Use x86_64 emulator and machine and remove the nocaps version of the
test.

Fixes: 80a37e96a9
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-06 20:55:50 +01:00
Andrea Bolognani
09ac9e6d3c tests: Move more QEMU driver settings to common code
None of these settings is specific to the xml2argv test. Moving
them to the common code ensures the behavior of the QEMU driver
is consistent across all QEMU tests.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-03-06 14:35:35 +01:00
Andrea Bolognani
0f49b6cc6b tests: Drop no longer necessary overrides
Creating a privileged config ensures these are already set
correctly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-03-06 14:35:35 +01:00
Andrea Bolognani
d3fe9cc0f0 tests: Set the QEMU driver as privileged in common code
Most test programs were already doing this, and moving it to
the common code ensures we see consistent behavior across all
QEMU tests.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-03-06 14:35:35 +01:00
Andrea Bolognani
156cdf1967 tests: Limit use of TLSx509secretUUIDs
These are intended to be used for just a few specific tests,
but since we don't always free them up afterwards they could
end up accidentally affecting subsequent tests as well.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-03-06 14:35:35 +01:00
Andrea Bolognani
573def3a3f tests: Limit use of SPICE TLS
Follow the example of other similar settings and only enable it
for the few test cases that are actually about the specific
functionality, disabling it immediately afterwards.

A few test cases that were completely unrelated to SPICE TLS no
longer see the effects of having the feature enabled.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-03-06 14:35:35 +01:00
Andrea Bolognani
b4e8054a22 tests: Increase scope for SASLdirs
Just like TLSx509certdirs, these can be set throughout the
lifetime of the test program.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-03-06 14:35:35 +01:00
Andrea Bolognani
defa4dd430 tests: Drop unnecessary free
The various TLSx509certdirs can be set throughout the lifetime
of the test program without issue.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-03-06 14:35:35 +01:00
Peter Krempa
a27d3595a8 qemuxml2argvtest: Modernize negative cputune-* cases
Use latest caps for the tests even though the original test case didn't
need any capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-06 13:22:36 +01:00
Peter Krempa
d542d72f5c qemuxml2(argv|xml)test: Modernize 'cputune' test cases
Use DO_TEST_CAPS_LATEST for cputune-numatune, cputune-zero-shares,
cputune, and vcpu-placement-static cases. Do the necessary tweaks to
work with actual data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-06 13:22:36 +01:00
Peter Krempa
dcab6ad185 qemuxml2argvtest: Modernize the rest of 'iohtreads-*'
Use DO_TEST_CAPS_LATEST for the basic tests. The emulator needed to be
tweaked to work with the real caps data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-06 13:22:36 +01:00
Peter Krempa
ebc3323248 qemuxml2(argv|xml)test: Remove 'iothreads' case
'iothreads-disk' covers everything that 'iothreads' did in addition to
actually using the iothread.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-06 13:22:36 +01:00
Peter Krempa
cb98cdb84b qemuxml2argvtest: Remove 'iothreads-nocap'
All supported QEMU versions now support iothreads thus upcoming patches
will be removing the capability checks. Remove the 'iothreads-nocap'
case which will become invalid.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-06 13:22:36 +01:00
Andrea Bolognani
87b30e6965 tests: Move fakerootdir handling to common logic
Instead of having each test manually initialize and cleanup
its own fakerootdir, do that as part of the common test
initialization logic in virTestMain().

In most cases we can simply drop the relevant code from the
test program, but scsihosttest uses the value of fakerootdir
as a starting point to build another path, so we need to do
things slightly differently. In order to keep things working,
we retrieve the value from the LIBVIRT_FAKE_ROOT_DIR
environment variable, same as all the mock libraries are
already doing.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2023-03-03 13:52:37 +01:00
Andrea Bolognani
457a0183d6 tests: Adopt fakerootdir helpers
Most replacements are completely straightforward but
vircgrouptest requires slightly different handling because,
instead of initializing a single fakerootdir at the start of
the test program and cleaning it up at the end, it creates
multiple different ones one after the other.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2023-03-03 13:52:37 +01:00
Andrea Bolognani
44fb7659cc tests: Add more firmware tests
These cover various scenarios related to firmware formats,
specifically ensuring that all the ways in which the user can
ask for a non-default format to be used work correctly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-03-03 13:52:37 +01:00
Andrea Bolognani
22d0b644de qemu: Don't pick firmware that requires SMM when smm=off
At the moment, if SMM is explicitly disabled in the domain XML
but a firmware descriptor that requires SMM to be enabled has
the highest priority and otherwise matches the requirements,
we pick that firmware only to error out later, when the domain
is started.

A better approach is to take into account the fact that SMM is
disabled while performing autoselection, and ignore all
descriptors that advertise the requires-smm feature.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-03-03 13:49:56 +01:00