Commit Graph

864 Commits

Author SHA1 Message Date
Peter Krempa
351504744e qemuxml2(argv|xml)test: Remove 'sound' case
The test case is a subset of what the 'sound-device' case tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-05-09 15:12:03 +02:00
Ján Tomko
03ca889b15 qemu: allow forcing emulated maxphysaddr
Treat:
  <maxphysaddr mode="emulate"/>
as a request not to take the maximum address size from the host.
This is useful if QEMU changes the default.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-04-25 11:19:37 +02:00
Ján Tomko
d6fbb21210 conf: cpu: add limit for maxphysaddr
Add a limit attribute to restrict the maximum physical address bits
that would be used for the guest CPU:

   <cpu mode='host-passthrough'>
     <maxphysaddr mode='passthrough' limit='39'/>
   </cpu>

https://gitlab.com/libvirt/libvirt/-/issues/450
https://bugzilla.redhat.com/show_bug.cgi?id=2171860

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-04-25 11:19:37 +02:00
Andrea Bolognani
f9ad302335 conf: Fix migration in some firmware autoselection scenarios
Introduce a small kludge in the parser to avoid unnecessarily
blocking incoming migration from a range of recent libvirt
releases.

https://bugzilla.redhat.com/show_bug.cgi?id=2184966

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-12 18:03:21 +02:00
Peter Krempa
962bf7c9a5 qemuxml2xmltest: Convert rest of 'aarch64' cases to real capabilities
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-11 10:08:32 +02:00
Peter Krempa
bd4da926b1 qemuxml2xmltest: Modernize 'mach-virt*' cases
Use real capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-11 10:08:32 +02:00
Peter Krempa
74d4876d20 qemuxml2xmltest: Modernize 'aarch64-gic*' test cases
Use real capabilities for them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-11 10:08:32 +02:00
Peter Krempa
2449907112 qemuxml2(argv|xml)test: Modernize testing of USB controllers on aarch64
All supported qemu versions at this point support both 'qemu-xhci' and
'nec-xhci' controllers. To allow using real capabilities restructure the
tests so that we test both controllers explicitly as well as the
selection of the default model.

Also add a xml2xml test invocation of the unified test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-11 10:08:32 +02:00
Peter Krempa
c42753524e qemuxml2*test: Drop fake-caps invocation of 'aarch64-virtio-pci-manual-addresses'
The fake-caps version was kept as an example that the code behaves the
same with real capabilities. Now it's not needed any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-11 10:08:32 +02:00
Peter Krempa
f217410a47 qemuxml2argvtest: Update 'aarch64-virtio-pci-manual-addresses' case
With all supported qemu versions we'll pick PCIe to use for the implicit
address busses (those lacking an explicit controller) and thus the
addresses must reflect that.

Update the test to add the new flags, and fix the addresses.
Additionally add a real-caps version of the test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-11 10:08:32 +02:00
Peter Krempa
a5bd444cb2 qemuxml2xmltest: Convert all s390 test cases to real capabilities
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-04-03 09:19:08 +02:00
Peter Krempa
a2c4503021 qemuxml2xmltest: Modernize all remaining 'ppc64' 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
bfc5955406 qemuxml2xmltest: 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
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
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
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
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
3c02b1e810 tests: qemu: Move testing of default cache and disk source with space to 'sata-device'
Integrate the two special cases used for schema testing into the more
useful qemuxml2argvtest, whose input data is still tested against the
schema.

Add also a xml output variant.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-03-06 20:55:49 +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
Peter Krempa
8442645126 qemuxml2(argv|xmltest): Simplify testing of scheduler settings
Remove the cputune-iothreads, cputune-iothreadsched-zeropriority,
cputune-iothreadsched test files by moving the relevant elements into
the cputune case as we can setup scheduler settings for multiple objects
and thus test everything in one go.

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
17bc74e02d qemuxml2xmltest: Modernize iothread CWW/SCSI test cases
The argv counterparts are already modernized.

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
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
6f1c6534a8 tests: Add more firmware tests
These cover scenarios such as using the new, more verbose
format of the <nvram> element to point to a local path, mixing
firmware autoselection with non-local NVRAM files, and
explicitly disabling SMM when using firmware autoselection.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-03-03 13:40:53 +01:00
Andrea Bolognani
54f90a825e tests: Enable qemuxml2xml for more firmware tests
Some of the test cases had only been added to the xml2argv
test program and not to the xml2xml one.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-03-03 13:40:48 +01:00
Andrea Bolognani
87ab00fdcb tests: Move firmware tests to CAPS_LATEST
This is already the case for the vast majority, but a few are
using explicit capabilities lists.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-03-03 13:40:38 +01:00
Andrea Bolognani
2adc24fc6a tests: Set nvramDir in qemuxml2xmltest
We already do this in qemuxml2argvtest.

Right now setting this doesn't change anything, but it will
become relevant later.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-03-03 13:40:24 +01:00
Laine Stump
dffc40db69 qemu: add check for QEMU_CAPS_NETDEV_STREAM during validation
In commit 5af6134e I had added a new capability that is true if QEMU
allows "-netdev stream", but somehow neglected to actually check it in
commit a56f0168d when hooking up passt support to qemu. This isn't
catastrophic, since QEMU itself will still report an error, but that
error isn't as easy to understand as a libvirt-generated error.

Fixes: a56f0168d5
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-02-22 07:36:45 -05:00
Kristina Hanicova
78744415fe tests: add case for pvpanic-pci without address
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2023-02-21 17:51:28 +01:00
Kristina Hanicova
f4367059d2 tests: add test cases for device pvpanic-pci
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2023-02-21 17:51:24 +01:00
Martin Kletzander
1c61bd718a Support multiple watchdog devices
This is already possible with qemu, and actually already happening with
q35 machines and a specified watchdog since q35 already includes a
watchdog we do not include in the XML.  In order to express such
posibility multiple watchdogs need to be supported.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-01-26 16:40:30 +01:00
zhenwei pi
7ba22d21a1 conf: introduce crypto device
Introduce crypto device like:

  <crypto model='virtio' type='qemu'>
    <backend model='builtin' queues='1'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
  </crypto>

  <crypto model='virtio' type='qemu'>
    <backend model='lkcf'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
  </crypto>

Currently, crypto model supports virtio only, type supports qemu only
(vhost-user in the plan). For the qemu type, backend supports modle
builtin/lkcf, and the queues is optional.

Changes in this commit:
- docs: formatdomain.rst
- schemas: domaincommon.rng
- conf: crypto related domain conf
- qemu: crypto related
- tests: crypto related test

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-01-25 16:00:42 +01:00
Laine Stump
a8ee7ae301 conf: parse/format passt-related XML additions
This implements XML config to represent a subset of the features
supported by 'passt' (https://passt.top), which is an alternative
backend for emulated network devices that requires no elevated
privileges (similar to slirp, but "better").

Along with setting the backend to use passt (via <backend
type='passt'/> when the interface type='user'), we also support
passt's --log-file and --interface options (via the <backend>
subelement logFile and upstream attributes) and its --tcp-ports and
--udp-ports options (which selectively forward incoming connections to
the host on to the guest) via the new <portForward> subelement of
<interface>. Here is an example of the config for a network interface
that uses passt to connect:

    <interface type='user'>
      <mac address='52:54:00:a8:33:fc'/>
      <ip address='192.168.221.122' family='ipv4'/>
      <model type='virtio'/>
      <backend type='passt' logFile='/tmp/xyzzy.log' upstream='eth0'/>
      <portForward address='10.0.0.1' proto='tcp' dev='eth0'>
        <range start='2022' to='22'/>
        <range start='5000' end='5099' to='1000'/>
        <range start='5010' end='5029' exclude='yes'/>
      </portForward>
      <portForward proto='udp'>
        <range start='10101'/>
      </portForward>
    </interface>

In this case:

* the guest will be offered address 192.168.221.122 for its interface
  via DHCP

* the passt process will write all log messages to /tmp/xyzzy.log

* routes to the outside for the guest will be derived from the
  addresses and routes associated with the host interface "eth0".

* incoming tcp port 2022 to the host will be forwarded to port 22
  on the guest.

* incoming tcp ports 5000-5099 (with the exception of ports 5010-5029)
  to the host will be forwarded to port 1000-1099 on the guest.

* incoming udp packets on port 10101 will be forwarded (unchanged) to
  the guest.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-01-09 14:24:27 -05:00
Peter Krempa
fe6077585e qemuxml2*test: Enable testing of disks with 'fdgroup'
Enable the qemuxml2xml variant and add output data for qemuxml2argvtest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2023-01-09 14:59:43 +01:00
Peter Krempa
608c4b249e qemuxml2xmltest: Remove 'disk-backing-chain' case and output files
The test is superseded by 'disk-backing-chains-(no)index' cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2023-01-06 15:31:16 +01:00