]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
9 days agovirSecuritySELinux(Set|Restore)TPMFileLabel: Automatically free 'cancel_path'
Peter Krempa [Mon, 19 May 2025 13:29:24 +0000 (15:29 +0200)] 
virSecuritySELinux(Set|Restore)TPMFileLabel: Automatically free 'cancel_path'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 days agovirSecuritySELinuxRestoreFileLabel: Refactor cleanup
Peter Krempa [Mon, 19 May 2025 13:27:44 +0000 (15:27 +0200)] 
virSecuritySELinuxRestoreFileLabel: Refactor cleanup

Automatically free 'fcon' and 'newpath' and remove the 'cleanup' label
and 'ret' variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 days agovirSecuritySELinuxMCSFind: Refactor variable clearing
Peter Krempa [Mon, 19 May 2025 13:24:34 +0000 (15:24 +0200)] 
virSecuritySELinuxMCSFind: Refactor variable clearing

Use automatic freeing for 'mcs' and adjust the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 days agovirSecuritySELinuxTransactionRun: Refactor cleanup
Peter Krempa [Mon, 19 May 2025 13:20:33 +0000 (15:20 +0200)] 
virSecuritySELinuxTransactionRun: Refactor cleanup

Automatically free 'paths' and remove temporary variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 days agosecurity/security_driver.c/h: Fix function header formatting
Peter Krempa [Mon, 19 May 2025 11:52:05 +0000 (13:52 +0200)] 
security/security_driver.c/h: Fix function header formatting

Fix the misaligned arguments by switching over to modern style.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 days agonews: document new crypto TLS priority string settings
Daniel P. Berrangé [Tue, 22 Jul 2025 10:35:36 +0000 (11:35 +0100)] 
news: document new crypto TLS priority string settings

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
9 days agonwfilter: Check before removing and reinserting iptable base chains
Dion Bosschieter [Wed, 16 Jul 2025 10:08:58 +0000 (12:08 +0200)] 
nwfilter: Check before removing and reinserting iptable base chains

Upon VM bootstrapping (start,restore,incoming migration)
iptablesCreateBaseChainsFW is called and unconditionally deletes and
reinserts top-level firewall chain jumps (e.g. INPUT, FORWARD rules).
This briefly allows packets to continue, allowing packets through
until the base chain iptables -I commands run.

This commit ensures that the base chains are only created once per layer
(IPV4/IPV6) and checks whether the expected rules already exist using
`iptables -L`. If they do, no delete/insert operations are performed.

By checking for the existence of rules we can prevent more rules from
being created if they already exist. Possibly speeding up nwfilter by
reducing the amount of iptable commands it executes. This however is not
part of this patch.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/784
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dion Bosschieter <dionbosschieter@gmail.com>
9 days agoqemu: add ability to set TLS priority string with QEMU
Daniel P. Berrangé [Wed, 16 Jul 2025 15:40:01 +0000 (16:40 +0100)] 
qemu: add ability to set TLS priority string with QEMU

QEMU will either use the GNUTLS default priority string of "NORMAL",
or on Fedora/RHEL related distros, "@QEMU,SYSTEM", which resolves to
a configuration in /etc/crypto-policies/back-ends/gnutls.config.

The latter gives the sysadmin the ability to change the priority
string used for GNUTLS at deployment time, either system side, or
exclusively for QEMU, avoiding the hardcoded GNUTLS defaults.

There are still some limitations to this:

 * Priorities cannot be set for different areas of QEMU
   functionality (migration, vnc, nbd, etc)

 * Priorities are fixed at the time when QEMU first
   triggers GNUTLS to load its config file, often
   immediately at startup.

We recently uncovered a QEMU bug that causes crashes in live
migration with TLS-1.3, where the easiest workaround is to
change the TLS priorities. We can't change this on the running
QEMU, but fortunately it is possible to change it on the target
QEMU and the TLS handshake will make it take effect on both
src and dst.

The problem is, while fixing the immediate incoming and outgoing
live migration problems, the workaround will apply to everything
else that QEMU does for the rest of the time that process exists.

We want to make it possible to set the TLS priorities only for
the current migrations, such that if the target QEMU has a fixed
GNUTLS, it will not have its TLS priorities hobbled for the next
live migration.

To achieve this we need libvirt to be able to (optionally) set
the TLS priority string with QEMU. While live migration is the
most pressing need, the new qemu.conf parameters are wired up
for every subsystem for greater selectivity in future.

With this we can activate the GNUTLS workaround for running
QEMU processes by editting qemu.conf and restarting virtqemud,
and later undo this the same way.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
9 days agoqemu: sanitize blank lines in config file
Daniel P. Berrangé [Wed, 16 Jul 2025 15:30:52 +0000 (16:30 +0100)] 
qemu: sanitize blank lines in config file

We mostly use 2 blank lines between config file entries to
improve readability. Fix where we don't do that.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
9 days agoqemu: fix order of VNC TLS config entries
Daniel P. Berrangé [Wed, 16 Jul 2025 15:32:05 +0000 (16:32 +0100)] 
qemu: fix order of VNC TLS config entries

For TLS config parameters, the 'verify' option always comes before the
'secret_uuid' option, except in the VNC case which has them reversed.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
9 days agobhyve: implement timeout for bhyveload
Roman Bogorodskiy [Sun, 13 Jul 2025 08:17:11 +0000 (10:17 +0200)] 
bhyve: implement timeout for bhyveload

The bhyveload(8) command does not have a native non-interactive mode.
It means that in case of errors, e.g. invalid boot media, it
just drops into a loader prompt and waits for user input. This behaviour
makes it tricky for users to understand what's going on.

To address that, run it with the timeout(1) tool which sends SIGTERM
after a certain timeout, and then optionally sends SIGKILL if the
command keeps hanging.

These timeout values could be configured in the bhyve.conf. Setting
timeout to 0 mean that bhyveload(8) will be executed directly, without
timeout(1).

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
10 days agobhyve: don't reset domain autostart flag on destroy
Roman Bogorodskiy [Sun, 20 Jul 2025 13:55:07 +0000 (15:55 +0200)] 
bhyve: don't reset domain autostart flag on destroy

Currently, virBhyveProcessStop() uses the virDomainDeleteConfig()
helper to clean up domain status. It passes BHYVE_STATE_DIR as
a configuration dir and NULL as autostart dir, so the helper does its
job, even though it has a different purpose. However, the issue is that
it also resets the autostart (and autostartOnce) property.

This results in a situation that when a persistent domain with autostart
enabled gets destroyed, its autostart state is reported as disabled,
which is not correct.

To fix that, implement the bhyveProcessRemoveDomainStatus() which
removes the status file without side effects on the virDomainObj object.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com
10 days agoqemu_tpm: Do not use persistent definition during pre-start checks
Martin Kletzander [Fri, 18 Jul 2025 12:47:58 +0000 (14:47 +0200)] 
qemu_tpm: Do not use persistent definition during pre-start checks

Commit 3451987fca7c used the persistent TPM Definition in both calls to
qemuTPMVirCommandSwtpmAddTPMState() but in one of the two cases it
might've been NULL and what's more, it is not the right definition which
should've been used.  Change that to @tpm which is the current
definition.  The other call does not have access to the current
definition and is only called during updating the profile.  But for the
sake of fewer future mistakes, keep the other one as is because there is
no issue with calling it that way and adding logic that just skips the
extra check on NULL could mistake someone in the future.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
11 days agoFix: missing a single quote in doc example
Lukas Greve [Sun, 20 Jul 2025 09:01:43 +0000 (11:01 +0200)] 
Fix: missing a single quote in doc example

The missing single quote (') in the code snippet results
in it not being validated by virt-xml-validate

Signed-off-by: Lukas Greve <please@refre.ch>
13 days agotests: nssdata: add empty status file
Ján Tomko [Wed, 16 Jul 2025 11:33:49 +0000 (13:33 +0200)] 
tests: nssdata: add empty status file

Add a test to make sure we will keep ignoring empty
status files properly in the future.

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

Fixes: 63a3d70697dc44ef2f8b40f7c8e9aa869227a7da
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
13 days agonss: Debug print JSON files as they are parsed
Michal Privoznik [Tue, 24 Jun 2025 08:17:44 +0000 (10:17 +0200)] 
nss: Debug print JSON files as they are parsed

It may help in case the NSS plugin ever faces a corrupted JSON

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 days agonss: Print module name
Michal Privoznik [Thu, 19 Jun 2025 08:50:57 +0000 (10:50 +0200)] 
nss: Print module name

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 days agonss: Include filename in debug printings
Michal Privoznik [Thu, 19 Jun 2025 08:42:46 +0000 (10:42 +0200)] 
nss: Include filename in debug printings

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 days agonss: Make logging conditional on an envvar
Michal Privoznik [Wed, 18 Jun 2025 06:57:46 +0000 (08:57 +0200)] 
nss: Make logging conditional on an envvar

As promised in previous commit, make NSS modules silent by
default and enable debug printings if LIBVIRT_NSS_DEBUG envvar is
set.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 days agonss: Move logging into a separate file and turn it temporarily on
Michal Privoznik [Wed, 18 Jun 2025 06:49:29 +0000 (08:49 +0200)] 
nss: Move logging into a separate file and turn it temporarily on

Currently, when somebody wants to debug the NSS plugin, they have
to change a line in libvirt_nss.h (to enable debug printings) and
recompile the module. This may work for us, developers, but we
can not expect this from users.

For now, this turns debug printings unconditionally on. Making it
conditional on an envvar is handled in the next commit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 days agonss: Promote debug message to proper error when time() fails
Michal Privoznik [Fri, 4 Jul 2025 11:49:12 +0000 (13:49 +0200)] 
nss: Promote debug message to proper error when time() fails

The difference between DEBUG() and ERROR() macros is that the
latter also prints (stringified) errno. Inside of findLease()
there's one line where time() is called which is documented as:

  On error, ((time_t) -1) is returned, and errno is set to
  indicate the error.

Therefore, don't just print DEBUG() but ERROR() so that the cause
for the error is printed too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 days agorpc: virnettlscert: Rename virNetTLSCertLoadCAListFromFile to virNetTLSCertLoadListFr...
Peter Krempa [Thu, 10 Jul 2025 14:02:40 +0000 (16:02 +0200)] 
rpc: virnettlscert: Rename virNetTLSCertLoadCAListFromFile to virNetTLSCertLoadListFromFile

The function can load a generic list of certs, it doesn't necessarily
have to be the list of CAs. Rename the function, and change error to be
generic.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
13 days agovirNetTLSCertCheckPair: Fix function definition formatting
Peter Krempa [Thu, 10 Jul 2025 14:01:03 +0000 (16:01 +0200)] 
virNetTLSCertCheckPair: Fix function definition formatting

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
13 days agovirNetTLSContextNewPath: Refactor temporary variable usage
Peter Krempa [Thu, 10 Jul 2025 13:58:28 +0000 (15:58 +0200)] 
virNetTLSContextNewPath: Refactor temporary variable usage

Use autofree for all temporary variables and return the result directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
13 days agorpc: virnettlscontext: Fix formatting of function definitions
Peter Krempa [Thu, 10 Jul 2025 13:57:51 +0000 (15:57 +0200)] 
rpc: virnettlscontext: Fix formatting of function definitions

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
13 days agoNEWS: Mention virConnectHypervisorBaselineCPU improvements
Jiri Denemark [Fri, 4 Jul 2025 14:54:47 +0000 (16:54 +0200)] 
NEWS: Mention virConnectHypervisorBaselineCPU improvements

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
13 days agovirsh: Add support for VIR_CONNECT_BASELINE_CPU_IGNORE_HOST flag
Jiri Denemark [Wed, 25 Jun 2025 11:53:42 +0000 (13:53 +0200)] 
virsh: Add support for VIR_CONNECT_BASELINE_CPU_IGNORE_HOST flag

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 days agoqemu: Implement VIR_CONNECT_BASELINE_CPU_IGNORE_HOST
Jiri Denemark [Mon, 23 Jun 2025 13:46:37 +0000 (15:46 +0200)] 
qemu: Implement VIR_CONNECT_BASELINE_CPU_IGNORE_HOST

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 days agoIntroduce VIR_CONNECT_BASELINE_CPU_IGNORE_HOST flag
Jiri Denemark [Mon, 23 Jun 2025 13:37:53 +0000 (15:37 +0200)] 
Introduce VIR_CONNECT_BASELINE_CPU_IGNORE_HOST flag

With this new flag virConnectHypervisorBaselineCPU can be used on any
host (rather than being limited to hosts described by individual CPUs
passed to the API). Using the flag makes the API behave similarly to the
old virConnectBaselineCPU. The main difference is the CPU definition
accepted by both APIs: the old one only accepts host CPU definition,
i.e., without 'policy' attributes as seen in the host capabilities XML.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 days agoChange documentation style of virConnectBaselineCPUFlags
Jiri Denemark [Mon, 23 Jun 2025 13:37:36 +0000 (15:37 +0200)] 
Change documentation style of virConnectBaselineCPUFlags

Moving the documentation above each enum item gives us more space for
it.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 days agoClarify documentation of virConnectBaselineHypervisorCPU
Jiri Denemark [Mon, 23 Jun 2025 13:21:34 +0000 (15:21 +0200)] 
Clarify documentation of virConnectBaselineHypervisorCPU

The API was apparently never considered for being used on a host that is
not represented in the input set of CPU definitions. The result is
limited to the set of features and CPU models known to the host's
hypervisor. This would likely not be a big issue, but thanks to a side
effect of commit v3.8.0-99-g9c9620af1d usability blockers come to play
as well. When converting CPU data (CPUID and MSR bits) to each named
model for comparison, we disable features that block usability of the
model on the current hypervisor, the rest of the features are set
according to the data without taking host capabilities into account.
Thus the process of comparing and selecting the most appropriate CPU
model for the given data is significantly influenced by the host, but it
doesn't behave as if the host CPU model was included in the input data.

The documentation tried to say the result was tied to the host's
hypervisor, but it wasn't very clear.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 days agocpu: Show input CPU model names in debug log
Jiri Denemark [Wed, 2 Jul 2025 14:05:05 +0000 (16:05 +0200)] 
cpu: Show input CPU model names in debug log

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 days agoqemu_tpm: Don't report uninitialized variable in error message
Michal Privoznik [Thu, 17 Jul 2025 08:46:53 +0000 (10:46 +0200)] 
qemu_tpm: Don't report uninitialized variable in error message

Inside to qemu_tpm.c there are three functions that use the same
pattern (qemuTPMEmulatorRunSetup(), qemuTPMEmulatorReconfigure()
and qemuTPMEmulatorUpdateProfileName()):

  int exitstatus;
  ...
  if (virCommandRun(cmd, &exitstatus) < 0 || exitstatus != 0) {
      virReportError(..., exitstatus);
      return -1;
  }

Problem with this pattern is that if virCommandRun() fails then
exitstatus is left untouched and a garbage value is then passed
to virReportError().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 days agoqemu: Report system error on failed open()
Michal Privoznik [Wed, 16 Jul 2025 13:28:08 +0000 (15:28 +0200)] 
qemu: Report system error on failed open()

With a help from coccinelle three places were identified that
call virReportError() after failed open() (in
qemuDomainWriteMasterKeyFile(), qemuDomainMasterKeyReadFile() and
qemuProcessOpenVhostVsock()). The open() syscall does set errno
on failure so switch them to virReportSystemError() which may
shed more light into the reasons for failure.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 days agosrc: fix typo in fixup_name()
Elizaveta Tereshkina [Thu, 17 Jul 2025 16:24:35 +0000 (19:24 +0300)] 
src: fix typo in fixup_name()

Similar branches in the if-else structure look like bad copy-paste.
Fix the typo.

Fixes: a559ffec44 (src: rewrite ACL rule checker in Python)
Signed-off-by: Elizaveta Tereshkina <etereshkina@astralinux.ru>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 days agobhyve: sync error messages
Roman Bogorodskiy [Tue, 15 Jul 2025 18:32:07 +0000 (20:32 +0200)] 
bhyve: sync error messages

Use the same error messages for serial devices validation which are
already used in bhyve_domain.c

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
13 days agobhyve: extend serial devices validation
Roman Bogorodskiy [Tue, 15 Jul 2025 18:20:12 +0000 (20:20 +0200)] 
bhyve: extend serial devices validation

Extend bhyveDomainDeviceDefValidate() to check that:

 - only 'nmdm' or 'tcp' serial devices are used,
 - serial device count is not more than supported,
 - only listening raw TCP sockets are used.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
13 days agodocs: drvbhyve: document TCP console support
Roman Bogorodskiy [Sun, 13 Jul 2025 14:02:15 +0000 (16:02 +0200)] 
docs: drvbhyve: document TCP console support

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
13 days agobhyve: increase number of supported consoles to 4
Roman Bogorodskiy [Wed, 18 Jun 2025 17:59:47 +0000 (19:59 +0200)] 
bhyve: increase number of supported consoles to 4

Recent versions of bhyve support 4 com ports instead of just 2. Thus,
allow to use 4 console devices.

Also, there was a bug previously because the condition was
"if (chr->target.port > 2)", but as target.port start
with 0 and "com" ports start with 1, this condition allows com3 to be
used.

As bhyve supports 4 com ports already long enough, and all supported
FreeBSD versions include this capability, do not introduce driver
capability for that.

Add a couple of tests for that:

 - A domain that uses 4 serials, 2 of type 'nmdm'
   and the other 2 of type 'tcp'
 - A domain that uses unsupported port, such as target.port=4 which
   translates into com5.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
13 days agobhyve: support serial type 'tcp'
Roman Bogorodskiy [Wed, 18 Jun 2025 17:07:49 +0000 (19:07 +0200)] 
bhyve: support serial type 'tcp'

In addition to the nmdm consoles, bhyve also supports a tcp console.
It's configured with:

 .. -l com1,tcp=127.0.0.1:12345

Then a user could connect to the guest console port 0 by making a tcp
connection to the host's 127.0.0.1:12345.

In the domain XML this configuration is represented as:

  <serial type='tcp'>
    <source mode='bind' host='127.0.0.1' service='12345'/>
    <target type='serial' port='0'/>
  </serial>

Also, update domain capabilities to include the TCP console support.
Unfortunately, there's no way to detect that from the bhyve binary
before trying to start a VM, so there's no capability probing for this
feature.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 weeks agoAllow specifying zero discard granularity for block devices
Martin Kletzander [Thu, 17 Jul 2025 13:12:40 +0000 (15:12 +0200)] 
Allow specifying zero discard granularity for block devices

That allows for disabling discard in a way that some guest
OSes (e.g. Windows) understand and do not try to trim the disk.

Resolves: https://issues.redhat.com/browse/RHEL-72006
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 weeks agoqemu_tpm: Only warn about missing locking feature on shared filesystems
Martin Kletzander [Thu, 17 Jul 2025 09:58:32 +0000 (11:58 +0200)] 
qemu_tpm: Only warn about missing locking feature on shared filesystems

The warning pollutes the logs and might give a bad impression on someone
reading them even though the locking is not always needed.  This way we
at least limit the logging in unnecessary cases.

Resolves: https://issues.redhat.com/browse/RHEL-80155
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 weeks agoqemu_tpm: Extract per-TPM functionality from qemuTPMDomainHasSharedStorage
Martin Kletzander [Thu, 17 Jul 2025 09:54:22 +0000 (11:54 +0200)] 
qemu_tpm: Extract per-TPM functionality from qemuTPMDomainHasSharedStorage

This way we can do the check for a particular TPM also elsewhere in the
code, especially in places where we're dealing with only one TPM.  The
semantics is changed a little bit in a way that the function will check
all the TPMs as opposed to stopping on the first one which is of the
emulator type, but since a domain can currently only have one of these
it was not an issue.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 weeks agoqemu_tpm: Rename qemuTPMHasSharedStorage -> qemuTPMDomainHasSharedStorage
Martin Kletzander [Thu, 17 Jul 2025 09:51:39 +0000 (11:51 +0200)] 
qemu_tpm: Rename qemuTPMHasSharedStorage -> qemuTPMDomainHasSharedStorage

The function deals with the whole domain and the part that handles one
TPM will be useful elsewhere and hence extracted later.  This rename
makes it possible for the new function to use the original name of this
renamed one.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 weeks agovirshFindDisk: fix NULL-dereference of xmlCopyNode() result
Anastasia Belova [Wed, 16 Jul 2025 13:42:14 +0000 (16:42 +0300)] 
virshFindDisk: fix NULL-dereference of xmlCopyNode() result

xmlCopyNode() may return NULL. Add a check and log an error
in this case.

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

Fixes: 22766a1a53 ("virshFindDisk: Sanitize use of 'tmp' variable")
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 weeks agoqemu: qapi: fix potential SIGSEGV in virQEMUQAPISchemaTraverseObject()
Nikolai Barybin [Thu, 3 Jul 2025 10:19:07 +0000 (13:19 +0300)] 
qemu: qapi: fix potential SIGSEGV in virQEMUQAPISchemaTraverseObject()

We need to check obj ptr before passing it to
virJSONValueObjectHasKey(). If it's NULL it will fail with SIGSEGV.

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 weeks agoconf: schemas: add sysinfo.rng and sysinfocommon.rng into list of installed schemas
Pavel Hrdina [Tue, 15 Jul 2025 10:11:25 +0000 (12:11 +0200)] 
conf: schemas: add sysinfo.rng and sysinfocommon.rng into list of installed schemas

Fixes: 918594b419ea3944220fcbab6cf4f1ce7d81e609
Fixes: 6465a813d6aac5f5d8925a0dd3da64ff189796c4
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 weeks agobuild: prohibit realpath() by syntax-check
Michal Privoznik [Fri, 4 Jul 2025 07:50:33 +0000 (09:50 +0200)] 
build: prohibit realpath() by syntax-check

We have virFileCanonicalizePath() which calls realpath() but
also is present in our mocks (in contrast to realpath()).
Introduce a syntax-check rule to enforce use of our wrapper.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agoconf: virDomainHostdevSubsysMediatedDevDefParseXML refactor
Kirill Shchetiniuk [Mon, 7 Jul 2025 16:03:47 +0000 (18:03 +0200)] 
conf: virDomainHostdevSubsysMediatedDevDefParseXML refactor

Refactored the virDomainHostdevSubsysMediatedDevDefParseXML function
to use virXMLPropUUID fuction instead of getting a string and parsing
it later.

Due to parsing function change the missing uuid error reporter and
message were changed and changed error message was also reflected in
tests' outputs.

Signed-off-by: Kirill Shchetiniuk <kshcheti@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2 weeks agoschema: Schema validate host '<sysinfo>' XML test documents
Peter Krempa [Tue, 8 Jul 2025 13:53:31 +0000 (15:53 +0200)] 
schema: Schema validate host '<sysinfo>' XML test documents

Introduce schema for the host '<sysinfo>' output XMLs and validate our
test data against the schema.

This requires introduction of schema for '<processor>' and
'<memory_device>' elements which are not supported when sysinfo is set
explicitly for a domian definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agoconf: schemas: Split out common parts of 'sysinfo' schema
Peter Krempa [Tue, 8 Jul 2025 13:54:27 +0000 (15:54 +0200)] 
conf: schemas: Split out common parts of 'sysinfo' schema

Extract the common bits of the domain definition <sysinfo> schema which
will be also later reused to construct schema for the host <sysinfo> top
level element.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agosysinfotest: Use '.xml' suffix for output files
Peter Krempa [Tue, 8 Jul 2025 13:32:45 +0000 (15:32 +0200)] 
sysinfotest: Use '.xml' suffix for output files

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agodocs: clarify how to build without -Werror
Ján Tomko [Tue, 24 Jun 2025 15:48:00 +0000 (17:48 +0200)] 
docs: clarify how to build without -Werror

--werror does not accept any arguments for me and setting
git_werror was also needed to disable it with git.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 weeks agoNEWS: Mention switch to virtio-scsi on ARM and RISC-V
Jim Fehlig [Mon, 7 Jul 2025 22:29:46 +0000 (16:29 -0600)] 
NEWS: Mention switch to virtio-scsi on ARM and RISC-V

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 weeks agovirdevmapper: Always use device name for finding targets
Bhavin Gandhi [Wed, 2 Jul 2025 19:09:33 +0000 (00:39 +0530)] 
virdevmapper: Always use device name for finding targets

DM_TABLE_DEPS expects a device name in dm_ioctl.name. In one of the
cases, full path of the device was getting returned causing the ioctl
call to fail with `ENXIO (No such device or address)`.

Also rename the function and variable names to better reflect that we
are dealing with DM device names and not paths.

This got introduced in 22494556542c676d1b9e7f1c1f2ea13ac17e1e3e
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/790

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Bhavin Gandhi <bhavin192@geeksocket.in>
3 weeks agonwfilter: Remove 'qemu-announce-self' example
Peter Krempa [Mon, 7 Jul 2025 06:38:03 +0000 (08:38 +0200)] 
nwfilter: Remove 'qemu-announce-self' example

The example allows packets sent by qemu after migration with broken
protocol ID. The proper self announce is handled via
'qemu-announce-self-rarp'.

The qemu bug was addressed by f8778a7785d530515b0db39 (released as
v0.13.0). As we no longer support such old qemus, and allowing broken
packets makes no sense. Remove the rule and make it into an alias of
'qemu-announce-self-rarp' to preserve compatibility. Adjust the existing
examples to use only the proper rule.t

Closes: https://gitlab.com/libvirt/libvirt/-/issues/792
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 weeks agoqemucapabilitiestest: Add dump for the qemu-10.1 development cycle on x86_64
Peter Krempa [Fri, 4 Jul 2025 07:17:40 +0000 (09:17 +0200)] 
qemucapabilitiestest: Add dump for the qemu-10.1 development cycle on x86_64

Data based on 'v10.0.0-1874-gc77283dd5d'.

Notable changes:
 - machine types:
    - added 10.1 machines
    - dropped old machine types up to '4.1' (oldest supported is now '4.2)
 - new devices 'vfio-iommu-user', 'vfio-user-pci'
 - new qom types 'tdx-guest' (including additions to GUEST_CRAS* events
   etc), 'ram-block-attributes'

 - CPU stuff:
    - new models: 'EPYC-Turin-x86_64-cpu',
    - new model versions: 'EPYC-Genoa-v2-x86_64-cpu', 'EPYC-Milan-v3-x86_64-cpu'
                          'EPYC-Rome-v5-x86_64-cpu', 'EPYC-v5-x86_64-cpu'
    - new flags: 'fs-gs-base-ns', 'prefetchi', 'its-no msr-imm'

 - keep-alive options added to all types using 'inet' socket addreses

 - Some platform specific QMP commands are now reported on all
   platforms:
    - 'query-gic-capabilities'
    - 'query-cpu-model-baseline'
    - 'query-cpu-model-comparison',
    - 'dump-skeys'
    - 'set-cpu-topology' (unstable)
    - 'query-s390x-cpu-polarization' and corresponding 'CPU_POLARIZATION_CHANGE' event (unstable)

 - blockdev stuff:
    - blockdev-backup 'on-cbw-error' property added
    - blockdev-mirror 'target-is-zero' property added
    - deprecated commands: 'block-job-complete', 'block-job-dismiss',
                           'block-job-finalize', 'block-job-pause',
                           'block-job-resume'
    - 'dpofua' parameter of scsi disks was now enabled by default

 - 'migrate-extra' flag of 'virtio-net' removed
 - virtio devices gained 'sriov-pf' parameter

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agoqemuxmlconftest: x86_64: Bump 'firmware*' test cases to 'pc-q35-10.0'
Peter Krempa [Fri, 4 Jul 2025 07:55:14 +0000 (09:55 +0200)] 
qemuxmlconftest: x86_64: Bump 'firmware*' test cases to 'pc-q35-10.0'

New qemu is deprecating 'pc-q35-4.0-machine', update to the latest
released machine type.

Apart from the previous cases where we could use the aliased machine
type, the firmware auto-selection doesn't work properly for the
unexpanded 'q35' alias and thus we need to use a real machine type here.

Outside of tests a real machine type would be filled anyways, the use of
the alias happens only inside our '-latest' test suite.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agoqemuxmlconftest: x86_64: Bump 'firmware*' test cases to 'pc-i440fx-10.0'
Peter Krempa [Fri, 4 Jul 2025 07:55:14 +0000 (09:55 +0200)] 
qemuxmlconftest: x86_64: Bump 'firmware*' test cases to 'pc-i440fx-10.0'

New qemu is deprecating 'pc-i440fx-4.0-machine', update to the latest
released machine type.

Apart from the previous cases where we could use the aliased machine
type, the firmware auto-selection doesn't work properly for the
unexpanded 'pc' alias and thus we need to use a real machine type here.

Outside of tests a real machine type would be filled anyways, the use of
the alias happens only inside our '-latest' test suite.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agoqemuxmlconftest: x86_64: Drop explicit use of '2.9' machine type
Peter Krempa [Fri, 4 Jul 2025 07:55:14 +0000 (09:55 +0200)] 
qemuxmlconftest: x86_64: Drop explicit use of '2.9' machine type

New qemu will be deprecating them. Drop the use from test files not
depending on the actual machine type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agoqemuxmlconftest: x86_64: Drop explicit use of '2.5' machine type
Peter Krempa [Fri, 4 Jul 2025 07:55:14 +0000 (09:55 +0200)] 
qemuxmlconftest: x86_64: Drop explicit use of '2.5' machine type

New qemu will be deprecating them. Drop the use from test files not
depending on the actual machine type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agoqemuxmlconftest: x86_64: Drop explicit use of '2.12' machine type
Peter Krempa [Fri, 4 Jul 2025 07:55:14 +0000 (09:55 +0200)] 
qemuxmlconftest: x86_64: Drop explicit use of '2.12' machine type

New qemu will be deprecating them. Drop the use from test files not
depending on the actual machine type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agoqemuxmlconftest: x86_64: Drop explicit use of '2.10' machine type
Peter Krempa [Fri, 4 Jul 2025 07:55:14 +0000 (09:55 +0200)] 
qemuxmlconftest: x86_64: Drop explicit use of '2.10' machine type

New qemu will be deprecating them. Drop the use from test files not
depending on the actual machine type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agotests: virnettls*test: Drop use of GNUTLS_KEY_KEY_ENCIPHERMENT
Peter Krempa [Tue, 1 Jul 2025 11:48:00 +0000 (13:48 +0200)] 
tests: virnettls*test: Drop use of GNUTLS_KEY_KEY_ENCIPHERMENT

It's not needed with TLS 1.3 any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 weeks agokbase: tlscerts: Drop 'encryption_key' feature request
Peter Krempa [Tue, 1 Jul 2025 11:46:59 +0000 (13:46 +0200)] 
kbase: tlscerts: Drop 'encryption_key' feature request

As TLS 1.3 performs key exchange separately from the algorithm used to
verify authenticity, the certificates for libvirt's use of TLS don't
need to require the 'encryption_key' feature any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 weeks agotls: Don't require 'keyEncipherment' to be enabled altoghther
Peter Krempa [Mon, 30 Jun 2025 17:19:42 +0000 (19:19 +0200)] 
tls: Don't require 'keyEncipherment' to be enabled altoghther

Key encipherment is required only for RSA key exchange algorithm. With
TLS 1.3 this is not even used as RSA is used only for authentication.

Since we can't really check when it's required ahead of time drop the
check completely. GnuTLS will moan if it will not be able to use RSA
key exchange.

In commit 11867b0224a2 I tried to relax the check for some eliptic
curve algorithm that explicitly forbid it. Based on the above the proper
solution is to completely remove it.

Resolves: https://issues.redhat.com/browse/RHEL-100711
Fixes: 11867b0224a2b8dc34755ff0ace446b6842df1c1
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 weeks agovirDomainDriverAutoShutdown: Refactor selection logic for VMs
Peter Krempa [Tue, 1 Jul 2025 15:19:46 +0000 (17:19 +0200)] 
virDomainDriverAutoShutdown: Refactor selection logic for VMs

Decide separately and record what shutdown modes are to be applied on
given VM object rather than spreading out the logic through the code.

This centralization simplifies the conditions in the worker functions
and also:
 - provides easy way to check if the auto-shutdown code will be acting
   on domain object (will be used to fix attempt to auto-restore of
   VMs which were not selected to be acted on
 - will simplify further work where the desired shutdown action will be
   picked per-VM

This refactor also fixes a bug where if restoring of the state is
applied also on VMs that are not selected for action based on current
logic.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agovirDomainDriverAutoShutdownDoSave: Don't attempt to save transient VMs
Peter Krempa [Thu, 3 Jul 2025 12:18:46 +0000 (14:18 +0200)] 
virDomainDriverAutoShutdownDoSave: Don't attempt to save transient VMs

Commit 84bb136c31e added code that intended to skip the save of
transient domains but did so only in the setup part where we pause the
VMS. The second loop that actually attempts to save the VM was not
modified so we'd still try saving them:

 Jul 03 14:15:13 andariel virtqemud[247210]: auto-shutdown: unable to perform managed save of 'cd3': Requested operation is not valid: cannot do managed save for transient domain

Fixes: 84bb136c31e
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agohypervisor: Split out individual steps out of virDomainDriverAutoShutdown
Peter Krempa [Tue, 1 Jul 2025 14:11:12 +0000 (16:11 +0200)] 
hypervisor: Split out individual steps out of virDomainDriverAutoShutdown

'virDomainDriverAutoShutdown' grew into an unwieldy function. Extract
the code for each of the save/shutdown/poweroff steps into helpers and
call them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agoqemu: Fix auto-shutdown of qemu VMs by the qemu driver
Peter Krempa [Fri, 27 Jun 2025 14:10:03 +0000 (16:10 +0200)] 
qemu: Fix auto-shutdown of qemu VMs by the qemu driver

When auto-shutdown via the qemu driver is requested (rather than via
libvirt guests) we need to start the VMs in a way that they will be kept
around for libvirt to terminate them. This involves inverting the
dependancy relationship for the machined unit file.

Since the setup is done at startup of the VM, add a disclaimer to
qemu.conf that switching between the two modes with VMs running will not
work properly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agocgroup: Plumb the 'daemonDomainShutdown' parameter of 'virSystemdCreateMachine' to...
Peter Krempa [Fri, 27 Jun 2025 12:47:10 +0000 (14:47 +0200)] 
cgroup: Plumb the 'daemonDomainShutdown' parameter of 'virSystemdCreateMachine' to drivers

Plumb the new argument across the cgroup helpers up to the domain driver
code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agovirSystemdCreateMachine: Add flag to invert machined unit dependencies
Peter Krempa [Thu, 26 Jun 2025 15:35:17 +0000 (17:35 +0200)] 
virSystemdCreateMachine: Add flag to invert machined unit dependencies

The existing dependency order of the 'machined' unit file for the domain
we're starting ("After libvirtd/virtqemud"->thus shuts down *before* the
daemon) is intended to work with 'libvirt-guests.service' which requires
the daemon to be around to shut down the VMs.

If we want to use the integrated auto shutdown done by the daemon itself
we need to be able to instruct the domains (thus the corresponding
machined units to shut down *after* virtqemud/libvirt.

This means that we need to be able to invert the ordering relationship
to "Before".

This patch adds a parameter to virSystemdCreateMachine so that when
starting the VM we'll be able to tell the daemon to use the proper
relationship.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agohypervisor: domain: Extract logic for auto shutdown to virDomainDriverAutoShutdownActive
Peter Krempa [Fri, 27 Jun 2025 13:22:22 +0000 (15:22 +0200)] 
hypervisor: domain: Extract logic for auto shutdown to virDomainDriverAutoShutdownActive

Extract the checker that determines whether the daemon auto shutdown
functionality is active to a separate helper
'virDomainDriverAutoShutdownActive'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agoqemu: conf: Store 'autoShutdown' config in virDomainDriverAutoShutdownConfig
Peter Krempa [Fri, 27 Jun 2025 13:13:35 +0000 (15:13 +0200)] 
qemu: conf: Store 'autoShutdown' config in virDomainDriverAutoShutdownConfig

Rather than having a bunch of extra variables save the configuration of
the daemon auto shutdown in virDomainDriverAutoShutdownConfig which is
also used when initiating the shutdown.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agocgroup: Unexport 'virDomainCgroupInitCgroup'
Peter Krempa [Thu, 26 Jun 2025 16:24:06 +0000 (18:24 +0200)] 
cgroup: Unexport 'virDomainCgroupInitCgroup'

The function is called just from one place within the module where it's
defined.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agovirSystemdCreateMachine: Document @maxthreds
Peter Krempa [Thu, 26 Jun 2025 15:20:21 +0000 (17:20 +0200)] 
virSystemdCreateMachine: Document @maxthreds

The parameter overrides the maximum number of threads for the machine.

Fixes: d5572f62e32
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 weeks agoqemu: Use virtio-scsi by default on RISC-V
Andrea Bolognani [Wed, 24 Jan 2024 10:05:16 +0000 (11:05 +0100)] 
qemu: Use virtio-scsi by default on RISC-V

Using lsilogic on RISC-V was never an actual decision, but
rather a consequence of that being the default for legacy x86
guests. Using virtio-scsi is a much more sensible choice.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 weeks agoqemu: Clean up qemuDomainDefaultSCSIControllerModel()
Andrea Bolognani [Tue, 13 Feb 2024 15:00:08 +0000 (16:00 +0100)] 
qemu: Clean up qemuDomainDefaultSCSIControllerModel()

Use a better order for sections, improve comments, tweak
formatting.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 weeks agoqemu: Improve qemuDomainDefaultSCSIControllerModel()
Andrea Bolognani [Fri, 9 Feb 2024 17:47:34 +0000 (18:47 +0100)] 
qemu: Improve qemuDomainDefaultSCSIControllerModel()

Make the helper stateless. This requires the caller to check
whether it needs to be called in the first place instead of
adding this check inside the function, which makes for more
readable, if a little more verbose, code.

We also update callers to check the return value against
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT instead of a
functionally equivalent, but semantically less meaningful,
check for whether the return value is negative.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 weeks agoqemu: Switch to virtio-scsi on ARM
Jim Fehlig [Thu, 26 Jun 2025 21:16:22 +0000 (15:16 -0600)] 
qemu: Switch to virtio-scsi on ARM

Similar to x86, the default SCSI controller model for ARM is lsilogic.
But unlike x86, the ARM virt machine type prefers virtio devices. Switch
the default controller model for ARM from lsilogic to virtio-scsi.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 weeks agodocs: fix typo in qemu-passthrough-security
Ngai-Mint Kwan [Tue, 1 Jul 2025 16:55:23 +0000 (16:55 +0000)] 
docs: fix typo in qemu-passthrough-security

Signed-off-by: Ngai-Mint Kwan <ngai-mint.kwan@intel.com>
3 weeks agoqemu: Improve error message for USB controller validation
Andrea Bolognani [Tue, 13 Feb 2024 18:28:09 +0000 (19:28 +0100)] 
qemu: Improve error message for USB controller validation

Use the same wording as for SCSI controllers, which also
happens to contain additional information (the controller's
index).

The new error message and error type are more accurate anyway:
in most cases, it's perfectly fine for the user not to provide
a controller model explicitly, as libvirt will try to figure
out a reasonable default.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 weeks agoqemu: Move error reporting out of qemuDomainDefaultSCSIControllerModel()
Andrea Bolognani [Fri, 9 Feb 2024 17:38:35 +0000 (18:38 +0100)] 
qemu: Move error reporting out of qemuDomainDefaultSCSIControllerModel()

We want this helper to work more like other similar ones, where
error reporting is performed by the caller. This introduces a
small amount of code duplication but makes for a cleaner API.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 weeks agoqemu: Rename qemuDomainDefaultSCSIControllerModel()
Andrea Bolognani [Fri, 9 Feb 2024 17:34:30 +0000 (18:34 +0100)] 
qemu: Rename qemuDomainDefaultSCSIControllerModel()

The original name was qemuDomainGetSCSIControllerModel().

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 weeks agotests: Add controller-scsi-default-unavailable
Andrea Bolognani [Tue, 13 Feb 2024 10:20:46 +0000 (11:20 +0100)] 
tests: Add controller-scsi-default-unavailable

This provides coverage for the (very unlikely) scenario in
which none of the possible devices are built into QEMU.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 weeks agoTranslated using Weblate (Portuguese)
Américo Monteiro [Fri, 4 Jul 2025 07:49:27 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 7.6% (835 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
Translated using Weblate (Portuguese)

Currently translated at 7.1% (786 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
3 weeks agoTranslated using Weblate (Portuguese)
Weblate [Fri, 4 Jul 2025 07:49:27 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 7.1% (783 of 10937 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
3 weeks agoTranslated using Weblate (Portuguese)
Américo Monteiro [Fri, 4 Jul 2025 07:49:26 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 7.1% (783 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
Translated using Weblate (Portuguese)

Currently translated at 7.1% (781 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
Translated using Weblate (Portuguese)

Currently translated at 7.1% (781 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
3 weeks agoTranslated using Weblate (Portuguese)
Weblate [Fri, 4 Jul 2025 07:49:26 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 7.1% (781 of 10937 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
3 weeks agoTranslated using Weblate (Portuguese)
Américo Monteiro [Fri, 4 Jul 2025 07:49:25 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 7.1% (779 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
3 weeks agoTranslated using Weblate (Portuguese)
Weblate [Fri, 4 Jul 2025 07:49:24 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 7.1% (779 of 10937 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
Translated using Weblate (Portuguese)

Currently translated at 7.1% (778 of 10937 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
3 weeks agoTranslated using Weblate (Portuguese)
Américo Monteiro [Fri, 4 Jul 2025 07:49:23 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 7.1% (778 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
Translated using Weblate (Portuguese)

Currently translated at 7.1% (777 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
3 weeks agoTranslated using Weblate (Portuguese)
Weblate [Fri, 4 Jul 2025 07:49:22 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 7.1% (777 of 10937 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
Translated using Weblate (Portuguese)

Currently translated at 7.0% (776 of 10937 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
3 weeks agoTranslated using Weblate (Portuguese)
Américo Monteiro [Fri, 4 Jul 2025 07:49:22 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 7.0% (776 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
3 weeks agoTranslated using Weblate (Portuguese)
Weblate [Fri, 4 Jul 2025 07:49:21 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 7.0% (772 of 10937 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
3 weeks agoTranslated using Weblate (Portuguese)
Américo Monteiro [Fri, 4 Jul 2025 07:49:20 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 7.0% (772 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
Translated using Weblate (Portuguese)

Currently translated at 7.0% (771 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
3 weeks agoTranslated using Weblate (Portuguese)
Weblate [Fri, 4 Jul 2025 07:49:19 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 7.0% (771 of 10937 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
Translated using Weblate (Portuguese)

Currently translated at 7.0% (770 of 10937 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
3 weeks agoTranslated using Weblate (Portuguese)
Américo Monteiro [Fri, 4 Jul 2025 07:49:18 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 7.0% (770 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
3 weeks agoTranslated using Weblate (Portuguese)
Weblate [Fri, 4 Jul 2025 07:49:18 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 6.2% (680 of 10937 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
3 weeks agoTranslated using Weblate (Portuguese)
Américo Monteiro [Fri, 4 Jul 2025 07:49:17 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 6.2% (680 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
Translated using Weblate (Portuguese)

Currently translated at 5.9% (648 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
Translated using Weblate (Portuguese)

Currently translated at 5.7% (630 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
Translated using Weblate (Portuguese)

Currently translated at 5.6% (623 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
Translated using Weblate (Portuguese)

Currently translated at 5.5% (607 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
Translated using Weblate (Portuguese)

Currently translated at 5.2% (575 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
Translated using Weblate (Portuguese)

Currently translated at 5.2% (574 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
Translated using Weblate (Portuguese)

Currently translated at 4.6% (508 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
Translated using Weblate (Portuguese)

Currently translated at 4.2% (469 of 10937 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>