]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
2 weeks 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>
2 weeks 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>
2 weeks 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>
2 weeks 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>
2 weeks 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 weeks agoTranslated using Weblate (Portuguese)
Weblate [Fri, 4 Jul 2025 07:49:16 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 4.2% (462 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>
4 weeks agoTranslated using Weblate (Portuguese)
Américo Monteiro [Fri, 4 Jul 2025 07:49:15 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 4.2% (462 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>
4 weeks agoTranslated using Weblate (Portuguese)
Weblate [Fri, 4 Jul 2025 07:49:15 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 4.1% (455 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>
4 weeks agoTranslated using Weblate (Portuguese)
Américo Monteiro [Fri, 4 Jul 2025 07:49:14 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 4.1% (455 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>
4 weeks agoTranslated using Weblate (Portuguese)
Weblate [Fri, 4 Jul 2025 07:49:13 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 4.1% (452 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>
4 weeks agoTranslated using Weblate (Portuguese)
Américo Monteiro [Fri, 4 Jul 2025 07:49:12 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 4.1% (452 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 3.9% (436 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 3.9% (435 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 3.7% (406 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 3.6% (402 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>
4 weeks agoTranslated using Weblate (Portuguese)
Weblate [Fri, 4 Jul 2025 07:49:12 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 3.6% (402 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>
4 weeks agoTranslated using Weblate (Portuguese)
Américo Monteiro [Fri, 4 Jul 2025 07:49:11 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 3.6% (397 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>
4 weeks agoTranslated using Weblate (Portuguese)
Weblate [Fri, 4 Jul 2025 07:49:10 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 3.6% (397 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 3.6% (396 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>
4 weeks agoTranslated using Weblate (Portuguese)
Américo Monteiro [Fri, 4 Jul 2025 07:49:09 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 3.6% (396 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 3.2% (357 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>
4 weeks agoTranslated using Weblate (Portuguese)
Weblate [Fri, 4 Jul 2025 07:49:08 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 3.2% (357 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>
4 weeks agoTranslated using Weblate (Portuguese)
Américo Monteiro [Fri, 4 Jul 2025 07:49:08 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 3.2% (350 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>
4 weeks agoTranslated using Weblate (Portuguese)
Weblate [Fri, 4 Jul 2025 07:49:07 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 3.2% (350 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 3.1% (349 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 3.1% (348 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>
4 weeks agoTranslated using Weblate (Portuguese)
Américo Monteiro [Fri, 4 Jul 2025 07:49:06 +0000 (07:49 +0000)] 
Translated using Weblate (Portuguese)

Currently translated at 3.1% (348 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>
5 weeks agovirt-aa-helper-test: Switch to getopts
Michal Privoznik [Thu, 12 Jun 2025 07:59:08 +0000 (09:59 +0200)] 
virt-aa-helper-test: Switch to getopts

Instead of treating -d and -v arguments as positional, use
getopts to parse cmd line arguments passed to
virt-aa-helper-test script.

While at it, introduce -h for printing basic help describing each
argument.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agovirt-aa-helper: Drop cleanup label from get_files()
Michal Privoznik [Wed, 11 Jun 2025 12:12:33 +0000 (14:12 +0200)] 
virt-aa-helper: Drop cleanup label from get_files()

After previous cleanup the cleanup label is no longer necessary.
Drop it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agovirt-aa-helper: Check retval of vah_add_file()
Michal Privoznik [Wed, 11 Jun 2025 11:59:49 +0000 (13:59 +0200)] 
virt-aa-helper: Check retval of vah_add_file()

Inside of get_files() there are two cases where vah_add_file() is
not checked for its retval. This is possibly dangerous, because
vah_add_file() might fail. Fix those places by introducing checks
for the retval.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agovirt-aa-helper: Use automatic memory freeing
Michal Privoznik [Wed, 11 Jun 2025 11:53:23 +0000 (13:53 +0200)] 
virt-aa-helper: Use automatic memory freeing

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agovirt-aa-helper: Decrease scope of @mem_path in get_files()
Michal Privoznik [Wed, 11 Jun 2025 11:52:46 +0000 (13:52 +0200)] 
virt-aa-helper: Decrease scope of @mem_path in get_files()

The @mem_path variable inside of get_files() is used only within
a single block. Move its declaration inside it. And also utilize
automatic memory freeing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agovirt-aa-helper: Simplify paths collection
Michal Privoznik [Tue, 10 Jun 2025 07:27:58 +0000 (09:27 +0200)] 
virt-aa-helper: Simplify paths collection

The way virt-aa-helper works is the following: the apparmor
secdriver formats domain XML, spawns virt-aa-helper process and
feeds it with domain XML (through stdin). The helper process then
parses the XML and iterates over devices, appending paths in each
loop.

These loops usually are in the following form:

  for (i = 0; i < ctl->def->nserials; i++) {
      if (ctl->def->serials[i] && ...
  }

While we are probably honourable members of tautology club, those
NULL checks are redundant. Our XML parses would never append NULL
into def->devices array. If it did, we're in way bigger problems
anyway.

Then, constantly dereferencing ctl->def just to get to a path
that's hidden a couple of structures deep gets hard to read. Just
introduce temporary variables.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agovirt-aa-helper: Rework USB hostdev handling
Michal Privoznik [Tue, 10 Jun 2025 12:31:20 +0000 (14:31 +0200)] 
virt-aa-helper: Rework USB hostdev handling

For an USB device, the virt-aa-helper must put that
/dev/bus/usb/... path associated with given device. The way the
code is currently written not only leads to a memleak (the @usb
variable is allocated only to be overwritten right away), but is
needlessly cumbersome.

We can use virHostdevFindUSBDevice() to find the USB device,
check if its missing and if not add the path associated with it
into the profile.

While at it, also use automatic memory freeing for the variable.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agovirt-aa-helper-test: Test hostdevs unconditionally
Michal Privoznik [Tue, 10 Jun 2025 12:30:40 +0000 (14:30 +0200)] 
virt-aa-helper-test: Test hostdevs unconditionally

Our test suite is very feature rich. In particular, it has two
mocks that implement sysfs close enough to create
host-independent environment to work with PCI and USB devices.
These mocks are called virpcimock and virusbmock, respectively.

Inside of virt-aa-helper-test there is an attempt to test whether
virt-aa-helper generates profiles for <hostdevs/>, once for USB
and the other time for PCI. Use this mocks to run virt-aa-helper
in an environment where certain PCI/USB devices always exist.

There are two problem though:

1) those two test cases use hardcoded PCI/USB addresses, which
   makes them host environment dependant,

2) neither of the test cases checks whether corresponding rule
   was added into the profile.

Using mocks we can get away with problem 1), and by passing the
fifth argument to testme() we can list an expected rule in the
profile.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agovirt-aa-helper-test: Silence ls
Michal Privoznik [Tue, 10 Jun 2025 09:58:34 +0000 (11:58 +0200)] 
virt-aa-helper-test: Silence ls

virt-aa-helper checks presence of files before it adds them into
a profile. Because of that, test cases inside of
virt-aa-helper-test that require presence of /boot/initrd* are
guarded by a check. The check uses ls to find at least one initrd
file. If there's none, then ls prints an error onto stderr. This
is not helpful because the test script prints a message on its
own right after.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agovirt-aa-helper-test: Print errors to stderr
Michal Privoznik [Tue, 10 Jun 2025 09:57:43 +0000 (11:57 +0200)] 
virt-aa-helper-test: Print errors to stderr

When a test case fails, there are two echo-s executed: the first
one either prints the error message into /dev/null (default) or
onto stdout (when the test script is executed with -d). Then, the
second one prints the error message onto stdout. While this
technically works, there's nothing ever printed onto stderr which
is usually what's captured. Worse, if some command within the
script fails, it prints something onto stderr but then looking at
meson logs it's needlessly hard to match stderr and stdout lines.

Just print error messages onto stderr.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agotests: Fix mocking of open()
Michal Privoznik [Wed, 11 Jun 2025 14:17:33 +0000 (16:17 +0200)] 
tests: Fix mocking of open()

In some cases (well, majority), open() is either rewritten to
open64(), either by plain '#define open open64') or at assembly
level (using __REDIRECT macro). See <fcntl.h> for more info.

This didn't really matter to us, because we do not chain load two
mocks that would need to reimplement open() at the same time. But
this is soon going to change.

The problem is, that VIR_MOCK_REAL_INIT(open) glances over
aforementioned rewrite and initializes real_open pointer to
open() from the standard C library. But it needs to point to
open() (well, open64()) from the next mock on the list.

Therefore, init real_open to open64().

But of course, this is all glibc specific and for example musl
does the oposite (#define open64 open).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agovirpcimock: Strip fakerootdir prefix in virFileCanonicalizePath()
Michal Privoznik [Wed, 11 Jun 2025 11:19:32 +0000 (13:19 +0200)] 
virpcimock: Strip fakerootdir prefix in virFileCanonicalizePath()

The mocked implementation of virFileCanonicalizePath() redirects
accesses to few dirs into a temporary directory, where PCI
related files live. See getrealpath() for more info on this.

Anyway, in the end - real implementation of
virFileCanonicalizePath() is called which then might contain the
'fakerootdir' prefix. Up until now this did not matter because
none of our test really cared about actual value of resolved
path. They usually cared about last component of the path or
something. But this will soon change.

TLDR - if the returned path has $fakerootdir prefix, strip it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agovirpcimock: Automatically invent fakerootdir, if not provided
Michal Privoznik [Tue, 10 Jun 2025 13:11:55 +0000 (15:11 +0200)] 
virpcimock: Automatically invent fakerootdir, if not provided

Currently, all users of virpcimock do set LIBVIRT_FAKE_ROOT_DIR
envvar. But soon, virt-aa-helper will be run with it and
basically right at the beginning of its main() it clears whole
environment. So even if the envvar is provided the mock won't see
that.

Anyway, the solution is to just create a tempdir and then 'rm
-rf' it in the desctructor.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agovirt-aa-helper: Use virFileCanonicalizePath()
Michal Privoznik [Wed, 11 Jun 2025 11:19:12 +0000 (13:19 +0200)] 
virt-aa-helper: Use virFileCanonicalizePath()

While use of realpath() is not forbidden, our some of our mocks
already have a test friendly reimplementation of
virFileCanonicalizePath(). Use the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agolog_cleaner: Use virFileCanonicalizePath()
Michal Privoznik [Wed, 11 Jun 2025 11:18:55 +0000 (13:18 +0200)] 
log_cleaner: Use virFileCanonicalizePath()

While use of realpath() is not forbidden, our some of our mocks
already have a test friendly reimplementation of
virFileCanonicalizePath(). Use the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agogendispatch: Finish rename of the migration argument
Michal Privoznik [Thu, 5 Jun 2025 08:22:15 +0000 (10:22 +0200)] 
gendispatch: Finish rename of the migration argument

This patch is useless.

Either APIs it don't have 'resource' nor 'bandwidth' argument to
begin with, or they serve as a wrapper over different API
(changed in previous commits). Nonetheless, in the name of
consistency, let's just change those variable names.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agoqemu: Finish argument rename
Michal Privoznik [Thu, 5 Jun 2025 08:22:08 +0000 (10:22 +0200)] 
qemu: Finish argument rename

There are still some functions around migration code that use
'resource' instead 'bandwidth'. Rename the variable/argument
inside them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agosrc: Unify argument name of virDomainMigratePerform3()
Michal Privoznik [Thu, 5 Jun 2025 08:21:25 +0000 (10:21 +0200)] 
src: Unify argument name of virDomainMigratePerform3()

The virDomainMigratePerform3() API declares its last argument as
'bandwidth', though throughout various typedefs, RPC and callback
implementations the name is changed to 'resource'. This creates a
confusion. Unify the name.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agosrc: Unify argument name of virDomainMigrateBegin3()
Michal Privoznik [Wed, 4 Jun 2025 14:28:41 +0000 (16:28 +0200)] 
src: Unify argument name of virDomainMigrateBegin3()

The virDomainMigrateBegin3() API declares its last argument as
'bandwidth', though throughout various typedefs, RPC and callback
implementations the name is changed to 'resource'. This creates a
confusion. Unify the name.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agosrc: Unify argument name of virDomainMigratePrepareTunnel3()
Michal Privoznik [Thu, 5 Jun 2025 08:17:45 +0000 (10:17 +0200)] 
src: Unify argument name of virDomainMigratePrepareTunnel3()

The virDomainMigratePrepareTunnel3() API declares one of its
argument as 'bandwidth', though throughout various typedefs, RPC
and callback implementations the name is changed to 'resource'.
This creates a confusion. Unify the name.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 weeks agosrc: Unify argument name of virDomainMigratePrepare3()
Michal Privoznik [Thu, 5 Jun 2025 07:48:14 +0000 (09:48 +0200)] 
src: Unify argument name of virDomainMigratePrepare3()

The virDomainMigratePrepare3() API declares one of its argument
as 'bandwidth', though throughout various typedefs, RPC and
callback implementations the name is changed to 'resource'. This
creates a confusion. Unify the name.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>