Commit Graph

50261 Commits

Author SHA1 Message Date
Peter Krempa
b37096778b qemuDomainControllerDefPostParse: Use 'pci-ohci' as last-resort fallback USB controller
This controller is used as the default/implicit USB controller by
multiple machine types which honour the '-usb' flag of qemu. Add it as
fallback in libvirt too.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:36 +01:00
Peter Krempa
c6d71bf813 qemuDomainDefAddDefaultDevices: Populate default USB for 'versatilepb' and 'realview' ARM machines
The machine types historically have a default USB controller populated
via '-usb' which libvirt assumed implicitly. Qemu will use 'pci-ohci'
for both if '-usb' is used.

Unfortunately an USB controller instantiated via '-usb' is unusable as
the bus name libvirt generates doesn't reflect the real name qemu uses,
and thus no libvirt-defined USB devices can be put on the controller.

This patch will populate the default USB controller into the XML and
select it's model to 'pci-ohci' unconditionally as the machine would
fail to start with '-usb' if that controller model is not available.

This patch doesn't try to make any other assumptions about
auto-populated model of USB controllers, which means that for an
explicit USB controller without model a different model will be picked.

Note that this will likely cause ABI differences and break migration for
the two machine types, in the corner case when the default USB
controller would be populated, but given that both are obsolete board
types and USB was unusable it doesn't make sense to keep supporting this
specific case when '-usb' was formatted.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:36 +01:00
Peter Krempa
d885d39f10 qemuDomainControllerDefPostParse: Use proper enum value for default USB controller model
Assign VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT rather than -1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:36 +01:00
Peter Krempa
1dd0744b29 qemuDomainDefAddDefaultDevices: Handle defaults for all ARM arches together
Most machine types are avaliable in all arches by qemu. This is also
true for the 'versatilepb' machine type example in the tests.

Move all the ARM architectures together so that they are handled in
sync.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:36 +01:00
Peter Krempa
0d33631671 qemuxmlconftest: Add test data for USB selection with 'mac99' machine on ppc
Add an example using the old binary/machine type to also see how legacy
cases are handled.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:36 +01:00
Peter Krempa
c7b3c397ba qemuxmlconftest: Add test data for USB selection with 'powernv' machine on ppc64
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:36 +01:00
Peter Krempa
f6cc87a339 qemuxmlconftest: Add test data for USB selection with 'mac99' machine on ppc64
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:36 +01:00
Peter Krempa
66f1baee76 qemuxmlconftest: Add test data for USB selection with 'g3beige' machine on ppc64
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:36 +01:00
Peter Krempa
8d348de9cc qemuxmlconftest: Add test case when default USB controller for 'pseries' is compiled out
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:35 +01:00
Peter Krempa
c47e60fda9 qemuxml2conftest: Consolidate usb controller tests for 'pseries' machine
Move the test invocation and rename the test files according to the
pattern.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:35 +01:00
Peter Krempa
3990ee20c9 qemuxmlconftest: Add test data for an ARM machine where qemu doesn't honour -usb
The 'borzoi' machine doesn't honour '-usb' in qemu so use it as an
example for the upcoming patch for removing '-usb' support.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:35 +01:00
Peter Krempa
9431318b00 qemuxmlconftest: Add test for 'realview' machine
Add test data for a 'realview' machine example to validate default USB
controller selection.

Note that it's unlikely that anyone would run 'realview' machines with
'aarch64' architecture, but qemu allows it and it's simpler test-wise in
libvirt.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:35 +01:00
Peter Krempa
207fc34d10 qemuxmlconfdata: Add tests for USB controller selection with 'versatilepb' machine on arm qemu binary
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:35 +01:00
Peter Krempa
b50370e419 qemuxmlconfdata: Add tests for USB controller selection with 'versatilepb' machine on aarch64 qemu binary
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:35 +01:00
Peter Krempa
241265b510 qemucapabilitiestest: Add test dump for 'armv7l' architecture
Add capabilities based on a dump from x86_64 host running Fedora for the
qemu-system-arm binary.

The test dump will be used for illustration of USB controller model
selection.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:35 +01:00
Peter Krempa
5d8648b1ba testutilshostcpus: Add support for VIR_ARCH_ARMV7L
Allow using armv7l arch in a capability dump.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:35 +01:00
Peter Krempa
bb932e2c15 qemucapabilitiesdata: Document faked caps dumps
Document the reality that some dumps were faked for purpose of testing
corner cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:35 +01:00
Peter Krempa
52cde9f314 tests: Replace mentions of the removed 'qemucapabilitiesnumbering' tool
Mention the new 'scripts/qemu-replies-tool.py'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-03-06 16:30:35 +01:00
Jiri Denemark
2ba73ca83b qemu: Optimize CPU check='partial' for usable CPUs
Ideally check='partial' would check exactly the features QEMU would want
to enable when asked for a specific CPU model (and features). But there
is no way we could ask QEMU how a specific CPU would look like. So we
use our definition from CPU map, which may slightly differ as QEMU adds
or removes features from CPU models, and thus we may end up checking
features which QEMU would not enable while missing some required ones.

We can do better in specific cases, though. If a CPU definition uses
only a model and disabled features (or none at all), we already know
whether QEMU can enable all features required by the CPU model as that's
what we use to set usable='yes' attribute in the list of available CPU
models in domain capbilities XML. So when a usable CPU model is
requested without asking for additional features (disabling features is
fine) we can avoid our possible inaccurate check using our CPU map.

For backward compatibility we only consider usable models. If a
specified model is not usable, we still check it the old way and even
let QEMU start it (and disable some features) in case our definition
lacks some features compared to QEMU.

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/608
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-03-05 16:04:28 +01:00
Jiri Denemark
ac120f1855 cpu: x86: Check for invalid CPU data from hypervisor
Recently a kernel bug caused QEMU to report a CPU feature as enabled
while listing it in the "unavailable-features" list of features that
were requested, but could not be enabled. The feature was actually
enabled, but we marked it as disabled when starting a domain. Later when
the domain is migrated, the destination requests the feature to be
disabled, which breaks the guest ABI or if we are lucky QEMU just fails
to load the migration stream.

Let's make similar bugs more visible in the future by refusing to even
start the domain.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-03-05 16:00:19 +01:00
Adam Julis
bdee774285 virsh: Fix overflow error of freepages command
Trying to print pages of a size larger than the UINT_MAX of the
given platform (for example, 4G on 64-bit ARM), results in a
system error even though this is a legitimate request.

The vshCommandOptScaledInt() used for parsing the pagesize is
given UINT_MAX as the upper limit. The parsed value is then
divided by 1024 and fed to virNodeGetFreePages() which expects an
unsigned int. We can't change the public API but the upper limit
can be raised by the factor of 1024.

Resolves: https://issues.redhat.com/browse/RHEL-23608

Signed-off-by: Adam Julis <ajulis@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-03-05 12:22:06 +01:00
Daniel P. Berrangé
ba3a5604c9 ci: refresh with lcitool manifest
Picks up the switch from FreeBSD 13.2 to 13.3

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-03-05 10:25:12 +00:00
Andrea Bolognani
116a44d65e tests: Add invalid firmware descriptor
This is guaranteed to keep failing even after loongarch64
support is introduced.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-03-04 14:36:41 +01:00
Andrea Bolognani
03a2e01dd4 tests: Add firmware descriptor for edk2 on loongarch64
This fails to be parsed because libvirt doesn't yet know about
the architecture, but thanks to the recent improvements this
is a merely a local failure rather than bringing everything
else down with it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-03-04 14:36:40 +01:00
Andrea Bolognani
e4abb5f0fd qemu: Make firmware parsing failures non-fatal
At the moment, any kind of issue being detected in any of the
firmware descriptor files will result in the entire process
being aborted.

In particular, installing a build of edk2 for an architecture
that libvirt doesn't yet know about, for example loongarch64,
will break most firmware-related functionality: it will no
longer be possible to define new EFI VMs, start existing ones,
or even just obtain the domcapabilities for any architecture.

This is obviously unnecessarily harsh. Adopt a more relaxed
approach and simply ignore the firmware descriptors that we
are unable to parse correctly.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-03-04 14:36:39 +01:00
Andrea Bolognani
e0438b2e80 qemu: Rewrite qemuFirmwareFetchParsedConfigs()
Instead of returning the list of paths exactly as obtained
from qemuFirmwareFetchConfigs(), and allocating the list of
firmwares to be exactly that size right away, start with two
empty lists and add elements to them one by one.

At the moment this only makes things more verbose, but later
we're going to change things so that it's possible that some
of the paths/firmwares are not included in the lists returned
to the caller, and at that point the changes will pay off.

Note that we can't use g_auto() for the new list of paths,
because until the very last moment it's not null-terminated,
so g_strfreev() wouldn't be able to handle it correctly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-03-04 14:36:37 +01:00
Andrea Bolognani
dcad670212 qemu: Add missing early returns
In a couple of cases, we were reporting an error without
actually terminating the parse process.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-03-04 14:36:26 +01:00
Peter Krempa
c472736062 docs: newapi: Fix generation of type definition tables
Ensure that all rows have 3 columns and avoid generation of emtpy
elements which would be turned by the XML formatter into non-pair td/tr
tags which don't work properly with HTML5 parsers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2024-03-01 12:51:56 +01:00
Peter Krempa
620cbfaea5 docs: newapi: Properly skip ACL entries if empty
The source document can contain an empty '@flags' attribute which passes
the test but generates an empty element. Check that flags is non-empty
to trigger the fallback.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2024-03-01 12:51:56 +01:00
Peter Krempa
6f4485a453 docs: newapi: Avoid table where every row has an cell with 'colspan'
The HTML standard requires that a table column must include at least one
row which defines it exclusively, thus having a table where all rows
unite it via 'colspan' is illegal.

Modify the enum value generator to always output the description field
even when it's empty rather than uniting it, as in case when each value
doesn't have a description the generated document would violate the
standard.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2024-03-01 12:51:56 +01:00
Peter Krempa
47a8ff9979 docs: newapi: Avoid empty <div>s when there is no description
The various objects we generate API for may have empty description in
which case an empty div would be generated when processing the API
description. As we're using XML output mode the generator would shorten
such divs to the non-pair empty element version, which doesn't work well
with HTML5 parsers requiring a pair tag for <div>

Avoid empty description <div> elements altogether by skipping it if the
description is empty.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2024-03-01 12:51:56 +01:00
Peter Krempa
3a0af92df6 docs: newapi: Don't generate empty <div> in template for ACL permissions
If an API has no ACLs an empty <div class='acl'/> would be generated
which is mis-interpreted by browsers when creating DOM to nest any
subsequent elements under it.

Don't generate the ACL section div unless it will be filled.

Best viewed with 'git show -w'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2024-03-01 12:51:56 +01:00
Peter Krempa
bf4a709ebe docs: index: Fix import of blog planet javascript
Similarly to previous commit drop the 'type' attribute which is frowned
upon by the HTML standard.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2024-03-01 12:51:55 +01:00
Peter Krempa
6ecbc16050 docs: page: Fix declaration of main javascript source
Per the w3 html validator a HTML/XML comment is not allowed inside the
<script> tag, use a space instead as it must be a pair tag.

Additionally drop the 'type' attribute as it's not needed (validator
warns about it).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2024-03-01 12:51:55 +01:00
Peter Krempa
e7ddd7e8e4 docs: page: Add 'lang="en"' for all HTML output documents
Per the w3 HTML validator the 'lang' attribute is suggested.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2024-03-01 12:51:55 +01:00
Peter Krempa
e49b305c56 docs: site: Don't generate '<?xml' header for HTML documents
Skip the XML header as it's invalid with <!DOCTYPE HTML> both for the
RST-generated pages and for the API docs generated from the API XML.

Additionally remove the spurious xsl:output directive from newapi.xsl
which is ignored and thus misleading.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2024-03-01 12:51:55 +01:00
Jiri Denemark
8c1ea0b8a7 Post-release version bump to 10.2.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2024-03-01 12:22:04 +01:00
Jiri Denemark
322f175240 Release of libvirt-10.1.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2024-03-01 12:19:44 +01:00
Martin Kletzander
c664015fe3 Fix off-by-one error in udevListInterfacesByStatus
Ever since this function was introduced in 2012 it could've tried
filling in an extra interface name.  That was made worse in 2019 when
the caller functions started accepting NULL arrays of size 0.

This is assigned CVE-2024-1441.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reported-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Fixes: 5a33366f5c
Fixes: d6064e2759
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-03-01 11:52:27 +01:00
Peter Krempa
3584ed4c21 NEWS: Update for release
Mention improvement of virt-admin, and fixes for the VPD xml and disk
migration port bug.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2024-03-01 11:42:50 +01:00
김인수
4f06ca8ba9 Translated using Weblate (Korean)
Currently translated at 100.0% (10440 of 10440 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>
2024-02-29 15:36:08 +01:00
Boris Fiuczynski
6e36f26651 remote_protocol: Fix ACL on REMOTE_PROC_NODE_DEVICE_DEFINE_XML
Adding 'save' ACL to REMOTE_PROC_NODE_DEVICE_DEFINE_XML to make
REMOTE_PROC_NODE_DEVICE_UPDATE ACLs meaningful.

Fixes: 69f9e7dbc2
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-02-29 12:09:08 +01:00
Michal Privoznik
71f531b017 NEWS: Document my contributions for upcoming release
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-02-29 12:06:53 +01:00
김인수
f8cef4cf28 Translated using Weblate (Korean)
Currently translated at 99.4% (10386 of 10440 strings)

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

Signed-off-by: 김인수 <simmon@nplob.com>
2024-02-28 15:01:01 +01:00
Yuri Chornoivan
c260934390 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (10440 of 10440 strings)

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

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
2024-02-28 15:01:01 +01:00
Weblate
756345c0f0 Translated using Weblate (Korean)
Currently translated at 99.4% (10385 of 10440 strings)

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

Co-authored-by: Weblate <noreply-mt-weblate@weblate.org>
Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
2024-02-28 15:01:01 +01:00
김인수
ab5226dc24 Translated using Weblate (Korean)
Currently translated at 99.4% (10385 of 10440 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>
2024-02-28 15:01:01 +01:00
Cole Robinson
066aa232f8 spec: Handle new location of bash-completion .pc file
On Fedora 41, bash-completion's .pc file moved to
`bash-completion-devel`.

Using `pkgconfig()` lets us handle this without distro version checks

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-02-27 12:05:38 +00:00
Michal Privoznik
cb3f1d5b29 ci: regenerate
Regenerate the ci files using the latest libvirt-ci:

  commit face9746f9729699ae8525ffac4ee19be82c1ba5
  ci: drop update-alternatives for opensuse tumbleweed

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-02-27 12:04:13 +01:00
Weblate
c90704c112 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
2024-02-26 15:03:57 +01:00