]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
6 months agodocs: standard linux bridges now support vlans
Leigh Brown [Wed, 8 Jan 2025 13:31:30 +0000 (13:31 +0000)] 
docs: standard linux bridges now support vlans

Update domain XML and network XML documentation to describe how
standard linux bridges support the VLAN configuration.

Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
Reviewed-by: Laine Stump <laine@redhat.com>
6 months agoqemu: snapshot: delete disk image only if parent snapshot is external
Pavel Hrdina [Thu, 9 Jan 2025 15:23:44 +0000 (16:23 +0100)] 
qemu: snapshot: delete disk image only if parent snapshot is external

When we are deleting external snapshot that is not active we only need
to delete overlay disk image of the parent snapshot. This works
correctly even if parent snapshot is external and active as it will have
another overlay created when user reverted to that snapshot.

In case the parent snapshot is internal there are no overlay disk images
created as everything is stored internally within the disk image. In
this case we would delete the actual disk image storing internal
snapshots and most likely the original disk image as well resulting in
data loss once the VM is shutoff.

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/734
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
6 months agodocs: Clarify documentation of host-model CPU mode
Jiri Denemark [Thu, 9 Jan 2025 14:06:24 +0000 (15:06 +0100)] 
docs: Clarify documentation of host-model CPU mode

The host-model CPU mode was described as similar to copying the host CPU
definition from capabilities, which has not been the case for ages. The
host-model definition from domain capabilities is used instead.

Only the first sentence changed, but it required reformatting
essentially the whole paragraph so I used this as an opportunity to
reformat it a little bit more and split the long paragraph into several
smaller ones for better readability.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 months agopo: Refresh potfile for v11.0.0 v11.0.0-rc1
Jiri Denemark [Thu, 9 Jan 2025 10:48:26 +0000 (11:48 +0100)] 
po: Refresh potfile for v11.0.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6 months agoutil: don't attempt to acquire logind inhibitor if not requested
Daniel P. Berrangé [Wed, 8 Jan 2025 17:37:03 +0000 (17:37 +0000)] 
util: don't attempt to acquire logind inhibitor if not requested

When VIR_INHIBITOR_WHAT_NONE is passed to virInhibitorNew, it is
an indication that daemon shutdown should be inhibited, but no
OS level inhibitors acquired. This is done by the virtnetworkd
daemon, for example, to prevent shutdown while running virtual
machines are present, without blocking / delaying OS shutdown.

Unfortunately the code forgot to skip the DBus call in this case,
resulting in errors being logged.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agorpc: log details of OS signals received by daemon
Daniel P. Berrangé [Wed, 8 Jan 2025 19:07:53 +0000 (19:07 +0000)] 
rpc: log details of OS signals received by daemon

When debugging it is useful to know what signals are being received and
metadata related to them. Log this data before calling the signal
handling callbacks.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agospec: Disable ch driver on RHEL
Jiri Denemark [Wed, 8 Jan 2025 18:36:11 +0000 (19:36 +0100)] 
spec: Disable ch driver on RHEL

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agoTranslated using Weblate (Finnish)
Weblate [Wed, 8 Jan 2025 13:22:12 +0000 (13:22 +0000)] 
Translated using Weblate (Finnish)

Currently translated at 22.2% (2345 of 10555 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
6 months agoTranslated using Weblate (Finnish)
Ricky Tigg [Wed, 8 Jan 2025 08:36:51 +0000 (08:36 +0000)] 
Translated using Weblate (Finnish)

Currently translated at 22.1% (2343 of 10555 strings)

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

Signed-off-by: Ricky Tigg <ricky.tigg@gmail.com>
6 months agoTranslated using Weblate (Spanish)
Nicolas Gal [Tue, 7 Jan 2025 16:15:41 +0000 (16:15 +0000)] 
Translated using Weblate (Spanish)

Currently translated at 47.9% (5065 of 10555 strings)

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

Signed-off-by: Nicolas Gal <nialegal@yandex.com>
6 months agoTranslated using Weblate (Spanish)
Nicolas Gal [Wed, 1 Jan 2025 19:33:31 +0000 (19:33 +0000)] 
Translated using Weblate (Spanish)

Currently translated at 47.7% (5045 of 10555 strings)

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

Signed-off-by: Nicolas Gal <snowcrash79@users.noreply.translate.fedoraproject.org>
6 months agoTranslated using Weblate (Spanish)
Nicolas Gal [Tue, 31 Dec 2024 15:06:51 +0000 (15:06 +0000)] 
Translated using Weblate (Spanish)

Currently translated at 47.6% (5027 of 10555 strings)

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

Signed-off-by: Nicolas Gal <snowcrash79@users.noreply.translate.fedoraproject.org>
6 months agoTranslated using Weblate (Spanish)
Nicolas Gal [Mon, 30 Dec 2024 16:26:15 +0000 (16:26 +0000)] 
Translated using Weblate (Spanish)

Currently translated at 47.5% (5023 of 10555 strings)

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

Signed-off-by: Nicolas Gal <nialegal@yandex.com>
6 months agoTranslated using Weblate (Spanish)
Nicolas Gal [Sun, 29 Dec 2024 10:29:53 +0000 (10:29 +0000)] 
Translated using Weblate (Spanish)

Currently translated at 47.2% (4988 of 10555 strings)

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

Signed-off-by: Nicolas Gal <nialegal@yandex.com>
6 months agoTranslated using Weblate (Spanish)
Nicolas Gal [Fri, 27 Dec 2024 14:14:07 +0000 (14:14 +0000)] 
Translated using Weblate (Spanish)

Currently translated at 46.8% (4950 of 10555 strings)

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

Signed-off-by: Nicolas Gal <nialegal@yandex.com>
6 months agoTranslated using Weblate (Spanish)
Nicolas Gal [Wed, 25 Dec 2024 14:15:19 +0000 (14:15 +0000)] 
Translated using Weblate (Spanish)

Currently translated at 46.2% (4882 of 10555 strings)

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

Signed-off-by: Nicolas Gal <nialegal@yandex.com>
6 months agoTranslated using Weblate (Finnish)
Ricky Tigg [Fri, 20 Dec 2024 11:56:56 +0000 (11:56 +0000)] 
Translated using Weblate (Finnish)

Currently translated at 22.1% (2341 of 10555 strings)

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

Signed-off-by: Ricky Tigg <ricky.tigg@gmail.com>
6 months agoTranslated using Weblate (Finnish)
Ricky Tigg [Thu, 19 Dec 2024 15:04:46 +0000 (15:04 +0000)] 
Translated using Weblate (Finnish)

Currently translated at 21.9% (2321 of 10555 strings)

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

Signed-off-by: Ricky Tigg <ricky.tigg@gmail.com>
6 months agoTranslated using Weblate (Finnish)
Weblate [Thu, 19 Dec 2024 15:04:45 +0000 (16:04 +0100)] 
Translated using Weblate (Finnish)

Currently translated at 21.9% (2320 of 10555 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
6 months agoTranslated using Weblate (Finnish)
Ricky Tigg [Thu, 19 Dec 2024 15:04:45 +0000 (16:04 +0100)] 
Translated using Weblate (Finnish)

Currently translated at 21.9% (2320 of 10555 strings)

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

Signed-off-by: Ricky Tigg <ricky.tigg@gmail.com>
Translated using Weblate (Finnish)

Currently translated at 21.9% (2314 of 10555 strings)

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

Signed-off-by: Ricky Tigg <ricky.tigg@gmail.com>
6 months agoTranslated using Weblate (Swedish)
Anders Jonsson [Thu, 19 Dec 2024 15:04:44 +0000 (16:04 +0100)] 
Translated using Weblate (Swedish)

Currently translated at 100.0% (10555 of 10555 strings)

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

Signed-off-by: Anders Jonsson <anders.jonsson@norsjovallen.se>
Translated using Weblate (Swedish)

Currently translated at 100.0% (10555 of 10555 strings)

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

Signed-off-by: Anders Jonsson <anders.jonsson@norsjovallen.se>
Translated using Weblate (Swedish)

Currently translated at 100.0% (10555 of 10555 strings)

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

Signed-off-by: Anders Jonsson <anders.jonsson@norsjovallen.se>
Translated using Weblate (Swedish)

Currently translated at 100.0% (10555 of 10555 strings)

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

Signed-off-by: Anders Jonsson <anders.jonsson@norsjovallen.se>
Translated using Weblate (Swedish)

Currently translated at 100.0% (10555 of 10555 strings)

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

Signed-off-by: Anders Jonsson <anders.jonsson@norsjovallen.se>
Translated using Weblate (Swedish)

Currently translated at 100.0% (10555 of 10555 strings)

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

Signed-off-by: Anders Jonsson <anders.jonsson@norsjovallen.se>
Translated using Weblate (Swedish)

Currently translated at 100.0% (10555 of 10555 strings)

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

Signed-off-by: Anders Jonsson <anders.jonsson@norsjovallen.se>
Translated using Weblate (Swedish)

Currently translated at 100.0% (10555 of 10555 strings)

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

Signed-off-by: Anders Jonsson <anders.jonsson@norsjovallen.se>
Translated using Weblate (Swedish)

Currently translated at 100.0% (10555 of 10555 strings)

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

Signed-off-by: Anders Jonsson <anders.jonsson@norsjovallen.se>
6 months agoTranslated using Weblate (English (United Kingdom))
Andi Chandler [Thu, 19 Dec 2024 15:04:43 +0000 (16:04 +0100)] 
Translated using Weblate (English (United Kingdom))

Currently translated at 49.6% (5240 of 10555 strings)

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

Signed-off-by: Andi Chandler <andi@gowling.com>
Translated using Weblate (English (United Kingdom))

Currently translated at 49.5% (5234 of 10555 strings)

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

Signed-off-by: Andi Chandler <andi@gowling.com>
6 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Thu, 19 Dec 2024 15:04:43 +0000 (16:04 +0100)] 
Translated using Weblate (Swedish)

Currently translated at 100.0% (10555 of 10555 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
Translated using Weblate (Swedish)

Currently translated at 100.0% (10555 of 10555 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
Translated using Weblate (Swedish)

Currently translated at 100.0% (10555 of 10555 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
Translated using Weblate (Swedish)

Currently translated at 100.0% (10555 of 10555 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
Translated using Weblate (Swedish)

Currently translated at 99.8% (10544 of 10555 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
Translated using Weblate (Swedish)

Currently translated at 99.3% (10484 of 10555 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
Translated using Weblate (Swedish)

Currently translated at 99.1% (10464 of 10555 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
Translated using Weblate (Swedish)

Currently translated at 98.9% (10444 of 10555 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
Translated using Weblate (Swedish)

Currently translated at 98.7% (10424 of 10555 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
6 months agoqemu: allow migration of guest with mdev vGPU to VF vGPU
Laine Stump [Fri, 13 Dec 2024 17:47:39 +0000 (12:47 -0500)] 
qemu: allow migration of guest with mdev vGPU to VF vGPU

GPU vendors are moving away from using mdev to create virtual GPUs
towards using SRIOV VFs that are vGPUs. In both cases, once created
the vGPUs are assigned to guests via <hostdev> (i.e. VFIO device
assignment), and inside the guest the devices look identical, but mdev
vGPUs are located by QEMU/VFIO using a uuid, while VF vGPUs are
located with a PCI address. So although we generally require the
device on the source host to exactly match the device on the
destination host, in the case of mdev-created vGPU vs. VF vGPU
migration *can* potentially work, except that libvirt has a hard-coded
check that prevents us from even trying.

This patch loosens up that check so that we will allow attempts to
migrate a guest from a source host that has mdev-created vGPUs to a
destination host that has VF vGPUs (and vice versa). The expectation
is that if this doesn't actually work then QEMU will fail and generate
an error that we can report.

Signed-off-by: Laine Stump <laine@redhat.com>
Tested-by: Zhiyi Guo <zhguo@redhat.com>
Reviewed-by: Zhiyi Guo <zhguo@redhat.com>
6 months agoEnable vlan support for standard linux bridges
Leigh Brown [Wed, 8 Jan 2025 13:31:29 +0000 (13:31 +0000)] 
Enable vlan support for standard linux bridges

Adjust domain and network validation to permit vlan configuration on
standard linux bridges.

Update calls to virNetDevBridgeAddPort to pass the vlan configuration.

Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
Reviewed-by: Laine Stump <laine@redhat.com>
6 months agoutil: Add vlan support to virNetDevBridgeAddPort
Leigh Brown [Wed, 8 Jan 2025 13:31:28 +0000 (13:31 +0000)] 
util: Add vlan support to virNetDevBridgeAddPort

Add virNetDevBridgeSetupVlans function to configure a bridge
interface using the passed virNetDevVlan struct.

Add virVlan parameter to the Linux version of virNetDevBridgeAddPort
and call virNetDevBridgeSetupVlans to set up the required vlan
configuration.

Update callers of virNetDevBridgeAddPort to pass NULL for now.

Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
Reviewed-by: Laine Stump <laine@redhat.com>
6 months agoutil: add netlink bridge vlan filtering
Leigh Brown [Wed, 8 Jan 2025 13:31:27 +0000 (13:31 +0000)] 
util: add netlink bridge vlan filtering

Enable capability to add and remove vlan filters for a standard
linux bridge using netlink.

New function virNetlinkBridgeVlanFilterSet can be used to add or
remove a vlan filter to a given bridge interface.

Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
Reviewed-by: Laine Stump <laine@redhat.com>
6 months agoapparmor: fix UUID specification
Georgia Garcia [Tue, 7 Jan 2025 15:23:38 +0000 (12:23 -0300)] 
apparmor: fix UUID specification

There is a common misconception when writing AppArmor policy that
[0-9]* applies * to the [0-9] class, but that's not the case. For this
example, [0-9]* matches a single digit followed by any number of
characters except for /

Create a UUID variable that uses the following format 8-4-4-4-12.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
6 months agosecurity: replace uses of label and VIR_FREE by g_autofree
Georgia Garcia [Tue, 7 Jan 2025 15:23:37 +0000 (12:23 -0300)] 
security: replace uses of label and VIR_FREE by g_autofree

Moving towards full adoption of GLib APIs in the AppArmor code.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
6 months agosecurity_apparmor: fix memleaks in AppArmorSetFDLabel
Georgia Garcia [Tue, 7 Jan 2025 15:23:36 +0000 (12:23 -0300)] 
security_apparmor: fix memleaks in AppArmorSetFDLabel

proc and fd_path are allocated but never freed. Fix by using
g_autofree instead.

Fixes: b9757fea30785a92aa95ea675b9bc371e4fb2e8c
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
6 months agospec: Enable ch driver
Praveen K Paladugu [Wed, 8 Jan 2025 16:17:39 +0000 (10:17 -0600)] 
spec: Enable ch driver

Enabling building and packaging ch driver in the spec file.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
6 months agotools: fix ordering mistake in virt-admin daemon-set-timeout code
Daniel P. Berrangé [Tue, 7 Jan 2025 11:37:57 +0000 (11:37 +0000)] 
tools: fix ordering mistake in virt-admin daemon-set-timeout code

Most of the impl for the 'daemon-set-timeout' command was ordered under
the heading for the 'daemon-log-filters' command.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agoutil: fix off-by-1 in inhibitor constants
Daniel P. Berrangé [Tue, 7 Jan 2025 15:21:18 +0000 (15:21 +0000)] 
util: fix off-by-1 in inhibitor constants

The inhibitor constant values were off-by-1, so when converted into
string format, we picked the wrong names

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agomeson: remove unneeded dependency on libdevmapper for storage_disk
Stefan Hellermann [Mon, 6 Jan 2025 17:15:58 +0000 (18:15 +0100)] 
meson: remove unneeded dependency on libdevmapper for storage_disk

In commit dfa0e11 the last direct usage of devmapper for storage_disk was
removed. There is one stale include remaining, which is unused even longer
since df1011ca. Remove the include and change meson.build so we can use
storage_disk without devmapper.

I'm running it right now with a stripped-down config on a small arm64
router with openwrt.

Signed-off-by: Stefan Hellermann <stefan@the2masters.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
6 months agoconf: Adjust hyperv tlbflush formatting
Martin Kletzander [Mon, 6 Jan 2025 15:11:01 +0000 (16:11 +0100)] 
conf: Adjust hyperv tlbflush formatting

Commit 247357cc292a added support for direct and extended modes for
tlbflush, but forgot to do the formatting as well.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
6 months agoconf: refactor hyperv features formatting
Ján Tomko [Mon, 6 Jan 2025 16:20:57 +0000 (17:20 +0100)] 
conf: refactor hyperv features formatting

Add a nested buffer for whatever sub-elements a particular
hyperv feature might have.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
6 months agovirtiofs: Allow read only mode
Adam Julis [Fri, 3 Jan 2025 13:22:23 +0000 (14:22 +0100)] 
virtiofs: Allow read only mode

Resolves: https://issues.redhat.com/browse/RHEL-72192
Signed-off-by: Adam Julis <ajulis@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
6 months agosecurity: apparmor: Remove hardcoded "libvirtd" profile name
Jim Fehlig [Sat, 4 Jan 2025 03:44:19 +0000 (20:44 -0700)] 
security: apparmor: Remove hardcoded "libvirtd" profile name

The apparmor driver probe function checks for an active profile matching
the full path of the running daemon binary. If not found, it checks for
a profile named "libvirtd". This works fine when the running daemon is the
old monolithic libvirtd, but fails with modular daemons.

Remove the check for a hardcoded "libvirtd" profile and replace with the
basename of the running daemon binary.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agoremote: apply translations to polkit files
Daniel P. Berrangé [Thu, 19 Dec 2024 09:27:27 +0000 (09:27 +0000)] 
remote: apply translations to polkit files

The 'description' and 'message' fields in polkit policy files should be
translated into the user's chosen language. xgettext is told to search
in both and source and build dirs by meson.

Unfortunately a bug in xgettext means that when it searches for built
files in XML format, it'll trigger a warning message due to failure to
load the generated file from the source dir:

  xgettext: cannot read ..snip../libvirt/src/access/org.libvirt.api.policy: failed to load external entity "..snip../libvirt/src/access/org.libvirt.api.policy"

This is harmless since it then goes on to try the build dir and
succeeds, but will pollute the output of 'ninja libvirt-pot'

Related: https://gitlab.com/libvirt/libvirt/-/merge_requests/387
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agomeson: remove duplication of polkit dirs construction
Daniel P. Berrangé [Fri, 3 Jan 2025 16:22:30 +0000 (16:22 +0000)] 
meson: remove duplication of polkit dirs construction

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agopo: add its rules for translating polkit file strings
Daniel P. Berrangé [Thu, 19 Dec 2024 09:21:51 +0000 (09:21 +0000)] 
po: add its rules for translating polkit file strings

xgettext / msgfmt have generic support for extracting / merging strings
in XML files, however, they need to be told something about the schema
to know which fields are translatable. This is done by providing 'its'
rules. Usually the 'its' rules would be shipped in a -devel package of
the app which owns the schema definition, but polkit does not do this.
Thus libvirt (and other apps) must ship their own local 'its' rules for
polkit.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agoqemu_tpm: do not delete parent directory for custom source
Marc-André Lureau [Wed, 11 Dec 2024 10:37:14 +0000 (14:37 +0400)] 
qemu_tpm: do not delete parent directory for custom source

When the vTPM source path is specified, such as:
   <source type=".." path="/my/tpm"/>

Do not delete the parent directory, but only the given file/dir.

Fixes: commit f1304cc566 ("qemu_tpm: handle file/block storage source")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Tested-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
6 months agoqemu_tpm: lock the state explicitly when running swtpm
Marc-André Lureau [Wed, 11 Dec 2024 10:37:13 +0000 (14:37 +0400)] 
qemu_tpm: lock the state explicitly when running swtpm

Commit bb5e26749fe5b ("qemu: explicit swtpm state locking") attempted to
lock the state, but only for swtpm-setup. The capability
"tpmstate-opt-lock" is actually only exposed by swtpm.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
6 months agoRevert "qemu: explicit swtpm state locking"
Marc-André Lureau [Wed, 11 Dec 2024 10:37:12 +0000 (14:37 +0400)] 
Revert "qemu: explicit swtpm state locking"

This reverts commit bb5e26749fe5b5856a3541be2cbe147701e6e121.

swtpm-setup doesn't have "tpmstate-lock", only swtpm.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
6 months agohyperv: Introduce and export 'facility' variable.
Michal Privoznik [Thu, 19 Dec 2024 10:02:59 +0000 (11:02 +0100)] 
hyperv: Introduce and export 'facility' variable.

In its upstream commit [1] openwsman dropped 'facility' variable
which is documented as:

 * all processes that use the libu must define a "facility" variable somewhere
 * to satisfy this external linkage reference.
 *
 * Such variable will be used as the syslog(3) facility argument.

Well, prior to that commit, openwsman itself declared the
variable (and set it to LOG_DAEMON). Now it's up to us.

Yeah, the variable naming is terrible and also I we are not using
libu directly, but apparently libwsman.so requires it anyway:

  $ objdump -T /usr/lib64/libwsman.so | grep facility
  0000000000000000      D  *UND*  0000000000000000  Base        facility

1: https://github.com/Openwsman/openwsman/commit/d72c51f21b9c85a773b7955ac587d2d3cea982c1
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
6 months agoapparmor: Allow running loongarch64 VMs
Xianglai Li [Tue, 17 Dec 2024 12:29:17 +0000 (20:29 +0800)] 
apparmor: Allow running loongarch64 VMs

Allows to load firmware in the qemu-efi-loongarch64 directory
Allows the binary qemu-system-loongarch64 to be run

This makes it possible to run loongarch64 VMs when AppArmor
is enabled

Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 months agoqemu: Add support for direct and extended tlbflush features
Martin Kletzander [Fri, 20 Dec 2024 11:28:24 +0000 (12:28 +0100)] 
qemu: Add support for direct and extended tlbflush features

They require special handling since they are dependent on the basic
tlbflush feature itself and therefore are not handled automatically as
part of virDomainHyperv enum, just like the stimer-direct feature.

Resolves: https://issues.redhat.com/browse/RHEL-7122
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agoconf, docs: Add support for direct and extended tlbflush features
Martin Kletzander [Fri, 20 Dec 2024 11:27:22 +0000 (12:27 +0100)] 
conf, docs: Add support for direct and extended tlbflush features

Similarly to stimer-direct these are subelements of <tlbflush/> in the
domain XML.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agoch: Enable logging curl responses from ch
Praveen K Paladugu [Thu, 19 Dec 2024 14:46:01 +0000 (08:46 -0600)] 
ch: Enable logging curl responses from ch

Log curl responses from cloud-hypervisor process during Boot request, using
domain's logContext.

Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agoch: move curl_data and curl_callback definitions
Praveen K Paladugu [Thu, 19 Dec 2024 14:46:00 +0000 (08:46 -0600)] 
ch: move curl_data and curl_callback definitions

Move the definitions of curl_data and curl_callback to be used
within virCHMonitorPutNoContent.

Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agoch: Enable logging for ch domains
Praveen K Paladugu [Thu, 19 Dec 2024 14:45:59 +0000 (08:45 -0600)] 
ch: Enable logging for ch domains

Use domainLogContext to enable logging for ch domain process during create
and restore steps.

Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agohypervisor: Move QEMU log context to hypervisor
Praveen K Paladugu [Thu, 19 Dec 2024 14:45:52 +0000 (08:45 -0600)] 
hypervisor: Move QEMU log context to hypervisor

While doing so, also drop QEMU specific arguments from
domainLogContextNew() and replace them with hypervisor agnostic
ones.

Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agoutil/xml: open XML files before calling libxml2
Daniel P. Berrangé [Wed, 7 Aug 2024 14:54:53 +0000 (15:54 +0100)] 
util/xml: open XML files before calling libxml2

Libxml2 has awful error reporting behaviour when reading files. When
we fail to load a file from the test driver we see:

  $ virsh -c test:///wibble.xml
  I/O warning : failed to load external entity "/wibble.xml"
  error: failed to connect to the hypervisor
  error: XML error: failed to parse xml document '/wibble.xml'

where the I/O warning line is something printed by libxml2 itself,
which also lacks any useful detail.

Switching to our own file reading code we can massively improve
things:

  $ ./build/tools/virsh -c test:///wibble.xml
  error: failed to connect to the hypervisor
  error: Failed to open file '/wibble.xml': No such file or directory

Using 10 MB as an upper limit on XML file size ought to be sufficient
for any XML files libvirt is reading.

Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agoutil/xml: don't assume libxml2 has the filename of the document
Daniel P. Berrangé [Fri, 9 Aug 2024 10:30:59 +0000 (11:30 +0100)] 
util/xml: don't assume libxml2 has the filename of the document

The libxml2 error handling gets the filename from a libxml2 struct, but
it is better to not assume libxml2 knows the filename being parsed, as
we might have simply provided it a pre-loaded string.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agoutil/xml: fix extraction of XML context
Daniel P. Berrangé [Fri, 9 Aug 2024 10:28:24 +0000 (11:28 +0100)] 
util/xml: fix extraction of XML context

Currently given an input of '<dom\n' we emit an error:

  error: Failed to define domain from tests/qemuxmlconfdata/broken-xml-invalid.xml
  error: at line 2: Couldn't find end of Start Tag dom line 1
  (null)
  ^

With this fix we emit:

  error: Failed to define domain from tests/qemuxmlconfdata/broken-xml-invalid.xml
  error: at line 2: Couldn't find end of Start Tag dom line 1
  <dom
  ----^

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agosrc: drop obsolete checks for virDomainConfigFile failure
Daniel P. Berrangé [Mon, 16 Dec 2024 19:33:28 +0000 (19:33 +0000)] 
src: drop obsolete checks for virDomainConfigFile failure

This cannot ever return NULL

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agorpc: remove logind support for virNetDaemon
Daniel P. Berrangé [Mon, 16 Dec 2024 16:37:52 +0000 (16:37 +0000)] 
rpc: remove logind support for virNetDaemon

The virNetDaemon code now only concerns itself with preventing auto
shutdown of the local daemon. Logind is now handled by the new
virInhibitor object, for QEMU, LXC and LibXL. This fixes two notable
bugs

 * Running virtual networks would prevent system shutdown
 * Loaded ephemeral secrets would prevent system shutdown

Fixes 9e3cc0ff5e81ed2056a6a528893fd2cb5609d70b
Fixes 37800af9a400385801da6d73654249fdb51a93d8
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agosrc: convert drivers over to new virInhibitor APIs
Daniel P. Berrangé [Mon, 16 Dec 2024 16:28:48 +0000 (16:28 +0000)] 
src: convert drivers over to new virInhibitor APIs

This initial conversion of the drivers switches them over to use
the virInhibitor APIs in local daemon only mode. Communication to
logind is still handled by the virNetDaemon class logic.

This mostly just replaces upto 3 fields in the driver state
with a single new virInhibitor object, but otherwise should not
change functionality besides replacing atomics with mutex protected
APIs.

The exception is the LXC driver which has been trying to inhibit
shutdown shutdown but silently failing to, since nothing ever
remembered to set the 'inhibitCallback' pointer in the driver
state struct.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agoutil: introduce object for holding a system inhibitor lock
Daniel P. Berrangé [Mon, 16 Dec 2024 15:19:34 +0000 (15:19 +0000)] 
util: introduce object for holding a system inhibitor lock

The system inhibitor locks are currently handled by code in the
virNetDaemon class. The driver code invokes a callback provided
by the daemon when it wants to start or end inhibition.

When the first inhibition is started, the daemon will call out
to logind to apply it system wide.

This has many flaws

 * A single message is registered with logind regardless of
   what driver holds the inhibition
 * An inhibition of daemon shutdown can't be acquired
   without also inhibiting system shutdown
 * Config of the inhibitions cannot be tailored by the
   driver

The new virInhibitor object addresses these:

 * The object directly manages an inhibition with logind
   privately to the driver, enabling custom messages to
   be set.
 * It is possible to acquire an inhibition locally to the
   daemon without forwarding it to logind.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agocpu_map: Add missing CPU features
Jiri Denemark [Wed, 18 Dec 2024 13:05:09 +0000 (14:05 +0100)] 
cpu_map: Add missing CPU features

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agocpu_map: Add ibpb-brtype CPU feature
Jiri Denemark [Wed, 18 Dec 2024 13:04:10 +0000 (14:04 +0100)] 
cpu_map: Add ibpb-brtype CPU feature

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agocpu_map: Add zero-fcs-fds CPU feature
Jiri Denemark [Wed, 18 Dec 2024 13:00:00 +0000 (14:00 +0100)] 
cpu_map: Add zero-fcs-fds CPU feature

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agocpu_map: Add fdp-excptn-only CPU feature
Jiri Denemark [Wed, 18 Dec 2024 12:58:46 +0000 (13:58 +0100)] 
cpu_map: Add fdp-excptn-only CPU feature

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agocpu_map: Add sha512, sm3, and sm4 CPU features
Jiri Denemark [Wed, 18 Dec 2024 12:27:40 +0000 (13:27 +0100)] 
cpu_map: Add sha512, sm3, and sm4 CPU features

Introduced by Clearwater Forest platform.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agocpu_map: Add GraniteRapids-v2 CPU model
Jiri Denemark [Wed, 18 Dec 2024 12:46:25 +0000 (13:46 +0100)] 
cpu_map: Add GraniteRapids-v2 CPU model

Introduced by QEMU 9.2.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agocpu_map: Add avx10* CPU features
Jiri Denemark [Wed, 18 Dec 2024 12:30:16 +0000 (13:30 +0100)] 
cpu_map: Add avx10* CPU features

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agoqemu: Call migrate-incoming with exit-on-error=false
Jiri Denemark [Tue, 10 Dec 2024 11:28:53 +0000 (12:28 +0100)] 
qemu: Call migrate-incoming with exit-on-error=false

The exit-on-error=false argument of migrate-incoming tells the QEMU
process to keep running when incoming migration fails, which helps us in
two ways:

1. When migration enters Finish phase to cleanup the process, the domain
   might not even exist on the destination (because it has already been
   cleaned up by EOF monitor callback) and we would get rather unhelpful
   "operation failed: domain is no longer running" error message.

2. We can get the error that caused incoming migration to fail directly
   from QEMU via query-migrate QMP command.

https://issues.redhat.com/browse/RHEL-7041

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agoqemu: Replace qemuDomainCheckMonitor with qemuMigrationJobCheckStatus
Jiri Denemark [Thu, 12 Dec 2024 09:45:38 +0000 (10:45 +0100)] 
qemu: Replace qemuDomainCheckMonitor with qemuMigrationJobCheckStatus

The function is only used during incoming migration in the beginning of
Finish phase to detect if QEMU already died but EOF handler haven't had
a chance to do its job yet. It calls query-status QMP command, but
ignores the result. By calling query-migrate instead we can achieve the
same functionality if QEMU is dead and even get meaningful error from
"error-desc" in case the incoming migration failed and QEMU is still
running.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agoqemu: Detect exit-on-error argument of migrate-incoming
Jiri Denemark [Mon, 9 Dec 2024 13:47:50 +0000 (14:47 +0100)] 
qemu: Detect exit-on-error argument of migrate-incoming

The exit-on-error argument (added in QEMU 9.1.0) can be used to tell
QEMU not to exit when incoming migration fails so that the error can be
retrieved via QMP. This patch adds a new capability bit indicating
support for the new argument.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agoqemu_capabilities: Avoid memleak in virQEMUCapsProbeFullDeprecatedProperties()
Michal Privoznik [Wed, 18 Dec 2024 15:15:56 +0000 (16:15 +0100)] 
qemu_capabilities: Avoid memleak in virQEMUCapsProbeFullDeprecatedProperties()

As one of its arguments, the
virQEMUCapsProbeFullDeprecatedProperties() gets a pointer to
GStrv (a string list), which it may eventually replace. It's
single caller (virQEMUCapsProbeQMPHostCPU()) passes a string list
indeed. Now, when replacing one string list with another plain
g_free() is not enough as we need to free individual strings too.

==13573== 34 bytes in 8 blocks are definitely lost in loss record 271 of 576
==13573==    at 0x4844878: malloc (vg_replace_malloc.c:446)
==13573==    by 0x51789D1: g_malloc (in /usr/lib64/libglib-2.0.so.0.7800.6)
==13573==    by 0x5193E82: g_strdup (in /usr/lib64/libglib-2.0.so.0.7800.6)
==13573==    by 0x4997F73: g_strdup_inline (gstrfuncs.h:321)
==13573==    by 0x4997F73: virJSONValueArrayToStringList (virjson.c:1296)
==13573==    by 0x5027CF7: qemuMonitorJSONParseCPUModelExpansion (qemu_monitor_json.c:5139)
==13573==    by 0x50281C9: qemuMonitorJSONGetCPUModelExpansion (qemu_monitor_json.c:5245)
==13573==    by 0x501044F: qemuMonitorGetCPUModelExpansion (qemu_monitor.c:3261)
==13573==    by 0x4F190D0: virQEMUCapsProbeQMPHostCPU (qemu_capabilities.c:3227)
==13573==    by 0x4F2145E: virQEMUCapsInitQMPMonitor (qemu_capabilities.c:5758)
==13573==    by 0x10FFF8: testQemuCaps (qemucapabilitiestest.c:111)
==13573==    by 0x110B53: virTestRun (testutils.c:143)
==13573==    by 0x11063E: doCapsTest (qemucapabilitiestest.c:200)

Fixes: 51c098347d7f2af9b4386ac0adc4431997d06f3d
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
7 months agoqemu: Enable I/O APIC even more frequently
Michal Privoznik [Wed, 18 Dec 2024 10:07:26 +0000 (11:07 +0100)] 
qemu: Enable I/O APIC even more frequently

In my previous commit v10.10.0-48-g2d222ecf6e I've made us enable
I/O APIC when there is an IOMMU with EIM. This works well. What
does not work is case when there's just an IOMMU without EIM but
with 256+ vCPUS. Problem is that post parsing happens in two
stages: general domain post parse (where
qemuDomainDefEnableDefaultFeatures() is called) and then per
device post parse (where qemuDomainIOMMUDefPostParse() is
called). Now, in aforementioned case it is the device post parse
phase where EIM is enabled but the code that would enable
VIR_DOMAIN_FEATURE_IOAPIC has already run.

To resolve this, make the domain post parse callback "foresee"
the future enabling of EIM so that it can turn on I/O APIC
beforehand.

Resolves: https://issues.redhat.com/browse/RHEL-65844
Fixes: 2d222ecf6e73614a400b830ac56e9aaa1bc55ecc
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agorpm: ensure we own directories we might create
Daniel P. Berrangé [Tue, 17 Dec 2024 10:43:33 +0000 (10:43 +0000)] 
rpm: ensure we own directories we might create

An RPM must own any directories its creates, unless it can guarantee a
dependancy has ownership. Two packages owning the same directory is fine
if permissions are consistent.

We don't require augeas as a dep in most packages, so we must own the
augeas lens directories. Likewise for systemtap tapset dirs.

Our own cpu map dir also needs ownership.

A few files are re-sorted, so that the files are listed immediately
adjacent to the %dir that contains them.

https://bugzilla.redhat.com/show_bug.cgi?id=2280979
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agoFix a few typos in error messages
Jiri Denemark [Tue, 17 Dec 2024 11:04:07 +0000 (12:04 +0100)] 
Fix a few typos in error messages

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/722
Reported-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agoconf: add deprecated_features attribute
Collin Walling [Mon, 16 Dec 2024 23:03:58 +0000 (18:03 -0500)] 
conf: add deprecated_features attribute

Add a new a attribute, deprecated_features='on|off' to the <cpu>
element.  This is used to toggle features flagged as deprecated on the
CPU model on or off.  When this attribute is paired with 'on',
deprecated features will not be filtered.  When paired with 'off', any
CPU features that are flagged as deprecated will be listed under the
CPU model with the 'disable' policy.

Example:

  <cpu mode='host-model' check='partial' deprecated_features='off'/>

The absence of this attribute is equivalent to the 'on' option.

The deprecated features that will populate the domain XML are the same
features that result in the virsh domcapabilities command with the
--disable-deprecated-features argument present.

It is recommended to define a domain XML with this attribute set to
'off' to ensure migration to machines that may outright drop these
features in the future.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agovirsh: add --disable-deprecated-features flag to domcapabilities
Collin Walling [Mon, 16 Dec 2024 23:03:57 +0000 (18:03 -0500)] 
virsh: add --disable-deprecated-features flag to domcapabilities

Add a new flag, --disable-deprecated-features, to the domcapabilities
command.  This will modify the output to show the 'host-model' CPU
with features flagged as deprecated paired with the 'disable' policy.

virsh domcapabilities --disable-deprecated-features

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agoqemu_capabilities: filter deprecated features if requested
Collin Walling [Mon, 16 Dec 2024 23:03:56 +0000 (18:03 -0500)] 
qemu_capabilities: filter deprecated features if requested

If flag VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES
is passed to qemuConnectGetDomainCapabilities, then the domain's CPU
model features will be updated to set any deprecated features to the
'disabled' policy.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agolibvirt-domain: introduce VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES
Collin Walling [Mon, 16 Dec 2024 23:03:55 +0000 (18:03 -0500)] 
libvirt-domain: introduce VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES

Introduce domain flag used to filter deprecated features from the
domain's CPU model.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agoqemu_capabilities: query deprecated features for host-model
Collin Walling [Mon, 16 Dec 2024 23:03:54 +0000 (18:03 -0500)] 
qemu_capabilities: query deprecated features for host-model

Add QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_DEPRECATED_PROPS for detecting
if query-cpu-model-expansion can report deprecated CPU model properties.
QEMU introduced this capability in 9.1 release.  Add flag and deprecated
features to the capabilities test data for QEMU 9.1 and 9.2 replies/XML
since it can now be accounted for.

When probing for the host CPU, perform a full CPU model expansion to
retrieve the list of features deprecated across the entire architecture.
The list and count are stored in the host's CPU model info within the
QEMU capabilities.  Other info resulting from this query (e.g. model
name, etc) is ignored.

The new capabilities flag is used to fence off the extra query for
architectures/QEMU binaries that do not report deprecated CPU model
features.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agoqemu: parse deprecated-props from query-cpu-model-expansion response
Collin Walling [Mon, 16 Dec 2024 23:03:53 +0000 (18:03 -0500)] 
qemu: parse deprecated-props from query-cpu-model-expansion response

query-cpu-model-expansion may report an array of deprecated properties.
This array is optional, and may not be supported for a particular
architecture or reported for a particular CPU model. If the output is
present, then capture it and store in a qemuMonitorCPUModelInfo struct
for later use.

The deprecated features will be retained in qemuCaps->kvm->hostCPU.info
and will be stored in the capabilities cache file under the <hostCPU>
element using the following format:

        <deprecatedFeatures>
                <property name='bpb'/>
                <property name='csske'/>
                <property name='cte'/>
                <property name='te'/>
        </deprecatedFeatures>

At this time the data is only queried, parsed, and cached.  The data
will be utilized in a subsequent patch.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agoqemuMonitorJSONGetCPUModelExpansion: refactor parsing functions
Collin Walling [Mon, 16 Dec 2024 23:03:52 +0000 (18:03 -0500)] 
qemuMonitorJSONGetCPUModelExpansion: refactor parsing functions

Refactor the CPU Model parsing functions within
qemuMonitorJSONGetCPUModelExpansion.  The new functions,
qemuMonitorJSONParseCPUModelExpansionData and
qemuMonitorJSONParseCPUModelExpansion invoke the functions they
replace and leave room for a subsequent patch to handle parsing the
(optional) deprecated_props field resulting from the command.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agoqemu: Enable I/O APIC if needed
Michal Privoznik [Thu, 12 Dec 2024 09:02:43 +0000 (10:02 +0100)] 
qemu: Enable I/O APIC if needed

This is a follow up of my previous commits. If the number of
vCPUs exceeds some arbitrary value (255) then QEMU requires IOMMU
with EIM and intremap enabled. But in turn, intremap IOMMU
requires split I/O APIC (per virDomainDefIOMMUValidate()). Since
after my previous commits (e.g. v10.10.0-rc1~183) IOMMU is added
automagically, the I/O APIC can be also enabled automagically.

Relates to: https://issues.redhat.com/browse/RHEL-65844
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 months agologging: Change return type of virLogDaemonConfigFilePat to void
Alexander Kuznetsov [Mon, 16 Dec 2024 09:41:08 +0000 (12:41 +0300)] 
logging: Change return type of virLogDaemonConfigFilePat to void

This function return value is invariant since 18f3771, so change
its type and remove all dependent checks.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Reported-by: Pavel Nekrasov <p.nekrasov@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agoutil: Change return type of virSCSIVHostDeviceSetUsedBy to void
Alexander Kuznetsov [Mon, 16 Dec 2024 09:41:07 +0000 (12:41 +0300)] 
util: Change return type of virSCSIVHostDeviceSetUsedBy to void

This function return value is invariant since 18f3771, so change
its type and remove all dependent checks.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Reported-by: Pavel Nekrasov <p.nekrasov@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agoutil: Change return type of virSCSIDeviceSetUsedBy to void
Alexander Kuznetsov [Mon, 16 Dec 2024 09:41:06 +0000 (12:41 +0300)] 
util: Change return type of virSCSIDeviceSetUsedBy to void

This function return value is invariant since 18f3771, so change
its type and remove all dependent checks.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Reported-by: Pavel Nekrasov <p.nekrasov@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agoutil: Change return type of virPCIDeviceSetUsedBy to void
Alexander Kuznetsov [Mon, 16 Dec 2024 09:41:05 +0000 (12:41 +0300)] 
util: Change return type of virPCIDeviceSetUsedBy to void

This function return value is invariant since 18f3771, so change
its type and remove all dependent checks.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Reported-by: Pavel Nekrasov <p.nekrasov@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agoqemu: re-use existing ActualNetDef for more interface types during update-device
Laine Stump [Tue, 26 Nov 2024 03:51:04 +0000 (22:51 -0500)] 
qemu: re-use existing ActualNetDef for more interface types during update-device

For the full history behind this patch, look at the following:

   https://issues.redhat.com/browse/RHEL-7036
   commit v10.7.0-101-ga37bd2a15b
   commit v10.8.0-rc2-8-gbcd5ae4e73

Summary: original problem was unexpected failure of update-device when
the user hadn't changed anything other than online status of the guest
NIC (which should always be allowed).

The first commit "fixed" this by avoiding the allocation of a new
ActualNetDef (i.e. creating a new networkport) for *all* network
device updates (because that was inappropriately changing which
ethernet physdev should be used for a macvtap connection, which by
design can't be handled in an update-device).

But this commit caused a regression for update-device of bridge-based
network devices (because some the updates of certain attributes *do*
require the ActualNetDef be re-allocated), so...

The 2nd commit narrowed the list of network types that get the "don't
allocate new ActualNetDef" treatment (so that only interfaces
connected to a network that uses a pool of ethernet VFs *being used in
passthrough mode* qualify).

But then it was pointed out that this re-broke simple updates of
devices that used a direct/macvtap network in "bridge" mode (because
it's possible to list multiple physdevs to use for bridge mode, in
which case the network driver attempts to "load balance" (and so a new
allocation might have a different ethernet physdev which, again, can't
be supported in a device-update).

So this (single line of code) patch *widens* the list of network types
that don't allocate a new ActualNetDef to also include the other
direct (macvtap) modes, e.g. bridge, private, etc.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agoutil: virsysinfo: Change return type of functions that never fail to void
Alexander Kuznetsov [Thu, 28 Nov 2024 15:21:22 +0000 (18:21 +0300)] 
util: virsysinfo: Change return type of functions that never fail to void

These functions return value is invariant since VIR_EXPAND_N check
removal in 7d2fd6e, so change its type and remove all dependent checks.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Reported-by: Pavel Nekrasov <p.nekrasov@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agohyperv: Change return type of hypervCheckParams to void
Alexander Kuznetsov [Thu, 28 Nov 2024 15:21:21 +0000 (18:21 +0300)] 
hyperv: Change return type of hypervCheckParams to void

This function return value is invariant since VIR_EXPAND_N check
removal in 7d2fd6e, so change its type and remove all dependent checks.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Reported-by: Pavel Nekrasov <p.nekrasov@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agorpc: Change return type of virNetClientAddStream to void
Alexander Kuznetsov [Thu, 28 Nov 2024 15:21:20 +0000 (18:21 +0300)] 
rpc: Change return type of virNetClientAddStream to void

This function return value is invariant since VIR_EXPAND_N check
removal in 7d2fd6e, so change its type and remove all dependent checks.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Reported-by: Pavel Nekrasov <p.nekrasov@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agorpc: Change return type of virNetClientAddProgram to void
Alexander Kuznetsov [Thu, 28 Nov 2024 15:21:19 +0000 (18:21 +0300)] 
rpc: Change return type of virNetClientAddProgram to void

This function return value is invariant since VIR_EXPAND_N check
removal in 7d2fd6e, so change its type and remove all dependent checks.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Reported-by: Pavel Nekrasov <p.nekrasov@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agorpc: Change return type of virNetServerAddProgram to void
Alexander Kuznetsov [Thu, 28 Nov 2024 15:21:18 +0000 (18:21 +0300)] 
rpc: Change return type of virNetServerAddProgram to void

This function return value is invariant since VIR_EXPAND_N check
removal in 7d2fd6e, so change its type and remove all dependent checks.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Reported-by: Pavel Nekrasov <p.nekrasov@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agoaccess: Change return type of virAccessDriverStackAppend to void
Alexander Kuznetsov [Thu, 28 Nov 2024 15:21:17 +0000 (18:21 +0300)] 
access: Change return type of virAccessDriverStackAppend to void

This function return value is invariant since VIR_EXPAND_N check
removal in 7d2fd6e, so change its type and remove all dependent checks.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Reported-by: Pavel Nekrasov <p.nekrasov@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 months agocpu_map: Add EPYC-Genoa-v1 CPU model
Jiri Denemark [Thu, 5 Dec 2024 15:02:17 +0000 (16:02 +0100)] 
cpu_map: Add EPYC-Genoa-v1 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agocpu_map: Add Opteron_G5-v1 CPU model
Jiri Denemark [Thu, 5 Dec 2024 15:01:20 +0000 (16:01 +0100)] 
cpu_map: Add Opteron_G5-v1 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agocpu_map: Add Opteron_G4-v1 CPU model
Jiri Denemark [Thu, 5 Dec 2024 14:49:46 +0000 (15:49 +0100)] 
cpu_map: Add Opteron_G4-v1 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agocpu_map: Add Opteron_G3-v1 CPU model
Jiri Denemark [Thu, 5 Dec 2024 14:48:47 +0000 (15:48 +0100)] 
cpu_map: Add Opteron_G3-v1 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agocpu_map: Add Opteron_G2-v1 CPU model
Jiri Denemark [Thu, 5 Dec 2024 14:47:52 +0000 (15:47 +0100)] 
cpu_map: Add Opteron_G2-v1 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agocpu_map: Add Opteron_G1-v1 CPU model
Jiri Denemark [Thu, 5 Dec 2024 14:45:11 +0000 (15:45 +0100)] 
cpu_map: Add Opteron_G1-v1 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agocpu_map: Add phenom-v1 CPU model
Jiri Denemark [Thu, 5 Dec 2024 14:44:29 +0000 (15:44 +0100)] 
cpu_map: Add phenom-v1 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 months agocpu_map: Add athlon-v1 CPU model
Jiri Denemark [Thu, 5 Dec 2024 14:43:25 +0000 (15:43 +0100)] 
cpu_map: Add athlon-v1 CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>