Commit Graph

49088 Commits

Author SHA1 Message Date
Erik Skultety
d3c6fb6a28 ci: build.sh: Don't mention that MESON_ARGS are available via CLI
Previous patches have removed the code that allowed injecting arbitrary
meson arguments, same for ninja args.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2023-09-12 10:36:13 +02:00
Erik Skultety
e61241d7f4 ci: build.sh: Add GIT_ROOT env helper variable
We'll use this one in many of the job functions future patches will
introduce, it's a neat shortcut to avoid using relative paths.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2023-09-12 10:36:13 +02:00
Erik Skultety
470596b850 ci: build.sh: Add variables from .gitlab-ci.yml
These are common variables we wish to use in containerized environments
both in GitLab and locally. Having these defined in a single place
rather than twice is highly preferable.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2023-09-12 10:36:04 +02:00
Peter Krempa
ca40725a21 manpage: virsh: Note that 'virsh undefine --remove-all-storage' doesn't remove backing images
Removing a backing image could break other image chains as it's
theoretically possible to share backing chains.

As --storage/--remove-all-storage is fully implemented in virsh as a
helper option, which enumerates and deletes VM's volumes. We do not plan
to make it any more complicated.

Document that backing chains are not removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-11 13:15:01 +02:00
Michal Privoznik
c96b3f5b5d virutil: Check retval of capng_apply()
Inside of virSetUIDGIDWithCaps() there's a naked call to
capng_apply(), i.e. without any retval check. This is potentially
dangerous as capng_apply() may fail. Do the check and report an
error.

This also fixes the build on bleeding edge distros - like Fedora
rawhide - where the function is declared with 'warn unused
result' [1].

1: a0743c335c

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-09-11 12:34:11 +02:00
Michal Privoznik
3222c9ca67 lxc_container: Check retval of capng_get_caps_process()
Added in v0.6.5~14 the call to capng_get_caps_process() inside of
lxcContainerDropCapabilities() is not really explained in the
commit message. But looking into the libcap-ng sources it's to
initialize the internal state of the library.

But with recent libcap-ng commit [1] (which some bleeding edge
distros - like Fedora rawhide - already picked up) the function
has been marked as 'warn unused result'. Well, check for its
retval then.

1: a0743c335c

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-09-11 12:34:03 +02:00
Praveen K Paladugu
efeaf5589c ch: Fix cloud-hypervisor version processing
Refactor the version processing logic in ch driver to support versions
from non-release cloud-hypervisor binaries. This version also supports
versions with branch prefixes in them.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-09-11 10:40:53 +02:00
Michal Privoznik
16ad37c119 virnetdevopenvswitch: Propagate OVS error messages
When configuring OVS interfaces/bridges we spawn 'ovs-vsctl' with
appropriate arguments and if it exited with a non-zero status we
report a generic error message, like "Unable to add port vnet0 to
OVS bridge ovsbr0". This is all cool, but the real reason why
operation failed is hidden in (debug) logs because that's where
virCommandRun() reports it unless caller requested otherwise.

This is a bit clumsy because then we have to ask users to turn on
debug logs and reproduce the problem again, e.g. [1].

Therefore, in cases where an error is reported to the user - just
read ovs-vsctl's stderr and include it in the error message. For
other cases (like VIR_DEBUG/VIR_WARN) - well they are meant to
end up in (debug) logs anyway.

1: https://mail.openvswitch.org/pipermail/ovs-discuss/2023-September/052640.html
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-09-08 13:42:25 +02:00
김인수
32613cb695 Translated using Weblate (Korean)
Currently translated at 100.0% (10411 of 10411 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ko/

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
2023-09-08 05:21:16 +02:00
Michal Privoznik
67c93cfae9 virsh-snapshot: Avoid passing NULL to qsort() in virshSnapshotListCollect()
If a domain has no snapshots and 'virsh snapshot-list' is called,
this gets all the way down to virshSnapshotListCollect() which
then collects all snapshots (none), and passes them to qsort()
which doesn't like being called with NULL:

  extern void qsort (void *__base, size_t __nmemb, size_t __size,
                     __compar_fn_t __compar) __nonnull ((1, 4));

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/533
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2023-09-07 11:37:54 +02:00
Tim Wiederhake
bfe53e9145 cpu_map: Add cpu model EPYC Genoa
This was added in qemu commit 166b174188.
No additional features had to be added to libvirt.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-09-06 20:35:45 +02:00
Tim Wiederhake
1504d677c2 cpu_map: Ignore all vmx-* features in sync_qemu_features_i386.py
The script that synchronizes cpu models from qemu,
sync_qemu_models_i386.py, ignores all features that begin with
"vmx-". Do the same for synchronizing cpu features so we do not
have to track irrelevant features individually.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-09-06 20:35:34 +02:00
Andrea Bolognani
65c5c4db3d rpm: Install client-qemu with main package
The libvirt package is a sort of catch-all that brings in all
daemon drivers as well as the client package, so it makes sense
for it do drag in the QEMU-specific clients as well.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2023-09-06 15:03:47 +02:00
Peter Krempa
58d9fe7202 qemu: capabilities: Remove 'virQEMUCapsAddCPUDefinitions'
The function was used only to fill the cpu models into fake
capabilities, whic no longer exists.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:46 +02:00
Peter Krempa
14106524cc qemuxml2argvtest: Remove cpu model faking for fake-caps tests
Now that all fake-caps testing was removed we can also remove the
filling of the fake caps by cpu models.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:46 +02:00
Peter Krempa
33f27cc978 qemu: capabilities: Unexport 'virQEMUCapsAddMachine'
It's no longer needed in tests as we are no longer adding fake machines.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:46 +02:00
Peter Krempa
6c31cddd58 testutilsqemu: Unexport 'testQemuCapsInit'
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:46 +02:00
Peter Krempa
fd1c066de0 testutilsqemu: Drop infrastructure for fake-caps testing
Remove all the code for adding fake machines into the testing capability
cache as we no longer have any machines in it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:46 +02:00
Peter Krempa
78ae89b856 qemustatusxml2xmltest: Remove capabilities infrastructure
The status XML doesn't require any capabilities to be parsed and
formatted back. Remove all qemuCaps related code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:46 +02:00
Peter Krempa
378d71ef7e testutilsqemu: Drop fake machine capability data for 'x86_64'
Now that all tests were converted to use real capabilities we can drop
x86_64 from the tooling to create fake capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:45 +02:00
Peter Krempa
54257ed51b qemuxml2argvtest: Modernize rest of the test cases
The rest of the test cases has no change in the output now that we've
assumed some flags.

Remove the fake-caps test macros after conversion.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:45 +02:00
Peter Krempa
fd1a18f645 qemuxml2argvtest: Modernize 'cpu-exact' cases
Use real capabilities, but select the fake 'Haswell' host CPU for test
stability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:45 +02:00
Peter Krempa
f1e288f6d4 qemuxml2argvtest: Modernize 'cpu-(no)fallback' test
Previously without modern capabilities the test was relying on a CPU
model which was not entered into a fake list of supported cpus.

With real capabilities we have to pick a CPU model which is supported by
libvirt but in some version is not supported by qemu. I've picked
EPYC-Milan, which was introduced into qemu-6.0.

This test configures a CPU which is equivalent to EPYC-Rome by disabling
features from EPYC-Milan and uses a versioned real caps test to check it
against a qemu which doesn't support EPYC-Milan.

With real capabilities though, we can also do a positive test case by
using a version whic doesh support it. I've specifically not used the
LATEST caps so that it doesn't change once capabilities are bumped.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:45 +02:00
Peter Krempa
36072d873e qemuxml2argvtest: Modernize 'cpu-strict' case
Use the fake Haswell processor definition and augment the list of
features to make the test pass.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:45 +02:00
Peter Krempa
457b6ee0c8 qemuxml2argvtest: Modernize 'cpu-minimum' cases
Use real capabilities, but select the fake 'Haswell' host CPU for test
stability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:45 +02:00
Peter Krempa
dcad2c05f5 qemuxml2argvtest: Modernize 'cpu-Haswell' test cases
Modernize all test cases which set 'Haswell' as the host cpu model.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:45 +02:00
Peter Krempa
dbd99066a4 qemuxml2argvtest: Modernize test cases using 'host-model' CPU
Modernize test cases using 'host-mode' cpu type, where the actual CPU
doesn't isn't important.

As using the host cpu from the 'latest' capabilities data would cause
test churn in case the host cpu changes in the future, convert them
using the overriden Haswell cpu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:45 +02:00
Peter Krempa
e485f8bd4e qemuxml2argvtest: Consolidate and modernize CPU topology testing
Move the 'smp-dies' test case into 'cpu-topology4' and remove
unnecessary cruft.

Remove cpu definition from 'cpu-topology2' as it's not relevant to the
test case.

Remove 'smp' case as it's covered by the rest.

Use real capabilities for all of them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:45 +02:00
Peter Krempa
07e6396c6a qemuxml2argvtest: Modernize migration/restore tests
As these were using DO_TEST_FULL the churn-reducing patches didn't
influence these.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:45 +02:00
Peter Krempa
035b9bde6a qemuxml2argvtest: Properly modernize 'clock-hpet-off' test case
Since qemu-8.0 a new way to disable 'hpet' via -machine was added.
Properly test both branches with real capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:45 +02:00
Peter Krempa
da68054702 qemuxml2argvtest: Assume QEMU_CAPS_QXL_VRAM64, QEMU_CAPS_(QXL|VGA)_VGAMEM for fake-caps tests
Assume the features modern qemus have to bring the test data closer
to the 'latest' real-caps versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:45 +02:00
Peter Krempa
84a14d1b76 qemuxml2argvtest: Assume QEMU_CAPS_USB_HOST_HOSTDEVICE and QEMU_CAPS_DEVICE_QEMU_XHCI for fake-caps tests
Assume the two features modern qemus have to bring the test data closer
to the 'latest' real-caps versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:45 +02:00
Peter Krempa
c159cecd4c qemuxml2argvtest: Assume QEMU_CAPS_CPU_MIGRATABLE and QEMU_CAPS_SMP_DIES for fake-caps tests
Assume the two features modern qemus have to bring the test data closer
to the 'latest' real-caps versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:45 +02:00
Peter Krempa
9e7907e78b qemuxml2argvtest: Assume QEMU_CAPS_DEVICE_PCIE_ROOT_PORT for fake-caps tests
Assume the support for the 'pcie-root-port' all modern qemus have to
bring the test data closer to the 'latest' real-caps versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:45 +02:00
Peter Krempa
2516394892 qemuxml2argvtest: Assume QEMU_CAPS_PIIX3_USB_UHCI for all fake-caps tests
To minimize further churn when coverting to real capabilities, assume
that all fake-caps machines support the piix3 USB controller.

Since we already have solid testing of USB controllers, this will have
effect only in cases when it's not relevant to the test itself.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:44 +02:00
Peter Krempa
28820bf5c0 qemuxml2argvtest: Consolidate testing of 'xhci' controllers
Rename the 'usb-controller-explicit-(unavailable-)q35' test case to
'usb-controller-nec-xhci'. Since this also covers what
'usb-controller-xhci' was testing the latter is removed.

Other 'usb-xhci' test cases which were using the NEC controller are also
renamed to contain the name.

In case of 'usb-controller-qemu-xhci' the negative test case is deleted
as we don't need two cases for missing explicitly specified controller
and the positive case is modernized to use real capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:44 +02:00
Peter Krempa
136abdc992 qemuxml2argvtest: Improve default usb controller testing
Improve testing of an explicitly requested USB controller without a
model being provided.

For this purpose the 'usb-controller' case is renamed to
'usb-controller-default-i440fx'; 'usb-controller-default-q35' is moved
up to form a group. In both cases tests are covnerted to use
DO_TEST_CAPS_LATEST.

A new 'usb-controller-default-isapc' negative test case is added for
symmetry.

The negative test case 'usb-controller-default-unavailable-q35' is
converted to use latest caps, but stripping the default controller
instead of using fake caps. Additionally for symmetry
'usb-controller-default-unavailable-i440fx' is added although that
doesn't cause failure, but rather a graceful downgrade to use '-usb'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:44 +02:00
Peter Krempa
123f57c947 qemuxml2argvtest: Add tests for auto-added USB controllers
There are per-machine type variations on which usb controller will be
picked on an x86_64 machine. Add test cases where a USB controller is
completely missing to cover all 3 cases ('isapc', 'pc', 'q35') when an
USB controller is not explicitly requested by the user.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:44 +02:00
Peter Krempa
2b8ccecbc3 qemuxml2argvtest: Consolidate tests for usb controllers
Move all controller related tests together and consolidate naming of the
test cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:44 +02:00
Peter Krempa
a771b13e75 qemuxml2argvtest: Enable 'seccomp' sandbox in all fake caps tests
In order to minimize further churn, make all fake-caps test assume that
the seccomp sandbox is supported.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:44 +02:00
Peter Krempa
eb7a6e4877 testutilsqemu: Always populate default ram id, default cpu, ACPI support for fake machines
Enable a few defaults that will decrease churn when converting tests to
real capabilities.

Since the fake machines are added only for x86_64 at this point we can
assume that ACPI is present via -machine.

In case of the default ram id assume the same. Additionally the logic
was broken as fake capabilities don't have a version so the default RAM
was never actually populated into fake caps tests.

For CPU we add 'qemu64' as that is the default picked by qemu.

We also assume that qemu requires an explicit backend for -numa, which
is the case for modern machines.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:44 +02:00
Peter Krempa
911b61299a qemuxml2argvtest: Modernize 'numatune' tests
The 'numatune-memory' case is completely dropped as it's sufficiently
covered by 'numatune-memnode'.

The positive fake-caps version of 'numatune-memnode' is dropped as it's
covered by the two existing real caps invocations.

'numatune-memory-invalid-nodeset', 'numatune-memnode-invalid-mode',
'numatune-memnode-nocpu', 'numatune-memnodes-problematic' parsing error
negative cases are converted to use latest capabilities.

'numatune-static-nodeset-exceed-hostnode' commandline generation failure
negative case is converted to use latest capabilities.

'numatune-memnode-no-memory', 'numatune-distances',
'numatune-auto-nodeset-invalid', 'numatune-auto-prefer' positive cases
are converted to use latest capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:44 +02:00
Peter Krempa
37ec346f3f qemuxml2argvtest: Modernize negative testing for hugepages
Use proper version for negative case of 'hugepages-memaccess3'

QEMU allowed to configure a memory backend for default ram since
qemu-5.2. Fix the test to use real capability data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:44 +02:00
Peter Krempa
ba3ee74987 virQEMUCapsAddCPUDefinitions: Fill in cpu type in data and node it's used only in tests
'virQEMUCapsAddCPUDefinitions' is used solely to populate fake cpu
models for the fake-caps tests. Note that and also populate the 'type'
field so that default cpu type can be propagated properly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:44 +02:00
Peter Krempa
42c7636aa3 qemuxml2argvtest: Enable JSON syntax for -device, -object, and -netdev for all fake-caps tests
To minimize upcoming churn in test data when they will be converted to
latest capabilities enable JSON syntax for -device, -object, and -netdev
for all fake caps test files. Doing this should also help git track
renames of the files better as there will be more of consistent context
present.

We can do this safely as internally we generate JSON first and then
back-convert it into the old-style commandline if given qemu doesn't
support it. This means that all generated content will be the same.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:44 +02:00
Peter Krempa
34b2b19f00 qemuxml2argvtest: Remove FLAG_SKIP_LEGACY_CPUS
Remove the notion of legacy cpus as there are no test cases using it any
more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:44 +02:00
Peter Krempa
a1aa8c0e4f qemuxml2argvtest: Use real caps for 'cpu-host-model-nofallback' test case
Similarly to 'cpu-host-model' add a real capability invocation for each
version we support and remove the old fake caps invocation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:44 +02:00
Peter Krempa
c075fa7b08 qemuxml2argvtest: Use real caps for 'cpu-host-model-fallback' test case
Similarly to 'cpu-host-model' add a real capability invocation for each
version we support and remove the old fake caps invocation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:44 +02:00
Peter Krempa
c07f07c92d qemuxml2argvtest: Use proper version in negative 'virtio-options-memballoon-freepage-reporting' case
The feature is supported since qemu-5.1. Use real qemu-5.0 caps for the
test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:43 +02:00
Peter Krempa
42c1abc48d qemuxml2argvtest: Remove fake-caps invocations of tests which also real caps version
Drop tests which already are tested with real caps, thus the fake caps
version doesn't bring much value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-09-06 14:09:43 +02:00