]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
4 months agoqemu: process: Remove un-updated 'qemuProcessStartWarnShmem'
Peter Krempa [Tue, 11 Mar 2025 08:04:18 +0000 (09:04 +0100)] 
qemu: process: Remove un-updated 'qemuProcessStartWarnShmem'

The checks in qemuProcessStartWarnShmem are no longer current. Since
previous patch made it fatal for vhost-user interfaces to be configured
without shared memory this warning code can be deleted.

Resolves: https://issues.redhat.com/browse/RHEL-80533
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemuValidateDomainDeviceDefNetwork: Require shared memory for all vhost-user interfaces
Peter Krempa [Tue, 11 Mar 2025 08:01:12 +0000 (09:01 +0100)] 
qemuValidateDomainDeviceDefNetwork: Require shared memory for all vhost-user interfaces

Currently we produce only a warning into the log if a non-passt
vhost-user interface is configured with shared memory.

Since we do make it fatal with all other vhost-user types, fix the check
to trigger also for normal-vhost-user interfaces.

Since passt-based vhost-user interfaces are checked separately the check
will no longer be required.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemuxmlconftest: Include shared memory 'net-vhostuser' test cases
Peter Krempa [Tue, 11 Mar 2025 08:01:03 +0000 (09:01 +0100)] 
qemuxmlconftest: Include shared memory 'net-vhostuser' test cases

The vhost-user protocol requires shared memory support to work properly.

Our test XMLs didn't have it configured as for interface the check if
shared memory is present only produces a warning instead of a proper
error.

Upcoming patches will be moving the check to become fatal so the test
cases need to be fixed first.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemuNodeGetSEVInfo: Use virTypedParamList to construct return value
Peter Krempa [Wed, 26 Feb 2025 16:07:59 +0000 (17:07 +0100)] 
qemuNodeGetSEVInfo: Use virTypedParamList to construct return value

Simplify the code by using the modern helpers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemuDomainGetLaunchSecurityInfo: Use virTypedParamList to construct return value
Peter Krempa [Wed, 26 Feb 2025 16:07:59 +0000 (17:07 +0100)] 
qemuDomainGetLaunchSecurityInfo: Use virTypedParamList to construct return value

Simplify the code by using the modern helpers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemuDomainGetLaunchSecurityInfo: Don't forget unlock VM object on (impossible) error
Peter Krempa [Wed, 26 Feb 2025 15:55:54 +0000 (16:55 +0100)] 
qemuDomainGetLaunchSecurityInfo: Don't forget unlock VM object on (impossible) error

If 'vm->def->sec->sectype' would be invalid; which is currently not
possible; we'd not unlock the domain object. Fix the logic even when the
bug currently can't happen.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agosrc: expand docs for guest stats constant version handling
Daniel P. Berrangé [Wed, 5 Mar 2025 15:24:31 +0000 (15:24 +0000)] 
src: expand docs for guest stats constant version handling

Explain that the 11.2.0 release dates are mostly reflecting when the
constant was first added, not when the key was introduced.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: expand docs for guest stats array handling
Daniel P. Berrangé [Wed, 5 Mar 2025 15:24:31 +0000 (15:24 +0000)] 
src: expand docs for guest stats array handling

Give an overview of how arrays are handled and represented in
the typed parameters returned by the guest stats API.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: document that no constants are provided for custom VM stats
Daniel P. Berrangé [Fri, 28 Feb 2025 13:42:48 +0000 (13:42 +0000)] 
src: document that no constants are provided for custom VM stats

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for domain stats 'dirtyrate.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'dirtyrate.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for domain stats 'memory.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'memory.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for domain stats 'iothread.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'iothread.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for domain stats 'perf.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'perf.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for domain stats 'block.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'block.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for domain stats 'net.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'net.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for domain stats 'vcpu.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'vcpu.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for domain stats 'balloon.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'balloon.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for domain stats 'cpu.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'cpu.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for domain stats 'state.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'state.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: expand docs for guest info constant version handling
Daniel P. Berrangé [Wed, 5 Mar 2025 15:24:31 +0000 (15:24 +0000)] 
src: expand docs for guest info constant version handling

Explain that the 11.2.0 release dates are mostly reflecting when the
constant was first added, not when the key was introduced.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: expand docs for guest info array handling
Daniel P. Berrangé [Wed, 5 Mar 2025 15:24:31 +0000 (15:24 +0000)] 
src: expand docs for guest info array handling

Give an overview of how arrays are handled and represented in
the typed parameters returned by the guest info API.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for guest info 'load.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for guest info 'load.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the guest info data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the guest info
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for guest info 'if.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for guest info 'if.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the guest info data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the guest info
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for guest info 'disk.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for guest info 'disk.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the guest info data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the guest info
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for guest info 'fs.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for guest info 'fs.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the guest info data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the guest info
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constant for the guest info 'hostname' parameter
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constant for the guest info 'hostname' parameter

Contrary to most APIs returning typed parameters, there are no constants
defined for the guest info data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the guest info
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for guest info 'timezone.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for guest info 'timezone.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the guest info data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the guest info
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for guest info 'os.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for guest info 'os.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the guest info data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the guest info
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: add constants for guest info 'user.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for guest info 'user.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the guest info data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the guest info
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agoqemu: snapshot: error out early when reverting snapshot for VM with non-file disk
Pavel Hrdina [Wed, 26 Feb 2025 10:04:52 +0000 (11:04 +0100)] 
qemu: snapshot: error out early when reverting snapshot for VM with non-file disk

Before this patch the code would start the revert process by destroying
the VM and preparing to revert where it would fail with following error:

    error: unsupported configuration: source for disk 'sdb' is not a regular file; refusing to generate external snapshot name

and leaving user with offline VM even if it was running.

Make the check before we start the revert process to not destroy VMs.

Resolves: https://issues.redhat.com/browse/RHEL-30971
Resolves: https://issues.redhat.com/browse/RHEL-79928
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 months agosecurity: Don't stop restoring labels too early
Michal Privoznik [Tue, 11 Mar 2025 12:49:21 +0000 (13:49 +0100)] 
security: Don't stop restoring labels too early

The point of virSecurityManagerRestoreAllLabel() function is to
restore ALL labels and be tolerant to possible errors, i.e.
continue restoring seclabels and NOT return early.

Well, in two implementations of this internal API this type of
problem was found:

1) virSecurityDACRestoreAllLabel() returned early if
   virSecurityDACRestoreGraphicsLabel() failed, or when
   def->sec->sectype equals to an impossible value.

2) virSecuritySELinuxRestoreAllLabel() returned early if
   virSecuritySELinuxRestoreMemoryLabel() failed.

Fix all three places.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 months agodocs: Correct dbus graphics' accepted p2p values
Martin Kletzander [Tue, 11 Mar 2025 12:13:55 +0000 (13:13 +0100)] 
docs: Correct dbus graphics' accepted p2p values

The attribute is used (and formatted) as virTristateBool() and even in
schema defined as virYesNo, so the values are supposed to be `yes` and
`no`.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agotests: update capabilities for QEMU 9.2.0 on s390x
Shalini Chellathurai Saroja [Tue, 11 Mar 2025 12:49:10 +0000 (13:49 +0100)] 
tests: update capabilities for QEMU 9.2.0 on s390x

Update the replies and xml files for QEMU 9.2.0 on s390x based on
the released QEMU tag v9.2.0 with commit Id
ae35f033b874c627d81d51070187fbf55f0bf1a7.

Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 months agoesx: Refactor esxVI_LookupHostScsiTopologyLunListByTargetName
Jiri Denemark [Tue, 11 Mar 2025 09:35:58 +0000 (10:35 +0100)] 
esx: Refactor esxVI_LookupHostScsiTopologyLunListByTargetName

With a specific combination of compiler options gcc reported the
following bogus warning (I added a context to it to make the issue
visible):

../src/esx/esx_vi.c: In function ‘esxVI_LookupHostScsiTopologyLunListByTargetName’:
../src/esx/esx_vi.c:4674:32: error: potential null pointer dereference [-Werror=null-dereference]
 4671 |     if (!found || !hostScsiTopologyTarget)
 4672 |         goto cleanup;
 4673 |
 4674 |     if (!hostScsiTopologyTarget->lun) {
      |          ~~~~~~~~~~~~~~~~~~~~~~^~~~~

Most likely this is caused by found and hostScsiTopologyTarget doing
essentially the same thing as found is true if and only if
hostScsiTopologyTarget is non-NULL. The found variable is completely
redundant. Removing it would be enough, but I decided to make the code a
little bit easier to read by not using the iterator variable directly.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 months agoch: Enable SEV SNP support
Praveen K Paladugu [Tue, 11 Feb 2025 19:18:20 +0000 (13:18 -0600)] 
ch: Enable SEV SNP support

Enable SEV-SNP support for ch guests.

Co-Authored-by: Smit Gardhariya <sgardhariya@microsoft.com>
Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoutil: Introduce virStringFormatHex
Praveen K Paladugu [Tue, 11 Feb 2025 19:18:19 +0000 (13:18 -0600)] 
util: Introduce virStringFormatHex

virStringFormatHex converts an input byte array into hex string and
returns it.

Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agosecurity: Set seclabels on UEFI shim
Michal Privoznik [Wed, 5 Mar 2025 14:47:39 +0000 (15:47 +0100)] 
security: Set seclabels on UEFI shim

Again, trivial. Just copy what is done for kernel and initrd.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 months agoqemu_command: Generate cmd line for UEFI shim
Michal Privoznik [Wed, 5 Mar 2025 14:29:04 +0000 (15:29 +0100)] 
qemu_command: Generate cmd line for UEFI shim

Trivial.

Resolves: https://issues.redhat.com/browse/RHEL-68043
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 months agoqemu_validate: Check whether UEFI shim is supported
Michal Privoznik [Wed, 5 Mar 2025 14:04:21 +0000 (15:04 +0100)] 
qemu_validate: Check whether UEFI shim is supported

If UEFI shim is specified in domain XML but QEMU is too old, then
report an error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 months agoqemu_capabilities: Introduce QEMU_CAPS_MACHINE_SHIM
Michal Privoznik [Wed, 5 Mar 2025 12:40:04 +0000 (13:40 +0100)] 
qemu_capabilities: Introduce QEMU_CAPS_MACHINE_SHIM

In its commit v9.2.0-323-ga5bd044b15 QEMU introduced another
command line option: -shim. It's used to load kernel. Track
presence of it via QEMU_CAPS_MACHINE_SHIM.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 months agoconf: Introduce os/shim element
Michal Privoznik [Tue, 4 Mar 2025 14:46:13 +0000 (15:46 +0100)] 
conf: Introduce os/shim element

For secure boot environments where <loader/> is signed, it may be
unfeasible to keep the binary up to date (esp. when revoking
certificates contained within). To address that, QEMU introduced
'-shim' cmd line option which side loads another UEFI binary
which can then contain new certification authorities or list of
revocations. Expose it as <shim/> element that's nested under
<os/>, just like kernel and initrd are.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 months agoqemucapabilitiestest: Add data for the qemu-10.0 dev cycle on x86_64 for the '+amdsev...
Peter Krempa [Mon, 24 Feb 2025 15:52:20 +0000 (16:52 +0100)] 
qemucapabilitiestest: Add data for the qemu-10.0 dev cycle on x86_64 for the '+amdsev' variant

Add data based on 'v9.2.0-2369-g98c7362b1e'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemucapabilitiestest: Update 'caps_10.0.0_x86_64' to 'v9.2.0-2369-g98c7362b1e'
Peter Krempa [Mon, 24 Feb 2025 15:52:20 +0000 (16:52 +0100)] 
qemucapabilitiestest: Update 'caps_10.0.0_x86_64' to 'v9.2.0-2369-g98c7362b1e'

Notable changes:
 - 'uefi-vars-x64', 'uefi-vars-sysbus' qom type added
 - 'YongFeng-v1-x86_64-cpu' added
 - 'accel' qom type removed
 - 'addr' field of devices changed type to 'str'
 - 'vfio-pci' gained experimental feature 'x-migration-multifd-transfer'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemu: block: Drop 'sheepdog' protocol support
Peter Krempa [Mon, 10 Mar 2025 09:17:16 +0000 (10:17 +0100)] 
qemu: block: Drop 'sheepdog' protocol support

As now no supported qemu version supports the 'sheepdog' protocol drop
the code for configuring the blockdev layer.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemu: capabilities: Bump minimum qemu to qemu-6.2
Peter Krempa [Fri, 7 Mar 2025 15:56:05 +0000 (16:56 +0100)] 
qemu: capabilities: Bump minimum qemu to qemu-6.2

Following minimum versions are needed based on our support policy:

             CentOS Stream 9: 9.1
                   Debian 12: 7.2
                   Fedora 40: 8.2
          openSUSE Leap 15.6: 8.2
                Ubuntu 22.04: 6.2
               FreeBSD ports: 9.2
              macOS homebrew: 9.2
              macOS macports: 9.2

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemucapabilitiesdata: Drop un-updated 'qemu_8.0.0_riscv64' data
Peter Krempa [Fri, 7 Mar 2025 16:00:12 +0000 (17:00 +0100)] 
qemucapabilitiesdata: Drop un-updated 'qemu_8.0.0_riscv64' data

The riscv64 qemu-8.0 data were not updated to the release version. Drop
them instead of trying to do archaeology.

They are not used in any 'qemuxmlconftest' case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemucapabilitiesdata: Drop un-updated 'caps_7.0.0_aarch64' data
Peter Krempa [Mon, 10 Mar 2025 09:28:45 +0000 (10:28 +0100)] 
qemucapabilitiesdata: Drop un-updated 'caps_7.0.0_aarch64' data

The aarch-64 qemu-7.0 data were not updated to the release version. Drop
them instead of trying to do archaeology.

They are not used in any 'qemuxmlconftest' case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemucapabilitiesdata: Drop un-updated 'qemu_6.2.0_aarch64' data
Peter Krempa [Fri, 7 Mar 2025 16:00:12 +0000 (17:00 +0100)] 
qemucapabilitiesdata: Drop un-updated 'qemu_6.2.0_aarch64' data

We'll be bumping to qemu-6.2 as minimum and the aarch64 qemu-6.2 data
were not updated to the release version. Drop them instead of trying to
do archaeology.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemucapabilitiestest: Drop unused fake data 'caps_7.0.0_aarch64+hvf'
Peter Krempa [Mon, 10 Mar 2025 09:24:59 +0000 (10:24 +0100)] 
qemucapabilitiestest: Drop unused fake data 'caps_7.0.0_aarch64+hvf'

The 'caps_7.0.0_aarch64+hvf' caps dump is fake; obtained from copying
and doctoring the 'caps_7.0.0_aarch64' file (see commit 12aedb414578d3 )

Remove it now that it was superseded by a dump obtained from a proper
hvf-enabled host.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemucapabilitiestest: Add 'qemu_9.2.0.aarch64+hvf' test data
Peter Krempa [Mon, 10 Mar 2025 09:02:40 +0000 (10:02 +0100)] 
qemucapabilitiestest: Add 'qemu_9.2.0.aarch64+hvf' test data

The data is collected from an MacOS host with latest released qemu from
homebrew.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemucapabilitiestest: Drop qemu-6.1 data
Peter Krempa [Fri, 7 Mar 2025 15:54:18 +0000 (16:54 +0100)] 
qemucapabilitiestest: Drop qemu-6.1 data

Soon we'll bump to qemu-6.2 as minimum.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemucapabilitiestest: Drop qemu-6.0 data
Peter Krempa [Fri, 7 Mar 2025 15:54:18 +0000 (16:54 +0100)] 
qemucapabilitiestest: Drop qemu-6.0 data

Soon we'll bump to qemu-6.2 as minimum.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemucapabilitiestest: Drop qemu-5.2 data
Peter Krempa [Fri, 7 Mar 2025 15:54:18 +0000 (16:54 +0100)] 
qemucapabilitiestest: Drop qemu-5.2 data

Soon we'll bump to qemu-6.2 as minimum.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemuxmlconftest: Drop tests pinned to qemu-6.1
Peter Krempa [Fri, 7 Mar 2025 15:44:39 +0000 (16:44 +0100)] 
qemuxmlconftest: Drop tests pinned to qemu-6.1

Upcoming patches will bump minimum qemu version to 6.2 so we need to
purge old tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemuxmlconftest: Drop tests pinned to qemu-6.0
Peter Krempa [Fri, 7 Mar 2025 15:44:39 +0000 (16:44 +0100)] 
qemuxmlconftest: Drop tests pinned to qemu-6.0

Upcoming patches will bump minimum qemu version to 6.2 so we need to
purge old tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoqemuxmlconftest: Drop tests pinned to qemu-5.2
Peter Krempa [Fri, 7 Mar 2025 15:44:39 +0000 (16:44 +0100)] 
qemuxmlconftest: Drop tests pinned to qemu-5.2

Upcoming patches will bump minimum qemu version to 6.2 so we need to
purge old tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoconf: Drop support for 'sheepdog' disks
Peter Krempa [Fri, 7 Mar 2025 16:37:26 +0000 (17:37 +0100)] 
conf: Drop support for 'sheepdog' disks

In upcoming patches we'll update minimum supported qemu version to
qemu-6.2 which no longer supports 'sheepdog'. This was the only
hypervisor driver that supported it.

Reject any config containing sheepdog disks when validating the XML,
remove the positive test cases in qemu and replace them by a negative
test case. This will still excercise the XML schema, but will prepare
for removal of the internal code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 months agoci: refresh with 'lcitool manifest'
Pavel Hrdina [Thu, 6 Mar 2025 20:49:36 +0000 (21:49 +0100)] 
ci: refresh with 'lcitool manifest'

- Remove EOL Debian 11

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 months agoutil: netdevvlan: Change return type of virNetDevVlanCopy to void
Alexander Kuznetsov [Fri, 7 Mar 2025 09:08:03 +0000 (12:08 +0300)] 
util: netdevvlan: Change return type of virNetDevVlanCopy to void

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

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

Reported-by: Alexander Rudyuk <a.rudyuk@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 months agoutil: virxml: unexport virXMLFormatElementInternal
Pavel Hrdina [Thu, 6 Mar 2025 17:24:38 +0000 (18:24 +0100)] 
util: virxml: unexport virXMLFormatElementInternal

It is no longer used anywhere else.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_conf: refactor virDomainLoaderDefFormatNvram
Pavel Hrdina [Thu, 6 Mar 2025 17:21:50 +0000 (18:21 +0100)] 
domain_conf: refactor virDomainLoaderDefFormatNvram

Use the new virXMLFormatDirect in order to remove usage of
virXMLFormatInternal.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agoconf: use virXMLFormatElementDirect
Pavel Hrdina [Thu, 6 Mar 2025 14:32:47 +0000 (15:32 +0100)] 
conf: use virXMLFormatElementDirect

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agoutil: virxml: introduce virXMLFormatElementDirect
Pavel Hrdina [Thu, 6 Mar 2025 14:31:46 +0000 (15:31 +0100)] 
util: virxml: introduce virXMLFormatElementDirect

This can be used to format XML where the element has direct value
instead of any subelement. For example:

    <maxMemory slots='16' unit='KiB'>1524288</maxMemory>

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agoTranslated using Weblate (Spanish)
Nicolás Gal [Mon, 3 Mar 2025 21:00:37 +0000 (21:00 +0000)] 
Translated using Weblate (Spanish)

Currently translated at 52.6% (5704 of 10838 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>
4 months agodomain_conf: graphics: properly escape user provided strings when formatting XML
Pavel Hrdina [Thu, 6 Mar 2025 11:55:25 +0000 (12:55 +0100)] 
domain_conf: graphics: properly escape user provided strings when formatting XML

This was reported on virt-manager issue tracker as it was possible to
provide `listen` attribute with properly escaped characters but libvirt
would format XML without escaping it.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_conf: graphics: fix error messages when formatting XML
Pavel Hrdina [Thu, 6 Mar 2025 11:51:49 +0000 (12:51 +0100)] 
domain_conf: graphics: fix error messages when formatting XML

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_conf: graphics: move remaining VNC formatting
Pavel Hrdina [Thu, 6 Mar 2025 11:50:06 +0000 (12:50 +0100)] 
domain_conf: graphics: move remaining VNC formatting

Now we are able to move the rest into virDomainGraphicsDefFormatVNC
without breaking order of elements in the resulting XML.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_conf: graphics: move remaining spice formatting
Pavel Hrdina [Thu, 6 Mar 2025 11:48:47 +0000 (12:48 +0100)] 
domain_conf: graphics: move remaining spice formatting

Now we are able to move the rest into virDomainGraphicsDefFormatSpice
without breaking order of elements in the resulting XML.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_conf: graphics: move listens formatting to relevant graphics types
Pavel Hrdina [Thu, 6 Mar 2025 11:44:27 +0000 (12:44 +0100)] 
domain_conf: graphics: move listens formatting to relevant graphics types

Only VNC, RDP and Spice graphics types are using listen elements so call
the function only where it is needed.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_conf: graphics: extract listen formatting to separate function
Pavel Hrdina [Thu, 6 Mar 2025 11:14:14 +0000 (12:14 +0100)] 
domain_conf: graphics: extract listen formatting to separate function

This will be used in specific graphics types that are using listen
elements.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_conf: graphics: extract DBus formatting to separate function
Pavel Hrdina [Thu, 6 Mar 2025 11:11:33 +0000 (12:11 +0100)] 
domain_conf: graphics: extract DBus formatting to separate function

virDomainGraphicsDefFormat function was way too long so split it into
separate functions for each graphics type.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_conf: graphics: extract EGL-Headless formatting to separate function
Pavel Hrdina [Thu, 6 Mar 2025 11:09:22 +0000 (12:09 +0100)] 
domain_conf: graphics: extract EGL-Headless formatting to separate function

virDomainGraphicsDefFormat function was way too long so split it into
separate functions for each graphics type.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_conf: graphics: extract Spice formatting to separate function
Pavel Hrdina [Thu, 6 Mar 2025 11:04:07 +0000 (12:04 +0100)] 
domain_conf: graphics: extract Spice formatting to separate function

virDomainGraphicsDefFormat function was way too long so split it into
separate functions for each graphics type.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_conf: graphics: extract Desktop formatting to separate function
Pavel Hrdina [Thu, 6 Mar 2025 11:00:13 +0000 (12:00 +0100)] 
domain_conf: graphics: extract Desktop formatting to separate function

virDomainGraphicsDefFormat function was way too long so split it into
separate functions for each graphics type.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_conf: graphics: extract RDP formatting to separate function
Pavel Hrdina [Thu, 6 Mar 2025 10:51:04 +0000 (11:51 +0100)] 
domain_conf: graphics: extract RDP formatting to separate function

virDomainGraphicsDefFormat function was way too long so split it into
separate functions for each graphics type.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_conf: graphics: extract SDL formatting to separate function
Pavel Hrdina [Thu, 6 Mar 2025 10:48:39 +0000 (11:48 +0100)] 
domain_conf: graphics: extract SDL formatting to separate function

virDomainGraphicsDefFormat function was way too long so split it into
separate functions for each graphics type.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_conf: graphics: extract VNC formatting to separate function
Pavel Hrdina [Thu, 6 Mar 2025 10:46:00 +0000 (11:46 +0100)] 
domain_conf: graphics: extract VNC formatting to separate function

virDomainGraphicsDefFormat function was way too long so split it into
separate functions for each graphics type.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_conf: modernize graphics formatting
Pavel Hrdina [Thu, 6 Mar 2025 10:03:06 +0000 (11:03 +0100)] 
domain_conf: modernize graphics formatting

Use separate buffers for attributes and children elements to make the
code cleaner and to use the virXMLFormatElement() function.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_conf: graphics: use a function to format audio element
Pavel Hrdina [Thu, 6 Mar 2025 09:42:11 +0000 (10:42 +0100)] 
domain_conf: graphics: use a function to format audio element

Removes code duplication.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_conf: graphics: use a function to format gl element
Pavel Hrdina [Thu, 6 Mar 2025 09:31:35 +0000 (10:31 +0100)] 
domain_conf: graphics: use a function to format gl element

Removes code duplication.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 months agoqemu: support MSDM ACPI table type
Daniel P. Berrangé [Mon, 17 Feb 2025 16:58:27 +0000 (16:58 +0000)] 
qemu: support MSDM ACPI table type

The MSDM ACPI table is a replacement for the SLIC table type, now
sometimes used by Microsoft for Windows Licensing checks:

  https://learn.microsoft.com/en-us/previous-versions/windows/hardware/design/dn653305(v=vs.85)

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/748
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agoconf: support MSDM ACPI table type
Daniel P. Berrangé [Mon, 17 Feb 2025 16:58:27 +0000 (16:58 +0000)] 
conf: support MSDM ACPI table type

The MSDM ACPI table is an alternative for the SLIC table type,
sometimes used by Microsoft for Windows Licensing checks:

  https://learn.microsoft.com/en-us/previous-versions/windows/hardware/design/dn653305(v=vs.85)

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agolibxl: support 'rawset' ACPI table type
Daniel P. Berrangé [Wed, 26 Feb 2025 19:10:42 +0000 (19:10 +0000)] 
libxl: support 'rawset' ACPI table type

This fixes representation of the 'acpi_firmware' config in the Xen
driver, which repesents a concatenation of tables of any type.

Use of 'type=slic' is accepted on input for backwards compatibility.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agoqemu: support 'raw' ACPI table type
Daniel P. Berrangé [Wed, 26 Feb 2025 19:10:42 +0000 (19:10 +0000)] 
qemu: support 'raw' ACPI table type

This allows passing a single ACPI table of any type through to QEMU with
the signture autodetected from the header.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: introduce 'raw' and 'rawset' ACPI table types
Daniel P. Berrangé [Wed, 26 Feb 2025 18:39:18 +0000 (18:39 +0000)] 
src: introduce 'raw' and 'rawset' ACPI table types

The QEMU driver has only accepted type=slic even though QEMU is able to
accept individual tables of any type, without needing to specify a
signature. Introduce type=raw to address this usage scenario. Contrary
to other types, this one may appear multiple times.

The Xen driver has mistakenly accepted type=slic and use it to set the
Xen acpi_firmware setting, which performs a simple passthrough of
multiple concatenated data table. Introduce type=rawset to address
this usage scenario.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agosrc: validate permitted ACPI table types in libxl/qemu drivers
Daniel P. Berrangé [Mon, 17 Feb 2025 16:39:29 +0000 (16:39 +0000)] 
src: validate permitted ACPI table types in libxl/qemu drivers

This forces us to update the drivers when defining new table types
to avoid incorrectly accepting them by default.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agoconf: introduce support for multiple ACPI tables
Daniel P. Berrangé [Mon, 17 Feb 2025 16:30:07 +0000 (16:30 +0000)] 
conf: introduce support for multiple ACPI tables

Currently we parse

   <os>
     <acpi>
       <table type="slic">...path...</table>
     </acpi>
   </os>

into a flat 'char *slic_table' field which is rather an anti-pattern
as it has special cased a single attribute type.

This rewrites the internal design to permit multiple table types to
be parsed, should we add more in future. Each type is currently
permitted to only appear once.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 months agonwfilter: Fix deadlock between nwfilter-list and VM startup/migration
Dion Bosschieter [Tue, 18 Feb 2025 14:56:32 +0000 (15:56 +0100)] 
nwfilter: Fix deadlock between nwfilter-list and VM startup/migration

The `nwfilterBindingCreateXML` and `nwfilterConnectListAllNWFilters`
APIs can acquire locks on multiple instances of virNWFilterObj. There
is no guarantee they will acquire these locks in the same order as
each other. Thus there is a potential for deadlock if they run
concurrently acquiring locks on the same filter objects.

This flaw has always existed, but historically was rare, because
virNWFilterObjList previously used an array. This meant iteration
over filters had a fixed order, matching order of loading filters
into libvirt.  The set of filter references would have to be just
right to expose the lock ordering deadlock.

In 8.2.0, commit c4fb52dc72b312431a3a28e3a163b38441a95665 switched
to use a hash table, introducing non-determinism to the iteration
order, as hash buckets vary based on the hash seed. As such almost
any filter with references is exposed to the deadlock risk now.

It is not easy  to guarantee lock ordering on the virNWFilterObj
instances, so acquiring `driverMutex` first, will serve to serialize
all lock acquisition on virNWFilterObj instances, avoiding the
deadlock scenario.

The major cost is that concurrency of the driver is significantly
reduced, with few other APIs able to run in parallel with updating
firewall rules.

A long term solution to this problem needs significant changes

 * The mutex on virNWFilterObj would need to change to a R/W
   lock.
 * The filter instantiation/teardown process would need to split
   into two phases. The first phase would resolve all the required
   virNWFilterObj instances & acquire read locks, while holding
   the 'driverMutex'. The second phase of running iptables/ebtables
   commands would then run without driverMutex held.
 * The filter define/undefine APIs would need to acquire write
   locks, other APIs only read locks.

This would allow concurrency of filter instantiation/teardown
with everything except for filter defnie/undefine, which was
the original desire.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
[DPB: rewrite commit message & add inline comment]
Signed-off-by: Dion Bosschieter <dionbosschieter@gmail.com>
4 months agoqemu: snapshot: Remove dead code in qemuSnapshotDeleteBlockJobFinishing()
Alexander Kuznetsov [Wed, 22 Jan 2025 14:14:31 +0000 (17:14 +0300)] 
qemu: snapshot: Remove dead code in qemuSnapshotDeleteBlockJobFinishing()

qemuSnapshotDeleteBlockJobFinishing() returns only 0 and 1. Convert it
to bool and remove the dead code handling -1 return in the caller.

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

Reported-by: Reported-by: Andrey Slepykh <a.slepykh@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 months agodocs: Fix formatting in formatdomain.rst
Yalan Zhang [Wed, 5 Mar 2025 08:07:38 +0000 (16:07 +0800)] 
docs: Fix formatting in formatdomain.rst

The combination of italics and the since tag does not work together.

Remove it from the paragraph about using passt with vhostuser,
as well as the parentheses around it.

Signed-off-by: Yalan Zhang <yalzhang@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 months agodomain_caps: Don't leak 'cpu0_id' in 'virSEVCapabilitiesFree'
Peter Krempa [Thu, 6 Mar 2025 13:06:46 +0000 (14:06 +0100)] 
domain_caps: Don't leak 'cpu0_id' in 'virSEVCapabilitiesFree'

Freeing the 'virSEVCapability' object leaked the 'cpu0_id' field since
its introduction.

Fixes: 0236e6154c46603bc443eda2f05c8ce511c55b08
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
4 months agoqemuxmlconftest: Add '+amdsev' versions of the rest of 'launch-security-sev*' cases
Peter Krempa [Tue, 4 Mar 2025 11:46:33 +0000 (12:46 +0100)] 
qemuxmlconftest: Add '+amdsev' versions of the rest of 'launch-security-sev*' cases

While the 'launch-security-sev-direct' and 'launch-security-sev-snp'
cases use "latest" caps, they use the non-sev variant and add-in the
relevant capabilities.

To do the test properly we can add '+amdsev' variant which uses caps
fetched from a real host that does support all the capabilities.

The output files are identical, although they are not added as symlinks
to prevent headaches if they do diverge at some point.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 months agoqemuxmlconftest: Add 'latest' version of 'launch-security-sev*' originally using...
Peter Krempa [Tue, 4 Mar 2025 11:46:33 +0000 (12:46 +0100)] 
qemuxmlconftest: Add 'latest' version of 'launch-security-sev*' originally using 6.0.0

The 'launch-security-sev' and
'launch-security-sev-missing-platform-info' tests run agains the
qemu-6.0.0 caps which were manually doctored to support SEV.

Since we now have the '+amdsev' variant dumped from a more modern qemu
add another invocation of the tests.

The only relevant difference in the output data is 'cbitpos' being '51'
on the new platform, for the test case which explicitly doesn't
configure it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 months agoqemuxmlconftest: Propery discriminate output files for caps variants
Peter Krempa [Tue, 4 Mar 2025 09:56:23 +0000 (10:56 +0100)] 
qemuxmlconftest: Propery discriminate output files for caps variants

While the 'qemuxmlconftest' was able to load capability variants the
output file name didn't include the variant thus it was not possible to
test the same input file both on the default variant and on an explicit
variant.

Include the variant in the output file name and adjust two output file
names.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 months agoqemucapabilitiestest: Add test data for 'qemu-9.2' on a SEV-enabled AMD host
Peter Krempa [Mon, 3 Mar 2025 16:49:30 +0000 (17:49 +0100)] 
qemucapabilitiestest: Add test data for 'qemu-9.2' on a SEV-enabled AMD host

Introduce the test data as 'qemu_9.2.0.x86_64+amdsev' to test
SEV-related capability code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 months agoqemucapabilitiesdata: Document '+amdsev' variant
Peter Krempa [Tue, 4 Mar 2025 09:12:11 +0000 (10:12 +0100)] 
qemucapabilitiesdata: Document '+amdsev' variant

Upcoming patch will introduce test data from an SEV-enabled host.
Document the new variant.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 months agodomaincapstest: Allow tests of all capability variants
Peter Krempa [Tue, 4 Mar 2025 08:41:02 +0000 (09:41 +0100)] 
domaincapstest: Allow tests of all capability variants

Currently only the default variant ("") and "+hvf" are present in our
test data but upcoming patches will add another variant.

Upcoming test variants may not require any special handling so we should
be able to handle them using the default code path now that 'variant' is
properly propagated inside the test code.

Remove the restriction to test only the default ("") and "+hvf" variant
and modify the documentation to state that any other variant is tested
the same way as the default one.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 months agodomaincapstest: Use proper input file based on 'variant' in 'fillQemuCaps'
Peter Krempa [Mon, 3 Mar 2025 17:18:06 +0000 (18:18 +0100)] 
domaincapstest: Use proper input file based on 'variant' in 'fillQemuCaps'

The qemu part of 'domaincapstest' supports testing of the '+hvf' variant
of files, but doesn't properly pick the input file. The input file lacks
the variant part thus the wrong file is used.

Propagate the variant and select the correct input file.

Fixes: 738c5bae888cfa72ed359899cf1a41fed9dbb0f5
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 months agoqemu: capabilities: Parse 'cpu0Id' from capability cache XML
Peter Krempa [Mon, 3 Mar 2025 17:17:46 +0000 (18:17 +0100)] 
qemu: capabilities: Parse 'cpu0Id' from capability cache XML

The 'cpu0Id' field is formatted into the caps cache XML but not parsed
back; thus restart of the daemon will make it vanish.

Fixes: 0236e6154c46603bc443eda2f05c8ce511c55b08
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 months agoconf: change virDomainDefAddImplicitControllers() to return void
Laine Stump [Wed, 12 Feb 2025 03:59:46 +0000 (22:59 -0500)] 
conf: change virDomainDefAddImplicitControllers() to return void

It can't fail.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>