Commit Graph

8733 Commits

Author SHA1 Message Date
Boris Fiuczynski
e67bca23e4 nodedev: add an active config to mdev
The configuration of a defined mdev can be modified after the mdev is
started. The defined configuration and the active configuration can
therefore run out of sync. Handle this by storing the modifiable data
which is the mdev type and attributes in two separate active and
defined configurations. mdevctl supports with callout scripts to do an
attribute retrieval of started mdevs which is already implemented in
libvirt.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-02-26 10:59:47 +01:00
Michal Privoznik
7b694f43f2 qemuxmlconftest: Introduce memory-hotplug-nvdimm-overlap test case
This new test case checks whether we are handling NVDIMMs
correctly when checking for overlapping memory devices (see
previous commit). Without previous commit, this test case would
fail, yet it was produced in real life (at least the NVDIMM
part) and thus it is valid.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2024-02-22 10:54:07 +01:00
Tim Wiederhake
986be35f2e cpu_map: Sort cpu features
Some feature words were not sorted correctly.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2024-02-20 17:29:27 +01:00
Andrea Bolognani
1664b1414e all: Don't use 'grep -q'
It's not portable.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2024-02-19 10:29:24 +01:00
Andrea Bolognani
20a5f77156 tests: Add capabilities for QEMU 8.2.0 on s390x
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-02-12 11:28:14 +01:00
Andrea Bolognani
f9ed4d385a tests: Update capabilities for QEMU 8.1.0 on s390x
The existing capabilities were generated against a build made
quite early in the QEMU 8.1.0 development cycle. Update them
to match the final release.

A notable effect of this is that the recently introduced
s390-usb-model test now passes instead of failing: QEMU 8.1.0
enables several new devices on s390x, including the qemu-xhci
USB controller.

There's a small amount of additional churn caused by the fact
that the machine on which I have generated these capabilities
is apparently slightly less fancy than the one used originally.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-02-12 11:28:12 +01:00
Andrea Bolognani
6e58fba9e4 tests: Add s390-usb-model
Show what happens when trying to use a specific type of USB
controller. This currently fails because the QEMU binary doesn't
include the necessary device.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-02-12 11:28:11 +01:00
Andrea Bolognani
c1ae871893 tests: Minimize s390-usb-*
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-02-12 11:28:09 +01:00
Andrea Bolognani
44257d1e93 tests: Rename s390-usb-*
These tests currently cover the scenarios in which the guest
can end up with no USB controller, one of which is specific
to s390x. We are going to add more USB on s390x scenarios, so
a different naming convention is needed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-02-12 11:28:04 +01:00
Jonathon Jongsma
bdece5518d qemu: fix nbdkit command test for backing chains
Previously this test only tested the generated nbdkit command for the
top level disk source. Update it to test the generated commmands for all
sources in the chain.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-02-09 14:45:20 -06:00
Jiri Denemark
22ba0b39ff tests: Add tests for virSystemdResolvedRegisterNameServer
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-07 14:19:42 +01:00
Peter Krempa
6eaf3614b6 qemuBlockStorageSourceNeedsFormatLayer: Stop formatting 'raw' driver when not needed
The 'raw' driver without any special configuration is not needed and
creates overhead in qemu.

Stop using the 'raw' format driver in cases when it's not needed. A
special case when it is needed is for FD passed images with only a
single writable FD passed, where we need an overlay driver to properly
reflect the 'read-only' flag.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-02 16:03:08 +01:00
Peter Krempa
c38b4e34c8 qemu: capabilities: Introduce QEMU_CAPS_BLOCKJOB_BACKING_MASK_PROTOCOL
The capability is asserted when both block-stream and block-commit QMP
commands support the 'backing-mask-protocol' argument.

The argument causes qemu to record 'raw' as the backing file format in
case when a protocol node is used directly. This is needed to preserve
compatibility of images after a block-commit or block-pull libvirt
operation with older libvirt versions in case when we'll want to remove
the unneded 'raw' format drivers from the block graph.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-02 16:03:08 +01:00
Peter Krempa
8c07850c18 tests: qemucapabilitiesdata: Update 'caps_9.0.0_x86_64.replies'
Update to 'v8.2.0-952-g14639717bf'.

Notable changes:
 - 'backing-mask-protocol' feature added for block-commit and block-stream
 - 'singlestep' mode dropped
 - 'cmpccxadd' cpu feature became available

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-02 16:03:08 +01:00
Peter Krempa
29aa1c2f4c qemumonitortestutils: Unexport 'qemuMonitorTestProcessFileEntries'
Unexport the function and 'struct qemuMonitorTestCommandReplyTuple' as
they are currently used only in tests/qemumonitortestutils.c

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-02-01 10:39:40 +01:00
Peter Krempa
19f9cf2ae8 tests: Remove 'qemucapabilitiesnumbering' test
The test case was completely replaced by the 'qemu-replies-tool.py'
script in default mode.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-02-01 10:39:40 +01:00
Peter Krempa
2866c1a457 scripts: Add 'qemu-replies-tool' script for testing and modifying data for qemucapabilitiestest
The tool in the current shape functionally replaces
tests/qemucapabilitiesnumbering.c

It validates that the output '.replies' files conform to how we generate
them from qemu and also allows programmatic modification of the
'.replies' files if re-generation is not feasible any more.

The main advantage is that JSON objects are parsed into native python
types and thus the programatic modification is much more convenient.

The tool will be later extended to also do validation that we properly
handle the whole of QMP schema as well as help in reviewing the
differences in the .replies file after qemu updates.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-02-01 10:39:40 +01:00
Peter Krempa
ff7e50e20a tests: qemucaps: Make JSON output identical to python's 'json.dump' method
YAJL formats empty objects and arrays in a weird way:

 {
   "emptyarray": [

   ],
   "emptyobject": {

   }
 }

We want to use empty lines to separate commands and replies as well as
be compatible with python's 'json.dump' method, thus we drop any
whitespace between array/object braces.

Adjust the two formatters which are used for capabilities and fix all
output files.

Note that the code is duplicated in qemucapabilitiesnumbering.c and
qemucapsprobemock.c, but later patches will replace
qemucapabilitiesnumbering.c by a python tool.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-02-01 10:39:40 +01:00
Andrea Bolognani
0d095c6d47 tests: Add controller-scsi-auto
The "auto" SCSI controller model was introduced for use in the
ESX driver, but the QEMU driver doesn't reject the value.

Add a test case showing the behavior when such a configuration
is encountered.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2024-02-01 10:37:16 +01:00
Peter Krempa
e1dc851e7c virPCIDeviceGetVPD: Handle errors in callers
Until now 'virPCIDeviceGetVPD' couldn't reallistically raise an error,
but that will change. Handle the errors by either resetting it if we'd
be ignoring it or forward it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-01-31 17:24:07 +01:00
Peter Krempa
9aa303a948 util: virpcivpd: Remove return value from virPCIVPDResourceUpdateKeyword
The function always succeeded and after the removal of programing error
checks doesn't even have a 'return false' case. Additionally one of the
tests in 'virpcivpdtest' tested that this function never failed on wrong
data. Embrace this logic and remove the return value and adjust logging
to VIR_DEBUG level to avoid spamming logs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-01-31 17:24:07 +01:00
Peter Krempa
e8f5edf556 virpcivpdtest: testPCIVPDResourceBasic: Remove tests for uninitialized 'ro'/'rw' section
This is a synthetic case which tests the behaviour if the 'ro' or 'rw'
struct members are uninitialized, basically excercising only a pointless
programming-error NULL check in 'virPCIVPDResourceUpdateKeyword' as real
usage does always pass a proper pointer.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-01-31 17:24:07 +01:00
Peter Krempa
d36da8ea4a util: virpcivpd: Remove return value from virPCIVPDResourceCustomUpsertValue
None of the callers pass NULL, so the NULL check is pointless. Remove it
an remove the return value.

The function is exported only for use in 'virpcivpdtest' thus marking
the arguments as NONNULL is unnecessary.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-01-31 17:24:07 +01:00
Peter Krempa
78e17cd550 tests: virpcivpd: Remove 'testVirPCIVPDParseVPDStringResource' case
The test case excercises 'virPCIVPDParseVPDLargeResourceString' which is
also tested by other cases which parse the whole VPD block. Remove the
specific test case as it's not adding any additional value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-01-31 17:24:07 +01:00
Peter Krempa
1a994a9dc6 tests: virpcivpdtest: Remove 'testVirPCIVPDReadVPDBytes' case
The case checks only the 'virPCIVPDReadVPDBytes' which is also tested
multiple times via 'virPCIVPDParse' as it's used to read the data, thus
having a special case for this is pointless.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-01-31 17:24:07 +01:00
Peter Krempa
9eda33161f tests: Test the previously mishandled PCI VPD characters
Modify the test data to validate '<>' and other characters.
Unfortunately the test suite doesn't have a proper end-to-end test, thus
we just add a XML->XML variant and also add data to the binary parser.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-01-31 17:24:07 +01:00
Andrea Bolognani
42ed1d6818 tests: Add default-models cases for many architectures
These are similar to the minimal cases that we just introduced,
but are intended to demonstrate what device or controller model
libvirt will choose when one is not provided by the user.

Note that we want both regular and ABI_UPDATE variants of the
various test cases because, in some cases, the behavior for new
guests is not the same as that for existing ones due to backward
compatibility concerns.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-01-30 10:58:13 +01:00
Andrea Bolognani
c731b3ed84 tests: Drop minimal
We have just added a number of test cases that supersede it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-01-30 10:58:13 +01:00
Andrea Bolognani
886654c3e6 tests: Add minimal cases for many architectures
We currently have a single test case called "minimal", which
suffers from two big flaws:

  * it's limited to the x86_64/pc machine type;
  * it explicitly enables a number of devices.

Add several test cases, one for each of the architectures and
machine types that we have good support for.

Unlike the existing one, they're *really* minimal: no devices
or controllers at all are present in the input XML. So the new
test cases demonstrate exactly what devices and controller
libvirt will decide to add automatically.

Note that we want both regular and ABI_UPDATE variants of the
various test cases because, in some cases, the behavior for new
guests is not the same as that for existing ones due to backward
compatibility concerns.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-01-30 10:58:13 +01:00
Andrea Bolognani
ffbd71a041 tests: Rename and minimize no-memory
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-01-30 10:58:13 +01:00
Andrea Bolognani
9e8f6624fa tests: Add aarch64-panic-no-model
This demonstrates that on aarch64, where a native panic device
doesn't exist, it's necessary for the user to specify the model
explicitly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-01-30 10:58:13 +01:00
Andrea Bolognani
08f8119a01 tests: Add usb-controller-automatic-unavailable-q35
For q35 guests, we normally add a USB controller by default,
but there's a scenario in which we can decide to skip it. Add
test coverage for it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-01-30 10:58:13 +01:00
Andrea Bolognani
001fa58ad8 tests: Drop existing <title> and <description> tags
Now that we have an explicit test case for the feature in
genericxml2xmltest, we can drop a bunch of duplicated accidental
coverage from qemuxmlconftest.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-01-30 10:58:13 +01:00
Andrea Bolognani
d268f1b293 tests: Add title-and-description
We have a few cases in qemuxmlconftest that cover the ability
to set <title> and <description> for a guest as a side effect.

Introduce an explicit case for the functionality in
genericxml2xmltest, as it's not specific to the QEMU driver.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-01-30 10:58:13 +01:00
Michal Privoznik
dab99eedcd qemu_command: Generate cmd line for virtio-mem dynamicMemslots
This is pretty straightforward.

Resolves: https://issues.redhat.com/browse/RHEL-15316
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-01-30 10:44:36 +01:00
Michal Privoznik
497cab753b qemu_capabilities: Add QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS capability
Starting from v8.2.0-rc0~74^2~2 QEMU has .dynamic-memslots
attribute for virtio-mem-pci device. Introduce a capability which
reflects that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-01-30 10:44:36 +01:00
Michal Privoznik
5325820585 conf: Introduce dynamicMemslots attribute for virtio-mem
Introduced in v8.2.0-rc0~74^2~2, QEMU now allows setting
.dynamic-memslots attribute for virtio-mem-pci devices. When
turned on, it allows memory exposed to guest to be split into
multiple memslots and thus smaller memory footprint (see the
original commit for detailed explanation).

Therefore, introduce new <target/> attribute which will control
that QEMU knob.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-01-30 10:44:36 +01:00
Andrea Bolognani
7d9fe3a637 tests: Improve ABI_UPDATE macros
There are a number of cases in which we want to test both the
normal behavior and the ABI_UPDATE behavior for the same input
XML.

The way this is currently implemented is ad-hoc, and involves
symlinking the input XML as well as coming up with an
alternative name for the ABI_UPDATE variant: in most cases the
-abi-update suffix is added, but since this is not enforced
there are a couple of cases where we do something else instead.

To make things simpler and more consistent, implement the
naming convention at the macro level. This way, we no longer
need to create any symlinks for the input file, and the output
files are automatically named correctly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-01-26 15:47:30 +01:00
Andrea Bolognani
2fa36ebc5b tests: Use ABI_UPDATE macros more
In one case, the macro was open-coded.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-01-26 15:47:27 +01:00
Andrea Bolognani
f0c3080342 tests: Drop ppc64-usb-controller-legacy
The input file is a symlink for the ppc64-usb-controller input
file, so the output files are identical as well. It's just an
unnecessary duplicate.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-01-26 15:47:24 +01:00
Michal Privoznik
ada491fded vmx2xmltest: Add another test case
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-01-25 16:26:45 +01:00
Jonathon Jongsma
873eec32d5 tests: Remove readahead and timeout from ssh tests
These values are currently unsupported for ssh disks, and in fact aren't
even parsed for ssh disks. So while this didn't result in any test
errors, we can remove them from the test input files.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
2024-01-24 07:45:34 -06:00
Peter Krempa
20e13e3bdc qemuxmlconftest: Move 'qemuxml2xmloutdata' into 'qemuxmlconfdata'
Unify the output directory. Symlinks needed to be adapted to work
properly, but the 'qemuxml2argvdata' symlink can now be removed.

The virschematest exceptions needed to be moved to the proper directory
once the files are moved.

The unification of the output directory now also ensures that files
won't be forgotten once tests are removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-01-24 09:19:28 +01:00
Peter Krempa
fb6b391672 qemuxmlconftest: Move data directory 'qemuxml2argvdata' to 'qemuxmlconfdata'
Unify the naming of the data directory with the test name.

'tests/qemuxml2argvdata' is for the time converted to a symlink to
'qemuxmlconfdata', to preserve the symlinks in
'tests/qemuxml2xmloutdata'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-01-24 09:19:28 +01:00
Peter Krempa
4702d40aa0 qemuxml2xmloutdata: Drop unused output files
Remove leftover output files. The list of files was identified by
temporarily hacking testConfXMLEnumerate to also enumerate
'tests/qemuxml2xmloutdata' directory.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-01-24 09:19:27 +01:00
Peter Krempa
8266d80daf qemuxmlconftest: Check also output files for usage
Include also the output files in the validation of used files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-01-24 09:19:27 +01:00
Peter Krempa
3e11939e6e qemuxmlconftest: Populate output/error file only when needed
Populate the output filename strings only when the files are expected to
exist, so that other logic can be based on the presence of the strings
rather than having to re-check the test flags for expected state.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-01-24 09:19:27 +01:00
Peter Krempa
f997fcca71 virschematest: Don't bother checking symlinked XMLs
There's plenty symlinks in qemuxml2argvdata and qemuxml2xmlout
directories pointing to other files in the same directory. It makes no
sense to check those files twice, thus we can simply skip symlinks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-01-24 09:19:27 +01:00
Andrea Bolognani
e622233eda qemu: Retire QEMU_CAPS_OBJECT_GPEX
It's no longer used anywhere.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-01-17 19:28:19 +01:00
Andrea Bolognani
b519a4cc9d tests: Request virtio-mmio for balloon-mmio-deflate
For all supported QEMU version, the virt machine type has a hard
dependency on PCI support, so if we want to test virtio-balloon
together with virtio-mmio we have to either request that
explicitly or trick libvirt by masking capabilities. Do the
former instead of the latter.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-01-17 19:27:53 +01:00