]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
8 months agoqemuSnapshotForEachQcow2: Refactor
Peter Krempa [Tue, 12 Nov 2024 07:47:29 +0000 (08:47 +0100)] 
qemuSnapshotForEachQcow2: Refactor

Refactor the function to avoid recursive call to rollback and simplify
calling parameters.

To achieve that most of the fatal checks are extracted into a dedicated
loop that runs before modifying the disk state thus removing the need to
rollback altoghether. Since rollback is still necessary when creation of
the snapshot fails half-way through the rollback is extracted to handle
only that scenario.

Additionally callers would only pass the old 'try_all' argument as true
on all non-creation ("-c") modes. This means that we can infer it from
the operation instead of passing it as an extra argument.

This refactor will also make it much simpler to implement handling of
the NVRAM pflash backing file (in case it's qcow2) for internal
snapshots.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Move 'qemuDomainSnapshotForEachQcow2(Raw)' to qemu_snapshot.c
Peter Krempa [Mon, 11 Nov 2024 16:20:39 +0000 (17:20 +0100)] 
qemu: Move 'qemuDomainSnapshotForEachQcow2(Raw)' to qemu_snapshot.c

The functions are exclusively used in the snapshot module. Move and
rename them:

  qemuDomainSnapshotForEachQcow2Raw -> qemuSnapshotForEachQcow2Internal
  qemuDomainSnapshotForEachQcow2 -> qemuSnapshotForEachQcow2

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemuDomainSnapshotForEachQcow2Raw: Remove 'driver' argument
Peter Krempa [Mon, 11 Nov 2024 16:17:04 +0000 (17:17 +0100)] 
qemuDomainSnapshotForEachQcow2Raw: Remove 'driver' argument

Now that it's unused except for the recursive call it can be dropped
from all of the call tree.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Don't store path to qemu img
Peter Krempa [Mon, 11 Nov 2024 15:42:10 +0000 (16:42 +0100)] 
qemu: Don't store path to qemu img

The 'virCommand' helpers already look up the full path to the binary in
PATH if it's not specified. This means that the qemu driver doesn't have
to lookup and store the path to 'qemu-img' in the conf object but rather
can be cleaned up to use this new infrastructure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: Enable callbacks for ch domain events
Praveen K Paladugu [Tue, 10 Sep 2024 19:22:43 +0000 (14:22 -0500)] 
ch: Enable callbacks for ch domain events

Enable callbacks for define, undefine, started, booted, stopped,
destroyed events of ch guests.

Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: enable virNodeGetMemoryStats API
Praveen K Paladugu [Fri, 15 Nov 2024 19:48:58 +0000 (13:48 -0600)] 
ch: enable virNodeGetMemoryStats API

Enable virNodeGetMemoryStats API to return the stats of host memory.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Sun, 17 Nov 2024 09:42:07 +0000 (09:42 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 96.5% (10165 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Fri, 15 Nov 2024 20:38:33 +0000 (20:38 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 96.3% (10145 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Thu, 14 Nov 2024 21:04:48 +0000 (21:04 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 96.1% (10118 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Wed, 13 Nov 2024 20:40:42 +0000 (20:40 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.9% (10098 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Weblate [Wed, 13 Nov 2024 20:37:54 +0000 (20:37 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.8% (10087 of 10526 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Wed, 13 Nov 2024 20:35:45 +0000 (20:35 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.8% (10087 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Czech)
Pavel Borecki [Wed, 13 Nov 2024 19:28:20 +0000 (19:28 +0000)] 
Translated using Weblate (Czech)

Currently translated at 96.9% (10206 of 10526 strings)

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

Signed-off-by: Pavel Borecki <pavel.borecki@gmail.com>
8 months agoqemu: Read back the profile name after creation of a TPM instance
Stefan Berger [Wed, 13 Nov 2024 17:39:51 +0000 (12:39 -0500)] 
qemu: Read back the profile name after creation of a TPM instance

Get the JSON profile that the swtpm instance was created with from the
output of 'swtpm socket --tpm2 --print-info 0x20 --tpmstate ...'. Get the
name of the profile from the JSON and set it in the current and persistent
emulator descriptions as 'name' attribute and have the persistent
description stored with this update. The user should avoid setting this
'name' attribute since it is meant to be read-only. The following is
an example of how the XML could look like:

  <profile source='local:restricted' name='custom:restricted'/>

If the user provided no profile node, and therefore swtpm_setup picked its
default profile, the XML may now shows the 'name' attribute with the name
of the profile. This makes the 'source' attribute now optional.

  <profile name='default-v1'/>

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Move adding --tpmstate to swtpm command line into own function
Stefan Berger [Wed, 13 Nov 2024 17:39:50 +0000 (12:39 -0500)] 
qemu: Move adding --tpmstate to swtpm command line into own function

Factor-out code related to adding the --tpmstate option to the swtpm
command line into its own function.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Move adding of keys to swtpm command line into own function
Stefan Berger [Wed, 13 Nov 2024 17:39:49 +0000 (12:39 -0500)] 
qemu: Move adding of keys to swtpm command line into own function

Factor-out code related to adding key to the swtpm command line into its
own function.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Extend swtpm_setup command line to set a profile by its name
Stefan Berger [Wed, 13 Nov 2024 17:39:48 +0000 (12:39 -0500)] 
qemu: Extend swtpm_setup command line to set a profile by its name

Run swtpm_setup with the --profile-name option if the user provided the
name of a profile. swtpm_setup will try to load the profile from
directories with local profiles and distro profiles and if no profile
by this name with appended '.json' suffix could be found there, it will
fall back to try to use an internal profile with the given name.

Also set the --profile-remove-disabled option if the user provided a value
in the remove_disabled attribute in the profile XML node.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agodocs: Add documentation for the TPM backend profile node
Stefan Berger [Wed, 13 Nov 2024 17:39:47 +0000 (12:39 -0500)] 
docs: Add documentation for the TPM backend profile node

Add documentation for the TPM backend profile node and point the reader to
further documentation about TPM profiles available in the swtpm man page.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoconf: Add support for profile parameter on TPM emulator in domain XML
Stefan Berger [Wed, 13 Nov 2024 17:39:46 +0000 (12:39 -0500)] 
conf: Add support for profile parameter on TPM emulator in domain XML

Extend the parser and XML builder with support for the profile parameter
and its remove_disabled attribute.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoschema: Extend schema for TPM emulator profile node
Stefan Berger [Wed, 13 Nov 2024 17:39:45 +0000 (12:39 -0500)] 
schema: Extend schema for TPM emulator profile node

Extend the schema for the TPM emulator profile node. Require that the
profile the user provides is described in a 'source' attribute. An optional
remove_disabled attribute is also supported for swtpm to automatically
remove algorithms from the 'custom' profile if they are disabled by FIPS
mode on the host.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoconf: Define enum virDomainTPMProfileRemoveDisabled
Stefan Berger [Wed, 13 Nov 2024 17:39:44 +0000 (12:39 -0500)] 
conf: Define enum virDomainTPMProfileRemoveDisabled

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoutil: Add parsing support for swtpm_setup's cmdarg-profile capability
Stefan Berger [Wed, 13 Nov 2024 17:39:43 +0000 (12:39 -0500)] 
util: Add parsing support for swtpm_setup's cmdarg-profile capability

Add support for parsing swtpm_setup 'cmdarg-profile' capability
(since v0.10).

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Pass virQEMUDriverConfig rather than some of its fields
Stefan Berger [Wed, 13 Nov 2024 17:39:42 +0000 (12:39 -0500)] 
qemu: Pass virQEMUDriverConfig rather than some of its fields

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoconf: Move TPM emulator parameters into own struct
Stefan Berger [Wed, 13 Nov 2024 17:39:41 +0000 (12:39 -0500)] 
conf: Move TPM emulator parameters into own struct

To avoid passing TPM emulator parameters around individually, move them
into a structure and pass around the structure.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Avoid useless tmp variable in qemuCanonicalizeMachine
Jiri Denemark [Thu, 7 Nov 2024 08:53:33 +0000 (09:53 +0100)] 
qemu: Avoid useless tmp variable in qemuCanonicalizeMachine

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
8 months agoch: explicitly set INFILESIZE to 0
Praveen K Paladugu [Fri, 11 Oct 2024 18:13:11 +0000 (13:13 -0500)] 
ch: explicitly set INFILESIZE to 0

While sending API requests that don't need any body, explicitly set
CURLOPT_INFILESIZE to 0.

Without this option, curl sends a chunked request with `Expect: 100-continue`
header. The client, in this case curl, expects a response from the server,
ch in this case, to respond within a timeout period.

If guest definition has a PCI passthrough device configuration,
cloud-hypervisor process cannot respond within above mentioned timeout.
Even if cloud-hypervisor responds after the timeout, curl cannot read
the response. Because of this, virsh request to create a guest, hangs. This
only happens while using "mshv" hypervisor.

By setting CURLOPT_INFILESIZE to O, curl drops the Expect header and
sychronously waits for server to respond.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: reattach PCI devices to host while stopping guest
Praveen K Paladugu [Fri, 11 Oct 2024 18:13:10 +0000 (13:13 -0500)] 
ch: reattach PCI devices to host while stopping guest

Reattach PCI devices to host, while stopping ch guest.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: allow hostdev in domain definitions
Praveen K Paladugu [Fri, 11 Oct 2024 18:13:09 +0000 (13:13 -0500)] 
ch: allow hostdev in domain definitions

Allow hostdev configurations in ch guest definitions.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: prepare host for PCI passthrough
Wei Liu [Fri, 11 Oct 2024 18:13:08 +0000 (13:13 -0500)] 
ch: prepare host for PCI passthrough

Prepare host to passthrough PCI devices for ch guests.

Co-authored-by: Wei Liu <liuwe@microsoft.com>
Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: prepare domain definition for pci passthrough
Wei Liu [Fri, 11 Oct 2024 18:13:06 +0000 (13:13 -0500)] 
ch: prepare domain definition for pci passthrough

Check if the domain definition is valid for PCI passthrough and update
it if necessary.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: add host device manager to driver
Wei Liu [Fri, 11 Oct 2024 18:13:05 +0000 (13:13 -0500)] 
ch: add host device manager to driver

Co-authored-by: Wei Liu <liuwe@microsoft.com>
Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agohypervisor: move HostdevHostSupportsPassthroughVFIO
Praveen K Paladugu [Fri, 11 Oct 2024 18:13:03 +0000 (13:13 -0500)] 
hypervisor: move HostdevHostSupportsPassthroughVFIO

Move HostdevHostSupportsPassthroughVFIO method to hypervisor to be
shared between qemu and ch drivers.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agohypervisor: move HostdevNeedsVFIO to hypervisor
Praveen K Paladugu [Fri, 11 Oct 2024 18:13:02 +0000 (13:13 -0500)] 
hypervisor: move HostdevNeedsVFIO to hypervisor

Move HostdevNeedsVFIO method to hypervisor to be reused between qemu
and ch drivers.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agokbase: virtiofs: Clarify migration support statement
Peter Krempa [Fri, 15 Nov 2024 09:00:25 +0000 (10:00 +0100)] 
kbase: virtiofs: Clarify migration support statement

virtiofs 1.11 contains support for migration so update the 'Note' which
states that migration is not supported.

Additionally mention that VM snapshots don't save state of the files
shared via virtiofs so reverting is not a good idea.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: process: Introduce setup of block-device backed NVRAM
Peter Krempa [Fri, 18 Oct 2024 13:55:44 +0000 (15:55 +0200)] 
qemu: process: Introduce setup of block-device backed NVRAM

In case when a management application will require to store the nvram in
a block device instead of a file libvirt needs to be able to set up the
block device.

This patch introduces support for setting up the block device by using
'qemu-img convert' to produce a qcow2-formatted block device.

The use of 'qcow2' is made mandatory as the UEFI firmware requires that
the NVRAM image has the exact expected size, which is almost impossible
with block devices. 'qcow2' also allows libvirt to detect wheher the
block device is formatted allowing file-like semantics.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemu: process: Extract setup of file-backed nvram from template
Peter Krempa [Fri, 18 Oct 2024 13:55:33 +0000 (15:55 +0200)] 
qemu: process: Extract setup of file-backed nvram from template

The setup of nvram will later be extended to also support block-device
backed nvram, so extract the file-backed nvram setup steps from
'qemuPrepareNVRAM' into 'qemuPrepareNVRAMFile'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoconf: Remove nonsensical requirement of nvram format matching firmware format
Peter Krempa [Thu, 15 Aug 2024 15:02:54 +0000 (17:02 +0200)] 
conf: Remove nonsensical requirement of nvram format matching firmware format

The nvram image can have any supported format and there's no technical
requirement of them having the same format. In fact the actual nvram
image doesn't necessarily need to have the same format as the template
if the user is willing to format it themselves (as libvirt is not going
to convert it).

Remove the nonsensical check and adjust tests. The test case required
swapping around the format in order to work properly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemuFirmwareMatchDomain: Don't base firmware selection on nvram image format
Peter Krempa [Tue, 20 Aug 2024 14:15:05 +0000 (16:15 +0200)] 
qemuFirmwareMatchDomain: Don't base firmware selection on nvram image format

Basing the selection on the format of the actual NVRAM image makes no
sense as user may format the image themselves.

Additionally it doesn't make much sense to even limit the firmware
selection based on the nvram template itself. As format of the template
is given and firmware images don't really provide any choice.

Remove the limitation so that autoselection can pick a template
regardless of the selected format or template format.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemuPrepareNVRAM: Refuse conversion of NVRAM backing file format
Peter Krempa [Mon, 4 Nov 2024 17:04:29 +0000 (18:04 +0100)] 
qemuPrepareNVRAM: Refuse conversion of NVRAM backing file format

Refuse situations where the user configures a different format for a
file-backed nvram than the template file has.

At this point it's still required that the NVRAM and firmware share
format, but that is going to be relaxed, thus we need to refuse
configurations that the code can't handle.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoconf: Always format firmware image format
Peter Krempa [Mon, 26 Aug 2024 13:37:35 +0000 (15:37 +0200)] 
conf: Always format firmware image format

The code historically skipped the 'format' field for 'raw' images as we
didn't output it when no format support was present. Stop misleading and
output the format also for 'raw' images.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoconf: domain: Output 'format' attribute of '<nvram>' also for' raw images
Peter Krempa [Thu, 22 Aug 2024 10:12:10 +0000 (12:12 +0200)] 
conf: domain: Output 'format' attribute of '<nvram>' also for' raw images

As the 'format' field is meant to carry the format of the nvram image we
should output it even when the image is 'raw'.

Currently this is not a problem but later patches will allow mismatch
between the nvram format and loader format (as nothing really
technically requires them to be the same and this then could become
problem).

Modify the condition and update tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agofirmware: Add 'templateFormat' XML attribute and plumb it in
Peter Krempa [Tue, 20 Aug 2024 14:19:00 +0000 (16:19 +0200)] 
firmware: Add 'templateFormat' XML attribute and plumb it in

Currently the qemu firmware code weirdly depends on the 'format' field
of the nvram image itself to do the auto-selection process as well as
then uses it to declare the actual type to qemu.

As it's not technically required that the template and the on disk image
share the type introduce a 'templateFormat' field which will split off
from the shared purpose of the type and will be used for the selection
and instantiation process, while 'format' will be left for the actual
type of the on disk image.

This patch introduces the field, adds XML infrastructure as well as
plumbs it to the firmware bits.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agodocs: formatdomain: Clarify that NVRAM template is also being autoselected
Peter Krempa [Thu, 22 Aug 2024 15:20:32 +0000 (17:20 +0200)] 
docs: formatdomain: Clarify that NVRAM template is also being autoselected

The NVRAM template file may be autoselected same as the loader/firmware
image. Add a hint that this can occur and also that it doesn't
necessarily need to be from the 'qemu.conf' configured files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoconf: domain: Clarify nvram/loader format logic
Peter Krempa [Mon, 19 Aug 2024 14:57:55 +0000 (16:57 +0200)] 
conf: domain: Clarify nvram/loader format logic

Restructure the code to assign first (as this is simpler to refactor in
the future) and avoid mixing implicit value checks with explicit ones by
checking for _NONE.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemu: Install backing store terminators for 'pflash' blockdevs
Peter Krempa [Mon, 4 Nov 2024 16:45:54 +0000 (17:45 +0100)] 
qemu: Install backing store terminators for 'pflash' blockdevs

The qemu driver does support qcow2 images for the firmware and nvram
pflash devices, but we do not do the full backing chain setup for them
as we don't expect that those images would actually have a backing
store. We don't tell that to qemu though which theoretically can lead to
qemu probing the backing store from the image itself. We don't want that
for now.

Deny qemu probing the backing store by installing a "terminator" empty
virStorageSource as 'backingStore' for pflash and nvram.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemuFirmwareEnsureNVRAM: Don't try to setup non-local nvram
Peter Krempa [Mon, 19 Aug 2024 13:45:31 +0000 (15:45 +0200)] 
qemuFirmwareEnsureNVRAM: Don't try to setup non-local nvram

'qemuFirmwareEnsureNVRAM' which fills the NVRAM configuration bits which
may be missing was basing its decision to do something based on whether
the 'path' field was set. This is insufficient if remote storage is to
be considered.

Use 'virStorageSourceIsEmpty()' instead as that properly considers
remote filesystems and explain why the source is unref'd when the
function decides to rewrite the config.

The 'firmware-auto-efi-format-nvram-qcow2-network-nbd' is modified to
omit filling the 'path' field, which without this fix would result in
the nvram to be reset to a local file.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemuPrepareNVRAM: Don't attempt to create NVRAM on block device
Peter Krempa [Fri, 23 Aug 2024 11:14:33 +0000 (13:14 +0200)] 
qemuPrepareNVRAM: Don't attempt to create NVRAM on block device

'virFileRewrite()' which is used to setup the NVRAM image if it doesn't
exist or when it is requested by the user forcibly replaces the
destination file by the file it creates. For block devices this
overwrites the device node file or the symlink pointing to the device
node by a regular file instead of formatting it.

As this not only makes the VM fail to start but also breaks user's /dev/
filesystem forbid it for now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agosyntax-check: Suggest ways to fix internal references
Andrea Bolognani [Wed, 13 Nov 2024 21:51:35 +0000 (22:51 +0100)] 
syntax-check: Suggest ways to fix internal references

The rule catches incorrect attempts to use internal references,
but doesn't guide the developer hitting a failure towards the
not exactly obvious acceptable alternatives.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agodocs: Document authselect to enable the NSS module
Andrea Bolognani [Tue, 12 Nov 2024 22:32:33 +0000 (23:32 +0100)] 
docs: Document authselect to enable the NSS module

When using recent Fedora and RHEL versions, the manual setup that
is otherwise necessary to enable the module can be replaced with
executing a single command.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agodocs: Rework documentation for the NSS module
Andrea Bolognani [Tue, 12 Nov 2024 19:28:49 +0000 (20:28 +0100)] 
docs: Rework documentation for the NSS module

The page contains some confusing information, especially around
limitations that supposedly only affect one of the two variants,
and goes into what is arguably an unnecessary amount of detail
when it comes to its inner workings.

We can make the page a lot shorter and snappier without
affecting its usefulness, so let's do just that.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Move PostParse functions out of qemu_domain.c
Michal Privoznik [Tue, 12 Nov 2024 14:55:14 +0000 (15:55 +0100)] 
qemu: Move PostParse functions out of qemu_domain.c

Problem with qemu_domain.c is that it's constantly growing. But
there are few options for improvement. For instance, validation
functions were moved out and now live in qemu_validate.c. We can
do the same for PostParse functions, though since PostParse may
modify domain definition, some functions need to be exported from
qemu_domain.c.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
8 months agoqemu_hotplug: Do not report unknown error when hot-unplugging non-existing device
Martin Kletzander [Fri, 8 Nov 2024 11:30:06 +0000 (12:30 +0100)] 
qemu_hotplug: Do not report unknown error when hot-unplugging non-existing device

When qemuDomainDeleteDevice() gets "DeviceNotFound" error it is a
special case as we're trying to remove a device which does not exists
any more.  Such occasion is indicated by the return value -2.

Callers of the aforementioned function ought to base their behaviour on
the return value.  However not all callers take as much care for the
return value as one could realistically anticipate.

Follow the usual direction of removing possible backend object (in case
of character devices), remove the device from its XML without waiting
for the device removal from QEMU (since it is already not there) and
basically follow the same algorithm as there is when the device was
removed, skipping over the wait for the device removal.

The overall return value also needs to be adjusted since
qemuDomainDeleteDevice() does not set an error on the -2 return value
and would otherwise trigger an unknown error being reported to the user
or management application.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoDrop unused function declarations
Michal Privoznik [Tue, 12 Nov 2024 13:32:12 +0000 (14:32 +0100)] 
Drop unused function declarations

When moving function and/or renaming them sometimes corresponding
change to corresponding header file is not done. This leaves us
with functions that are declared in header files, but nowhere
implemented. Drop such declarations.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agovirnetserverclient.h: Fix typo in comment of virNetServerClientPrivPreExecRestart()
Michal Privoznik [Tue, 12 Nov 2024 13:33:07 +0000 (14:33 +0100)] 
virnetserverclient.h: Fix typo in comment of virNetServerClientPrivPreExecRestart()

The function the comment is referring to is
virNetServerClientPrivNew() not virNetServerClintPrivNew(). The
latter doesn't even exist.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agodocs: Add Sys::Async::Virt to apps.html
Martin Kletzander [Tue, 12 Nov 2024 09:57:48 +0000 (10:57 +0100)] 
docs: Add Sys::Async::Virt to apps.html

As requested on the libvirt users list I am adding this mention to the
apps page.

Reported-by: Erik Huelsmann <ehuels@gmail.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 12 Nov 2024 09:21:47 +0000 (09:21 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.7% (10079 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Weblate [Tue, 12 Nov 2024 09:21:33 +0000 (09:21 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.7% (10078 of 10526 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 12 Nov 2024 09:21:26 +0000 (09:21 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.7% (10078 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Weblate [Tue, 12 Nov 2024 09:21:14 +0000 (09:21 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.7% (10077 of 10526 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 12 Nov 2024 09:21:09 +0000 (09:21 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.7% (10077 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Weblate [Tue, 12 Nov 2024 09:20:59 +0000 (09:20 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.7% (10076 of 10526 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 12 Nov 2024 09:16:52 +0000 (09:16 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.7% (10076 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Weblate [Tue, 12 Nov 2024 09:16:43 +0000 (09:16 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.5% (10061 of 10526 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 12 Nov 2024 09:16:30 +0000 (09:16 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.5% (10061 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoci: Update with newer lcitool
Martin Kletzander [Tue, 12 Nov 2024 08:00:28 +0000 (09:00 +0100)] 
ci: Update with newer lcitool

This switches to newer freebsd 14.1 and implements the new RUN_PIPELINE
behaviour introduced by Daniel.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
8 months agoch_monitor: Report OS error when removing socket fails
Michal Privoznik [Mon, 11 Nov 2024 13:45:43 +0000 (14:45 +0100)] 
ch_monitor: Report OS error when removing socket fails

When removing a socket in virCHMonitorClose() fails, a warning is
printed. But it doesn't contain errno nor g_strerror() which may
shed more light into why removing of the socket failed.

Oh, and since virCHMonitorClose() is registered as autoptr
cleanup for virCHMonitor() it may happen that virCHMonitorClose()
is called with mon->socketpath allocated but file not existing
yet (see virCHMonitorNew()). Thus ignore ENOENT and do not print
warning in that case - the file doesn't exist anyways.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoch_monitor: Avoid possible double free in virCHMonitorClose()
Michal Privoznik [Mon, 11 Nov 2024 13:40:32 +0000 (14:40 +0100)] 
ch_monitor: Avoid possible double free in virCHMonitorClose()

The virCHMonitorClose() is meant to be called when monitor to
cloud-hypervisor process closes. It removes the socket and frees
string containing path to the socket.

In general, there is a problem with the following pattern:

  if (var) {
      do_something();
      g_free(var);
  }

because if the pattern executes twice the variable is freed
twice. That's why we have VIR_FREE() macro. Well, replace plain
g_free() with g_clear_pointer(). Mind you, this is NOT a
destructor where clearing pointers is needless.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agotest_driver: provide basic disk hotunplug support
John Levon [Fri, 1 Nov 2024 22:31:57 +0000 (22:31 +0000)] 
test_driver: provide basic disk hotunplug support

Signed-off-by: John Levon <john.levon@nutanix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agotest_driver: provide basic disk hotplug support
John Levon [Fri, 1 Nov 2024 22:31:56 +0000 (22:31 +0000)] 
test_driver: provide basic disk hotplug support

Add some basic plumbing, based on the qemu driver.

Signed-off-by: John Levon <john.levon@nutanix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 11 Nov 2024 11:39:38 +0000 (11:39 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.5% (10059 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Sun, 10 Nov 2024 16:12:45 +0000 (16:12 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.3% (10039 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Weblate [Sun, 10 Nov 2024 16:12:32 +0000 (16:12 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.2% (10024 of 10526 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Sun, 10 Nov 2024 16:11:15 +0000 (16:11 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.2% (10024 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Sat, 9 Nov 2024 11:34:06 +0000 (11:34 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.1% (10017 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Fri, 8 Nov 2024 22:10:37 +0000 (22:10 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 94.9% (9997 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Weblate [Fri, 8 Nov 2024 22:07:12 +0000 (22:07 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 94.8% (9984 of 10526 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Fri, 8 Nov 2024 22:05:47 +0000 (22:05 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 94.8% (9984 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Weblate [Fri, 8 Nov 2024 22:05:13 +0000 (22:05 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 94.7% (9976 of 10526 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Fri, 8 Nov 2024 22:00:53 +0000 (22:00 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 94.7% (9976 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Weblate [Fri, 8 Nov 2024 22:00:39 +0000 (22:00 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 94.6% (9967 of 10526 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Fri, 8 Nov 2024 21:59:42 +0000 (21:59 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 94.6% (9967 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoqemu_hotplug: Report better error message for platform serial devices
Martin Kletzander [Fri, 8 Nov 2024 11:21:09 +0000 (12:21 +0100)] 
qemu_hotplug: Report better error message for platform serial devices

This should be better than the current for both hotplug:

    error: internal error: Invalid target model for serial device

and hot-unplug:

    error: An error occurred, but the cause is unknown

which should not be reached at all.

Resolves: https://issues.redhat.com/browse/RHEL-66222
Resolves: https://issues.redhat.com/browse/RHEL-66223
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agoqemu: Expose qemuChrIsPlatformDevice outside from qemu_command
Martin Kletzander [Fri, 8 Nov 2024 11:18:46 +0000 (12:18 +0100)] 
qemu: Expose qemuChrIsPlatformDevice outside from qemu_command

Then it can be used from qemu_hotplug.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agoNEWS: qemu: add multi boot device support on s390x
Boris Fiuczynski [Fri, 8 Nov 2024 11:05:35 +0000 (12:05 +0100)] 
NEWS: qemu: add multi boot device support on s390x

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agoqemu: command: add multi boot device support on s390x
Boris Fiuczynski [Wed, 6 Nov 2024 07:51:03 +0000 (08:51 +0100)] 
qemu: command: add multi boot device support on s390x

If QEMU supports multi boot device make use of it instead of using the
single boot device machine parameter.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agotests: add capabilities for QEMU 9.2.0 on s390x
Boris Fiuczynski [Wed, 6 Nov 2024 07:49:04 +0000 (08:49 +0100)] 
tests: add capabilities for QEMU 9.2.0 on s390x

Let us introduce the xml and reply files for QEMU 9.2.0 on s390x.

A QEMU at commit v9.1.0-1348-g11b8920ed2 was used to generate this data.

Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agoqemu: capabilities: Add QEMU_CAPS_VIRTIO_CCW_DEVICE_LOADPARM
Boris Fiuczynski [Wed, 6 Nov 2024 07:48:14 +0000 (08:48 +0100)] 
qemu: capabilities: Add QEMU_CAPS_VIRTIO_CCW_DEVICE_LOADPARM

Add capability QEMU_CAPS_VIRTIO_CCW_DEVICE_LOADPARM to detect multi boot
device support in QEMU by checking the virtio-blk-ccw device property
existence of loadparm.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agovirnetdevopenvswitch: Warn on unsupported QoS settings
Michal Privoznik [Tue, 22 Oct 2024 07:11:33 +0000 (09:11 +0200)] 
virnetdevopenvswitch: Warn on unsupported QoS settings

Let me preface this with stating the obvious: documentation on
QoS in OVS is very sparse. This is all based on my observation
and OVS codebase analysis.

For the following QoS setting:

  <bandwidth>
    <inbound average="512" peak="1024" burst="32"/>
  </bandwidth>

the following QoS setting is generated into OVS (NB, our XML
values are in KiB/s, OVS has them in bits/s):

  # ovs-vsctl list qos
  _uuid               : a087226b-2da6-4575-ad4c-bf570cb812a9
  external_ids        : {ifname=vnet1, vm-id="7714e6b5-4885-4140-bc59-2f77cc99b3b5"}
  other_config        : {burst="262144", max-rate="8192000", min-rate="4096000"}
  queues              : {0=655bf3a7-e530-4516-9caf-ec9555dfbd4c}
  type                : linux-htb

from which the following topology is generated:

  # for i in qdisc class; do tc -s -d -g $i show dev vnet1; done
  qdisc htb 1: root refcnt 2 r2q 10 default 0x1 direct_packets_stat 0 ver 3.17 direct_qlen 1000
   Sent 2186 bytes 16 pkt (dropped 0, overlimits 0 requeues 0)
   backlog 0b 0p requeues 0

  +---(1:fffe) htb rate 8192Kbit ceil 8192Kbit linklayer ethernet burst 1499b/1mpu 60b cburst 1499b/1mpu 60b level 7
       |       Sent 2186 bytes 16 pkt (dropped 0, overlimits 0 requeues 0)
       |       backlog 0b 0p requeues 0
       |
       +---(1:1) htb prio 0 quantum 51200 rate 4096Kbit ceil 8192Kbit linklayer ethernet burst 32Kb/1mpu 60b cburst 32Kb/1mpu 60b level 0
                 Sent 2186 bytes 16 pkt (dropped 0, overlimits 0 requeues 0)
                 backlog 0b 0p requeues 0

Long story short, the default class (1:) for an OVS interface has
average and peak set exactly as requested. But since it's nested
under another class (1:fffe), it can borrow unused bandwidth. And
the parent is set to have rate = ceil = peak from our XML. From
[1]: htb_tc_install() calls htb_parse_qdisc_details__() which
sets: 'hc->min_rate = hc->max_rate;' and then calls
htb_setup_class_(..., tc_make_handle(1, 0xfffe), tc_make_handle(1, 0), &hc);
to set up the top parent class.

In other words - the interface is set up to so that it can always
consume 'peak' bandwidth and there is no way for us to set it up
differently. It's too late to deny setting 'peak' different to
'average' at XML validation phase so do the next best thing -
throw a warning, just like we do in case <bandwidth/> is set for
an unsupported <interface/> type.

1: https://github.com/openvswitch/ovs/blob/main/lib/netdev-linux.c#L5039
Resolves: https://issues.redhat.com/browse/RHEL-53963
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
8 months agoTranslated using Weblate (Chinese (Simplified) (zh_CN))
zk dc [Thu, 7 Nov 2024 12:53:23 +0000 (12:53 +0000)] 
Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 95.5% (10058 of 10526 strings)

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

Signed-off-by: zk dc <zkdc2345@qq.com>
8 months agoqemu_domain: Automagically add IOMMU if needed
Michal Privoznik [Wed, 6 Nov 2024 11:57:21 +0000 (12:57 +0100)] 
qemu_domain: Automagically add IOMMU if needed

If a Q35 domain has huge number of vCPUS (over 255, currently), then
it needs IOMMU with Extended Interrupt Mode enabled (see check in
qemuValidateDomainVCpuTopology()).

Well, we already add some devices and to other tricks when
parsing new domain XML. Might as well add IOMMU device if above
condition is met.

Resolves: https://issues.redhat.com/browse/RHEL-65844
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemu: Turn EIM IOMMU on automagically
Michal Privoznik [Wed, 6 Nov 2024 11:34:42 +0000 (12:34 +0100)] 
qemu: Turn EIM IOMMU on automagically

If a Q35 domain has huge number of vCPUS (over 255, currently), then
it needs IOMMU with Extended Interrupt Mode enabled (see check in
qemuValidateDomainVCpuTopology()).

Well, we already add some devices and to other tricks when
parsing new domain XML. Might as well turn the EIM on for IOMMU
device.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agolibvirt_private.syms: Export virDomainIOMMUDefNew()
Michal Privoznik [Wed, 6 Nov 2024 11:59:02 +0000 (12:59 +0100)] 
libvirt_private.syms: Export virDomainIOMMUDefNew()

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Wed, 6 Nov 2024 21:15:52 +0000 (21:15 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 94.5% (9957 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
9 months agoch: check return value of virJSONValueArrayAppend
Ján Tomko [Wed, 6 Nov 2024 13:03:27 +0000 (14:03 +0100)] 
ch: check return value of virJSONValueArrayAppend

It only errors out when presented with a non-array, but we do check
it everywhere else.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
9 months agoutil: json: check return value of virJSONValueFromJsonC
Ján Tomko [Wed, 6 Nov 2024 12:19:29 +0000 (13:19 +0100)] 
util: json: check return value of virJSONValueFromJsonC

In virJSONValueFromJsonC, the return value of virJSONValueFromJsonC
was not checked in one case.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
9 months agoqemu: chardev: avoid impossible overflow
Ján Tomko [Wed, 6 Nov 2024 12:15:26 +0000 (13:15 +0100)] 
qemu: chardev: avoid impossible overflow

In the rare case where int and long long are not the same size,
the multiplication of an int variable and an int constant might
overflow. Cast the constant to long long to avoid this.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: baa4edfb79d5ee861a08b5ec11416c5c156d8cd2
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
9 months agoTranslated using Weblate (French)
Léane GRASSER [Wed, 6 Nov 2024 10:21:23 +0000 (10:21 +0000)] 
Translated using Weblate (French)

Currently translated at 95.9% (10098 of 10526 strings)

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

Signed-off-by: Léane GRASSER <leane.grasser@proton.me>
9 months agodocs: fix since tag for TPM with custom path
Ján Tomko [Tue, 5 Nov 2024 15:39:18 +0000 (16:39 +0100)] 
docs: fix since tag for TPM with custom path

The feature was pushed after the 10.9.0 release.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 579fd44612d044981a5b81a70b03d4a8c0d8930e
9 months agodocs: formatdomain: fix XML snippets
Ján Tomko [Tue, 5 Nov 2024 14:34:33 +0000 (15:34 +0100)] 
docs: formatdomain: fix XML snippets

Fix indentation, missing slashes for unpaired tags and missing angle
brackets.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
9 months agoqemu: explicit swtpm state locking
Marc-André Lureau [Tue, 22 Oct 2024 14:15:21 +0000 (18:15 +0400)] 
qemu: explicit swtpm state locking

With upcoming v0.10 swtpm (commit
https://github.com/stefanberger/swtpm/commit/aa483aeb6df87ed56ccf3d5778d6fd8019089bda),
file locking with "lock" option is now supported and reflected in
"tpmstate-opt-lock" capability.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>