]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
5 hours agoNEWS: Document features/improvements/bug fixes I've participated in master
Michal Privoznik [Wed, 27 May 2026 13:57:48 +0000 (15:57 +0200)] 
NEWS: Document features/improvements/bug fixes I've participated in

There are some features/improvements/bug fixes I've either
contributed or reviewed/merged. Document them for upcoming
release.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
24 hours agotests: Link qemuxml2argvmock with test_utils_lib
Michal Privoznik [Tue, 26 May 2026 13:18:52 +0000 (15:18 +0200)] 
tests: Link qemuxml2argvmock with test_utils_lib

When running qemuxmlconftest under valgrind, it fails with a
symbol lookup error:

  valgrind: symbol lookup error: libvirt.git/_build/tests/libqemuxml2argvmock.so: undefined symbol: virTestMakeDummyFD

This occurs because qemuxml2argvmock uses the
virTestMakeDummyFD() function (implemented in testutils.c) but
does not explicitly link against test_utils_lib. Fix this by
linking the test utils library to the mock library, statically.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
30 hours agomailmap: Map 'via Devel' mailing-list From-munged authors to real identities
Denis V. Lunev [Wed, 20 May 2026 16:47:44 +0000 (18:47 +0200)] 
mailmap: Map 'via Devel' mailing-list From-munged authors to real identities

The devel@lists.libvirt.org mailing list rewrites the From: header
for DMARC reasons, so patches submitted via the list land in git as
'<Real Name> via Devel <devel@lists.libvirt.org>'. This currently
affects 30 commits across 13 distinct contributors, all of whom are
identifiable by their Signed-off-by trailer.

Add mailmap entries that remap each mangled identity back to the
author's real name and address, matching the approach used by the
Linux kernel for the same problem.

Beyond cosmetic cleanup, this keeps contribution statistics
(git shortlog, contributor graphs) accurate and ensures contributors
get proper credit for their work, which is valuable when they look
for new positions or otherwise need a verifiable record of upstream
activity.

This approach is standard for such situations in Linux kernel. I have
seen this several times.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 days agopo: Refresh potfile for v12.4.0 v12.4.0-rc1
Jiri Denemark [Mon, 25 May 2026 20:51:15 +0000 (22:51 +0200)] 
po: Refresh potfile for v12.4.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3 days agoqemuxmlconftest: Use real FD for iommufd object in tests
Peter Krempa [Wed, 20 May 2026 08:46:58 +0000 (10:46 +0200)] 
qemuxmlconftest: Use real FD for iommufd object in tests

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuxmlconftest: Use real FDs for hostdev tests
Peter Krempa [Fri, 15 May 2026 12:25:38 +0000 (14:25 +0200)] 
qemuxmlconftest: Use real FDs for hostdev tests

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuxml2argvmock: Use real FDs for interface tests
Peter Krempa [Tue, 19 May 2026 16:06:31 +0000 (18:06 +0200)] 
qemuxml2argvmock: Use real FDs for interface tests

Similarly to previous commits use real FDs so that we don't risk
collisions.

Note that for the test cases passing multiple tap and vhost FDs the
helpers which stabilize the output don't actually work, as the FDs are
concatenated. For now we'll not deal with this and simply leave them
censored by the 'XXXXXXX' string.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuxmlconftest: Use real FDS for testing of 'vsock'
Peter Krempa [Wed, 20 May 2026 12:15:55 +0000 (14:15 +0200)] 
qemuxmlconftest: Use real FDS for testing of 'vsock'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agotestutilsqemu: Remove unused 'ARG_VDPA_FD' test argument
Peter Krempa [Wed, 20 May 2026 12:03:02 +0000 (14:03 +0200)] 
testutilsqemu: Remove unused 'ARG_VDPA_FD' test argument

The code was refactored to allow any FD numbers so the code to map them
to specific numbers is no longer needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuxmlconftest: Use virTestMakeDummyFD() to get VDPA disk fds
Peter Krempa [Wed, 20 May 2026 11:59:12 +0000 (13:59 +0200)] 
qemuxmlconftest: Use virTestMakeDummyFD() to get VDPA disk fds

While VDPA disks did use real FDs they used convoluted infrastructure
for mapping them to specific numbers. Remove that since we can now mask
them from the output args instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuxmlconftest: (consistently) use real FDs in tests for VDPA netdevs
Peter Krempa [Tue, 17 May 2022 13:22:16 +0000 (15:22 +0200)] 
qemuxmlconftest: (consistently) use real FDs in tests for VDPA netdevs

Use virTestMakeDummyFD() to get a real FD for the test in
qemuxmlconftest.

Use virTestMakeDummyFD() also in qemuhotplugmock.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuxml2argvmock: qemuBuildTPMOpenBackendFDs: Use real FDs
Peter Krempa [Tue, 19 May 2026 16:17:00 +0000 (18:17 +0200)] 
qemuxml2argvmock: qemuBuildTPMOpenBackendFDs:  Use real FDs

Use 'virTestMakeDummyFD()' to create real FDs both for 'tpmfd' and
'cancelfd'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuxmlconftest: Setup real FDs for 'vhost-user-vga'
Peter Krempa [Tue, 19 May 2026 15:52:04 +0000 (17:52 +0200)] 
qemuxmlconftest: Setup real FDs for 'vhost-user-vga'

Initialize the chardev backends for vhost-user graphics to use real FDs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agotestQemuPrepareHostBackendChardevOne: Use real FDs for all cases
Peter Krempa [Tue, 19 May 2026 15:35:21 +0000 (17:35 +0200)] 
testQemuPrepareHostBackendChardevOne: Use real FDs for all cases

Use the virTestMakeDummyFD() function to setup real FDs for all chardev
backends which are set up via testQemuPrepareHostBackendChardevOne.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agovirDomainFDTuple: drop 'testfds' field
Peter Krempa [Mon, 18 May 2026 12:58:51 +0000 (14:58 +0200)] 
virDomainFDTuple: drop 'testfds' field

Thanks to real FD testing we no longer need to inject test
infrastructure into production code. Remove it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agotestQemuInfoSetArgs: Use real FDs with 'ARG_FD_GROUP'
Peter Krempa [Wed, 13 May 2026 14:33:49 +0000 (16:33 +0200)] 
testQemuInfoSetArgs: Use real FDs with 'ARG_FD_GROUP'

Switch over to 'virTestMakeDummyFD' which allows to use real FDs in the
test and also allows to track them in the output files in a stable way.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agotestutilsqemu: Use real FD for monitor FDs instantiated by 'testQemuPrepareHostBacken...
Peter Krempa [Mon, 18 May 2026 10:37:24 +0000 (12:37 +0200)] 
testutilsqemu: Use real FD for monitor FDs instantiated by 'testQemuPrepareHostBackendChardevOne'

Switch to 'virTestMakeDummyFD' which uses a real FD. No otuputs are
changed thanks to the code which censors 'fd' field of --add-fd.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuxmlconftest: Stabilize 'vfio-pci' hostdev fds
Peter Krempa [Wed, 20 May 2026 08:05:53 +0000 (10:05 +0200)] 
qemuxmlconftest: Stabilize 'vfio-pci' hostdev fds

Prepare to use real FDs in tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuxmlconftest: Stabilize fds in '-netdev'
Peter Krempa [Tue, 19 May 2026 16:10:14 +0000 (18:10 +0200)] 
qemuxmlconftest: Stabilize fds in '-netdev'

Use 'testCompareXMLToArgvStabilizeOne' to provide stable test outputs
even when we'll switch to real FDs in tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuxmlconftest: Stabilize 'vsock' 'vhostfd' file descriptior in output files
Peter Krempa [Wed, 20 May 2026 12:14:17 +0000 (14:14 +0200)] 
qemuxmlconftest: Stabilize 'vsock' 'vhostfd' file descriptior in output files

Install hanlder to stabilize 'vhostfd' fds in -device so that we can
later switch tests to use real FDs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuxmlconftest: Stabilize FDs in iommufd objects
Peter Krempa [Mon, 18 May 2026 16:04:27 +0000 (18:04 +0200)] 
qemuxmlconftest: Stabilize FDs in iommufd objects

Install the handler to stabilize output files on '-object' with
'iommufd' qom type which references a FD directly via the 'fd' property.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemumonitorjsontest: Stabilize FD names in '-chardev'
Peter Krempa [Fri, 15 May 2026 16:53:41 +0000 (18:53 +0200)] 
qemumonitorjsontest: Stabilize FD names in '-chardev'

Use 'testCompareXMLToArgvStabilizeOne' to censor FD values in '-chardev'
commands for stable test outputs without the need for fake FDs.

For monitor sockets this also creates a hint '@mon-fd@' to be used as
substitution to prevent any further churn on basically every .args file.
The substitution is done by temporarily using another fake FD (1764)
instead of 1729 so that it's unique.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuxmlconftest: Stablilize '-add-fd' arguments
Peter Krempa [Wed, 13 May 2026 13:31:30 +0000 (15:31 +0200)] 
qemuxmlconftest: Stablilize '-add-fd' arguments

Add code which walks the generated argument list and allows to strip out
and replace by a substitution any field in either JSON or legacy qemu
argument string.

Use it to stabilize 'fd' field of '-add-fd'

This will allow us to rip out code which tries to allocate stable FD
numbers, which doesn't work reliably (e.g. if the environment passes
some FDs).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuxmlconftest: Move mock'd FDs further out
Peter Krempa [Wed, 20 May 2026 15:28:41 +0000 (17:28 +0200)] 
qemuxmlconftest: Move mock'd FDs further out

Upcoming patches will introduce use of real FDs for tests. Since the
test will go through many FDs they will collide with the fake ones
allocated randomly in qemuxml2argvmock.

Move them out for now until they are replaced and masked out from the
tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agotestutils: Introduce virTestMakeDummyFD
Peter Krempa [Wed, 13 May 2026 14:51:58 +0000 (16:51 +0200)] 
testutils: Introduce virTestMakeDummyFD

The helper makes a dummy (file) FD to be used as FD in tests which want
to handle a FD but don't really use it. It also optionally records the
FD number along with a hint in a hash table which can be later
used to fetch the hint and stabilize test outputs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoutil: json: Introduce 'virJSONValueObjectReplaceKey'
Peter Krempa [Wed, 13 May 2026 14:32:26 +0000 (16:32 +0200)] 
util: json: Introduce 'virJSONValueObjectReplaceKey'

Add a helper which replaces the value part of a JSON object key. This
will be helpful in tests where we'll want to rewrite some outputs (e.g.
fds) to stabilize output files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoutil: command: Remove virCommandGetArgList
Peter Krempa [Wed, 13 May 2026 13:12:18 +0000 (15:12 +0200)] 
util: command: Remove virCommandGetArgList

The function is now unused, remove it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuxmlconftest: Use virCommandArgListAccess in testCompareXMLToArgvValidateSchema
Peter Krempa [Wed, 13 May 2026 13:10:55 +0000 (15:10 +0200)] 
qemuxmlconftest: Use virCommandArgListAccess in testCompareXMLToArgvValidateSchema

Access the args directly rather than fetching a copy since we have a new
helper now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoutil: vircommand: Add direct accessor for 'args' array for tests
Peter Krempa [Wed, 13 May 2026 12:59:50 +0000 (14:59 +0200)] 
util: vircommand: Add direct accessor for 'args' array for tests

Introduce virCommandArgListAccess which returns 'args' and 'nargs'

Upcoming patches will add code which censores/stabilizes FD numbers in
test outputs. This will be done by rewriting the argument of the command
before comparing it with test output. Add a test-only function to
directly access 'args' and 'nargs' of a virCommand to do this
modification.

This accessor will also be used instead of 'virCommandGetArgList' in
'testCompareXMLToArgvValidateSchema' to avoid needles copy of all
arguments.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuxml2argvmock: Fix behaviour of 'virCommandPass' mock
Peter Krempa [Fri, 15 May 2026 12:34:27 +0000 (14:34 +0200)] 
qemuxml2argvmock: Fix behaviour of 'virCommandPass' mock

The 'virCommandPass' mock in 'qemuxml2argvmock.so' skipped passing most
FDs to the real implementation of 'virCommandPass', except for few fake
FDs that were hardcoded.

This meant that if a test case had an valid FD that it used for testing
that FD would be leaked. At the same time fake fds 1730, 1731, 1732
would be actually passed to the virCommand itself although the FD was
invalid.

Since neither of the above makes sense fix the implementation the
following way:

 - refuse to pass any STDIO fds
     They are real and they would break test program output. Some tests
     do try to use them errorneously; they will be addressed later.

 - pass real FDs to virCommand
    Real FDs can be properly handled by virCommand. Especially they will
    be closed once the virCommand object is disposed of.

 - don't pass fake FDs
    They create extra noise e.g. in valgrind. Skip those as it makes no
    sense to handle those.

This patch addresses most failures that valgrind reports with
--track-fds=all.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuFDPassLogFDInfo: Check if FD is valid before 'fstat'-ing it
Peter Krempa [Mon, 18 May 2026 08:38:12 +0000 (10:38 +0200)] 
qemuFDPassLogFDInfo: Check if FD is valid before 'fstat'-ing it

Some test cases (qemuxmlconftest) currently use made up descriptors,
which cause e.g. valgrind to be unhappy:

 ==831186== File descriptor 1729 Invalid file descriptor
 ==831186==    at 0x531042E: fgetxattr (in /usr/lib64/libc.so.6)
 ==831186==    by 0x5AE2846: ??? (in /usr/lib64/libselinux.so.1)
 ==831186==    by 0x5AE7093: fgetfilecon_raw (in /usr/lib64/libselinux.so.1)
 ==831186==    by 0x4EB736F: qemuFDPassLogFDInfo (qemu_fd.c:92)
 ==831186==    by 0x4EB7B8E: qemuFDPassDirectTransferCommand (qemu_fd.c:443)

when tracking FDs. Since 'qemuFDPassLogFDInfo' just logs information
about the FD we can simply not query the FD if it's made up.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoutil: command: Extract common parts of FD closing to virCommandMassClose
Peter Krempa [Wed, 13 May 2026 09:15:03 +0000 (11:15 +0200)] 
util: command: Extract common parts of FD closing to virCommandMassClose

Extract the lookup of used FDs and their setup to virCommandMassClose
rather than duplicate it in the two functions we have for using
different modes of FD closing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemu: Stop mocking 'qemuOpenChrChardevUNIXSocket'
Peter Krempa [Wed, 13 May 2026 15:39:06 +0000 (17:39 +0200)] 
qemu: Stop mocking 'qemuOpenChrChardevUNIXSocket'

The tests now use 'testQemuPrepareHostBackendChardevOne' which replaces
'qemuProcessPrepareHostBackendChardevOne' which is skipped as it is a
host setup step.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agoqemuxmlconftest: Remove unused 'monitor_chr' from testCompareXMLToArgv
Peter Krempa [Wed, 13 May 2026 15:14:54 +0000 (17:14 +0200)] 
qemuxmlconftest: Remove unused 'monitor_chr' from testCompareXMLToArgv

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 days agovirsh: fix entering interactive session
Roman Bogorodskiy [Sat, 23 May 2026 07:24:48 +0000 (09:24 +0200)] 
virsh: fix entering interactive session

When entering an interactive session, that is, without a command
specified:

  virsh --connect $URI

virsh currently segfaults because it tries to access
ctl->cmd->def->handler and the ctl->cmd is NULL.

Fix by checking if ctl->cmd is not NULL before doing further checks.

Fixes: b489eb8d6b52d4183754a5d1da55006148a331e4
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 days agoci: Fix --engine flag positioning in helper script
Radoslaw Smigielski via Devel [Fri, 22 May 2026 16:57:48 +0000 (18:57 +0200)] 
ci: Fix --engine flag positioning in helper script

The --engine flag was being added to positional_args before the "run"
subcommand, which resulted in incorrect lcitool invocations:

  lcitool container --engine podman run ...  (wrong)

This caused "invalid choice: 'podman'" errors because lcitool expected
a COMMAND argument at that position.

Fix by moving the --engine flag to opts array, which is added after
the "run" subcommand, resulting in the correct command structure:

  lcitool container run --engine podman ...  (correct)

Example:

 $ ./ci/helper run fedora-44 --job codestyle --engine podman
  usage: lcitool container [-h] COMMAND ...
 lcitool container: error: argument COMMAND: invalid choice: 'podman' (choose from engines, build, run, shell)

The same error happens if "--engine" option is set to different
than "auto" value.

Signed-off-by: Radoslaw Smigielski <rsmigiel@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 days agoNEWS: add latest ZFS driver changes
George Melikov [Tue, 19 May 2026 16:00:17 +0000 (19:00 +0300)] 
NEWS: add latest ZFS driver changes

Signed-off-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
5 days agoNEWS: add missing ZFS driver new feature to 11.7.0
George Melikov [Tue, 19 May 2026 16:05:07 +0000 (19:05 +0300)] 
NEWS: add missing ZFS driver new feature to 11.7.0

Document native volume resizing support.

Signed-off-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
7 days agoqemu: emit channel lifecycle event
Lucas Kornicki [Tue, 19 May 2026 13:11:36 +0000 (15:11 +0200)] 
qemu: emit channel lifecycle event

Emit the channel lifecycle event on VSERPORT_CHANGE
and when refreshing virtio state.

On "org.qemu.guest_agent.0" channel state change both
agent and channel lifecycle events are emitted in that order.

Signed-off-by: Lucas Kornicki <lucas.kornicki@nutanix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agoconf,remote: add channel lifecycle domain event
Lucas Kornicki [Tue, 19 May 2026 13:11:35 +0000 (15:11 +0200)] 
conf,remote: add channel lifecycle domain event

Add support for a new domain event which can be used to track
the state of any virtio channel.

Previously one could only monitor the "org.qemu.guest_agent.0" channel
which had a dedicated agent lifecycle event. The channel lifecycle event
will be emitted alongside the agent specific one.

Signed-off-by: Lucas Kornicki <lucas.kornicki@nutanix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agobhyve: implement the domainSetMemoryParameters API
Roman Bogorodskiy [Mon, 18 May 2026 17:30:19 +0000 (19:30 +0200)] 
bhyve: implement the domainSetMemoryParameters API

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agobhyve: process: factor out rctl(8) code
Roman Bogorodskiy [Mon, 18 May 2026 16:33:12 +0000 (18:33 +0200)] 
bhyve: process: factor out rctl(8) code

Factor out all rctl(8) execution code to bhyve_rctl.c.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agobhyve: implement the domainGetMemoryParameters API
Roman Bogorodskiy [Sat, 16 May 2026 08:30:32 +0000 (10:30 +0200)] 
bhyve: implement the domainGetMemoryParameters API

Implement the domainGetMemoryParameters() API for the bhyve driver.
To parse live limits execute rctl(8) to list the active rules and parse
them.

Introduce the bhyve_rctl.c for working with rctl(8).

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agobhyve: add memtune support
Roman Bogorodskiy [Fri, 15 May 2026 14:32:54 +0000 (16:32 +0200)] 
bhyve: add memtune support

Add support of the memtune's hard_limit configuration:

  <memtune>
    <hard_limit ... >
  </memtune>

to the bhyve driver.

Just like in the block I/O tuning case, memory limits are set using the
rctl(8) tool.

Syntax for that is:

 rctl -a process:<pid>:memoryuse:deny=1073741824

Extend bhyveSetResourceLimits() to execute this command if it's
requested by the domain XML.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agocpu_map: Add DiamondRapids CPU model
Jiri Denemark [Thu, 7 May 2026 11:24:36 +0000 (13:24 +0200)] 
cpu_map: Add DiamondRapids CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agocpu_map: Add new versions of GraniteRapids CPU model
Jiri Denemark [Thu, 7 May 2026 11:23:25 +0000 (13:23 +0200)] 
cpu_map: Add new versions of GraniteRapids CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agocpu_map: Add new versions of SapphireRapids CPU model
Jiri Denemark [Thu, 7 May 2026 11:22:42 +0000 (13:22 +0200)] 
cpu_map: Add new versions of SapphireRapids CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agocpu_map: Add new versions of SierraForest CPU model
Jiri Denemark [Thu, 7 May 2026 11:21:34 +0000 (13:21 +0200)] 
cpu_map: Add new versions of SierraForest CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agocpu_map: Add new versions of ClearwaterForest CPU model
Jiri Denemark [Thu, 7 May 2026 11:20:18 +0000 (13:20 +0200)] 
cpu_map: Add new versions of ClearwaterForest CPU model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agosync_qemu_models_i386: Add missing features to translation map
Jiri Denemark [Thu, 7 May 2026 11:14:11 +0000 (13:14 +0200)] 
sync_qemu_models_i386: Add missing features to translation map

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agocpu_map: Add APX (Advanced Performance Extensions) CPUID features
Jiri Denemark [Thu, 7 May 2026 10:50:35 +0000 (12:50 +0200)] 
cpu_map: Add APX (Advanced Performance Extensions) CPUID features

QEMU commit 60caf14339262b10423e21b1d7d39ad7edec82b7

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agocpu_map: Add avx10-vnni-int CPU feature
Jiri Denemark [Thu, 7 May 2026 10:47:49 +0000 (12:47 +0200)] 
cpu_map: Add avx10-vnni-int CPU feature

QEMU commit 24a9bc108840812dfb94edc65962c1998120f77b

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agocpu_map: Add CPUID feature for MOVRS
Jiri Denemark [Thu, 7 May 2026 10:37:11 +0000 (12:37 +0200)] 
cpu_map: Add CPUID feature for MOVRS

QEMU commit f8e830300c9edeaa142fe4cc244d63770a3be4f5

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agocpu_map: Add CET related CPU features
Jiri Denemark [Thu, 7 May 2026 10:00:28 +0000 (12:00 +0200)] 
cpu_map: Add CET related CPU features

QEMU commit 2f25476ae7f3b4c28fde64584a04734b14c8fd37

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agocpu_map: Add CPUID features for AMX instructions
Jiri Denemark [Thu, 7 May 2026 09:46:48 +0000 (11:46 +0200)] 
cpu_map: Add CPUID features for AMX instructions

The features are reported in a 0x1 subleaf of 0x1e CPUID leaf.

QEMU commit 956b8f0fc38a5ead18d9bf5ceba0861627738835 (some feature were
later renamed by 85dc6147e79140f17b7e4333ec14f302bf9b5e97, which
happened in the same QEMU release so we don't need to care about the
original names).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agocpu_map: Add gmet and vmx-mbec features for nested virtualization
Jiri Denemark [Thu, 7 May 2026 09:40:57 +0000 (11:40 +0200)] 
cpu_map: Add gmet and vmx-mbec features for nested virtualization

QEMU commits 746a823a17f25393cc8c0cd1257f6dcef757bc09 and
bfff4b2ae5452463ab8c14b4a8a020288b5ff5d8

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agosync_qemu_models_i386: Convert family/model to decimal
Jiri Denemark [Wed, 20 May 2026 09:56:35 +0000 (11:56 +0200)] 
sync_qemu_models_i386: Convert family/model to decimal

QEMU defines some CPU models with hexadecimal family, but our CPU map
loading code expects decimals.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 days agosync_qemu_models_i386: Remove forgotten parentheses
Jiri Denemark [Thu, 7 May 2026 08:58:44 +0000 (10:58 +0200)] 
sync_qemu_models_i386: Remove forgotten parentheses

children variable is a list returned by getchildren().

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 days agoconf: Assert virDomainChrDeviceState and virConnectDomainEventAgentLifecycleState...
Michal Privoznik [Wed, 20 May 2026 10:42:34 +0000 (12:42 +0200)] 
conf: Assert virDomainChrDeviceState and virConnectDomainEventAgentLifecycleState enums are in sync

When QEMU driver emits agent connected/disconnected events (inside of
processSerialChangedEvent()) it declares a variable of
virDomainChrDeviceState enum, and then passes this variable to
virDomainEventAgentLifecycleNewFromObj(). But we document the agent
lifecycle state to be of virConnectDomainEventAgentLifecycleState enum.

Therefore, make sure values from
virConnectDomainEventAgentLifecycleState enum are of the same value as
those in virDomainChrDeviceState enum.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 days agocpu_map: Add Neoverse-V2 CPU model
Jonathan Davies [Tue, 19 May 2026 13:04:17 +0000 (14:04 +0100)] 
cpu_map: Add Neoverse-V2 CPU model

Add Neoverse V2 as a supported cpu model.

Signed-off-by: Jonathan Davies <jonathan.davies@nutanix.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
9 days agovirnetdevbandwidth: Only clear qdisc for defined directions
Wesley Hershberger via Devel [Thu, 7 May 2026 17:03:15 +0000 (12:03 -0500)] 
virnetdevbandwidth: Only clear qdisc for defined directions

When virNetDevBandwidthSet is called for a macvtap device in
qemu_command and qemu_hotplug, qemuDomainInterfaceSetDefaultQDisc has
been called already, setting the iface qdisc to 'noqueue'. If the
interface has an inbound-only bandwidth limit, the outgoing qdisc
on the device will be reset to the system default.

<interface type="direct">
  ...
  <bandwidth>
    <inbound average='3125000' peak='3125000'/>
  </bandwidth>
</interface>

This only clears the qdisc on an interface before a bandwidth limit is
actually set.

Closes: https://gitlab.com/libvirt/libvirt/-/work_items/875
Signed-off-by: Wesley Hershberger <wesley.hershberger@canonical.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
9 days agovirnetdevbandwidth: Split virNetDevBandwidthClear into two helpers
Wesley Hershberger via Devel [Thu, 7 May 2026 17:03:14 +0000 (12:03 -0500)] 
virnetdevbandwidth: Split virNetDevBandwidthClear into two helpers

This allows virNetDevBandwidthSet to clear only the interface's qdisc
for directions where bandwidth is defined (see the next patch)

Signed-off-by: Wesley Hershberger <wesley.hershberger@canonical.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
9 days agovirTypedParamsValidateTemplate: Fix counting of templates
Peter Krempa [Sat, 16 May 2026 07:52:30 +0000 (09:52 +0200)] 
virTypedParamsValidateTemplate: Fix counting of templates

There are 2 bugs in virTypedParamsValidateTemplate's counting of the
passed amount of templates:
 - the condition looked for empty strings rather than non-empty ones
 - the count was 1 more than the amount of templates due to use of
   post-increment directly in the condition

Fixes: 45617351585caa2c5bcc51af48bd32fd750e7afd
Closes: https://gitlab.com/libvirt/libvirt/-/work_items/880
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
9 days agoutil: virobject: Add debug refcounting output
Peter Krempa [Thu, 30 Apr 2026 05:32:30 +0000 (07:32 +0200)] 
util: virobject: Add debug refcounting output

virObject internally uses g_object which doesn't expose the internal
reference count. When debug logging we log ref/unref operations but when
reading logs it's hard to follow if a precise reference count is needed
at some points.

Add a private reference counter variable and use it in debug messages of
virObject operations.

The code is designed so that it can be disabled if ever needed since
it's just for debugging. For now let's keep it enabled.

With all the informaton added the logs look like (timestamps trimmed):

 debug : virObjectRef:424 : OBJECT_REF: obj=0x7fffac001d30 classname=qemuMonitor refs=3
 debug : virObjectUnref:392 : OBJECT_UNREF: obj=0x7fffac001d30 classname=qemuMonitor refs=2
 debug : virObjectNew:264 : OBJECT_NEW: obj=0x7fffac00db70 classname=virDomainEventAgentLifecycle
 debug : virObjectUnref:392 : OBJECT_UNREF: obj=0x7fffac00db70 classname=virDomainEventAgentLifecycle refs=0
 debug : vir_object_finalize:328 : OBJECT_DISPOSE: obj=0x7fffac00db70 classname=virDomainEventAgentLifecycle

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 days agovirNetClientStreamEventRemoveCallback: Add debug log
Peter Krempa [Wed, 29 Apr 2026 11:37:58 +0000 (13:37 +0200)] 
virNetClientStreamEventRemoveCallback: Add debug log

Log when removing event callback including internal state.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 days agoremoteClientFree: Add debug log of parameters
Peter Krempa [Wed, 29 Apr 2026 11:37:06 +0000 (13:37 +0200)] 
remoteClientFree: Add debug log of parameters

Add a debug log when remote client is beng disposed of.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 days agodaemonRemoveClientStream: Add debug log
Peter Krempa [Thu, 14 May 2026 15:43:05 +0000 (17:43 +0200)] 
daemonRemoveClientStream: Add debug log

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 days agoutil: object: Add class name to the Ref/Unref/Dispose debug messages
Peter Krempa [Thu, 30 Apr 2026 05:56:54 +0000 (07:56 +0200)] 
util: object: Add class name to the Ref/Unref/Dispose debug messages

Since the object stores the pointer to the parent class object
internally we can add the name of the class of the object to the debug
messages. Since the debug messages are based on probe points propagate
it into the probe point rather than adding separate debug message.

For virObjectUnref, this also fixes the ordering of the messages to be
'unref->dispose' by invoking the PROBE before unref rather than the
other way around which didn't make sense in the logs and wouldn't allow
accessing the class pointer from the already disposed-of object.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 days agoutil: object: Downgrade PROBE points to PROBE_DEBUG
Peter Krempa [Thu, 30 Apr 2026 05:41:14 +0000 (07:41 +0200)] 
util: object: Downgrade PROBE points to PROBE_DEBUG

The debug messages related to PROBE points in object handling don't
really need to be logged with the 'info' priority. Downshift them to
'debug'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 days agoutil: probe: Add 'PROBE_DEBUG'
Peter Krempa [Thu, 30 Apr 2026 05:39:00 +0000 (07:39 +0200)] 
util: probe: Add 'PROBE_DEBUG'

The standard 'PROBE' macro uses the 'info' priority for the log entry
corresponding to the probe point. While in some cases it makes sense to
log above debug priority in others it does not. Add the possibility to
pick a lower priority level.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 days agolibvirt_probes: Fix alignment of 'virobject' probe points
Peter Krempa [Thu, 30 Apr 2026 05:44:31 +0000 (07:44 +0200)] 
libvirt_probes: Fix alignment of 'virobject' probe points

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 days agoremote_driver: Don't leak opaque pointer passed to 'virStreamEventAddCallback'
Peter Krempa [Thu, 14 May 2026 15:19:55 +0000 (17:19 +0200)] 
remote_driver: Don't leak opaque pointer passed to 'virStreamEventAddCallback'

In the implementation of the virStream events in the remote driver, the
freeing of the passed opaque data for the callback was guarded by:

  if (!cbdata->cb && cbdata->ff)
     (cbdata->ff)(cbdata->opaque);

thus if the 'cb' is passed to 'virStreamEventAddCallback' the private
data would never be freed once 'virStreamEventRemoveCallback' is called.

The issue can be reproduced both in client applications which would
register the stream callback and also in the libvirt daemons, when
modular daemons are used. The virStream remote driver client code is in
such deployments also used to tunnel requests from the hypervisor daemon
(virtqemud) to sub-daemons (virstoraged).

In those cases the leak is amplified as the stream event callback is
internally used to do the tunnelling and the daemon dispatch code stores
a reference to the 'virNetClient' object associated with the connection.
As this causes the last reference on the virNetClient object to be still
active, the corresponding connection to the storage daemon isn't closed
either, leaking a FD both in virtqemud and virtstoraged.

Internally the data is stored in 'struct remoteStreamCallbackData' which
is defined only in 'remote_driver.c' and there's no code which would
update the 'cb' field, thus the leak can't be avoided.

Remove the check for 'cb'. My assumption is that this was supposed to
mimic the 'dispatching' field  in 'util/fdstream.c' or similar logic in
other dispatch functions.

The patch also adds debug statements which I've used to trace this.

The leak of a connection in 'virtqemud' has the following backtrace
under valgrind (note that the pointer is considered reachable and thus
this isn't visible in default config):

==3678343== 136 bytes in 1 blocks are still reachable in loss record 2,680 of 2,964
==3678343==    at 0x48FC6CD: calloc (vg_replace_malloc.c:1616)
==3678343==    by 0x4ED8A91: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.8600.5)
==3678343==    by 0x5019CA2: g_type_class_get (in /usr/lib64/libgobject-2.0.so.0.8600.5)
==3678343==    by 0x5001011: g_object_new_with_properties (in /usr/lib64/libgobject-2.0.so.0.8600.5)
==3678343==    by 0x5001EA0: g_object_new (in /usr/lib64/libgobject-2.0.so.0.8600.5)
==3678343==    by 0x499E653: virObjectNew (virobject.c:252)
==3678343==    by 0x499EA0F: virObjectLockableNew (virobject.c:274)
==3678343==    by 0x4A84651: virNetClientStreamNew (virnetclientstream.c:144)
==3678343==    by 0x4AE82AE: remoteStorageVolUpload (remote_client_bodies.h:8242)
==3678343==    by 0x4BED13D: virStorageVolUpload (libvirt-storage.c:1809)
==3678343==    by 0x4043539: remoteDispatchStorageVolUpload (remote_daemon_dispatch_stubs.h:20248)
==3678343==    by 0x4043539: remoteDispatchStorageVolUploadHelper (remote_daemon_dispatch_stubs.h:20218)
==3678343==    by 0x4A89A2C: virNetServerProgramDispatchCall (virnetserverprogram.c:423)
==3678343==    by 0x4A89A2C: virNetServerProgramDispatch (virnetserverprogram.c:299)

Resolves: https://redhat.atlassian.net/browse/RHEL-170773
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
10 days agovirauth: Verify virConnectAuth::cb is set in virAuthGetPasswordPath()
Michal Privoznik [Fri, 15 May 2026 12:51:15 +0000 (14:51 +0200)] 
virauth: Verify virConnectAuth::cb is set in virAuthGetPasswordPath()

Simirarly to virAuthGetUsernamePath() check whether callback used
to collect credentials is actually set before calling it. This
bug is easily reproducible, for instance as:

  int credtype[] = { VIR_CRED_PASSPHRASE };
  virConnectPtr conn = virConnectOpenAuth("esx://root@example.com/",
                                          &(virConnectAuth){
                                          .credtype = credtype,
                                          .ncredtype = 1,
                                          .cb = NULL
                                          },
                                          0);

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
10 days agoNEWS: Add information about VMWare domains having different UUIDs
Martin Kletzander [Thu, 14 May 2026 15:35:04 +0000 (17:35 +0200)] 
NEWS: Add information about VMWare domains having different UUIDs

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
10 days agoesx: Track VMs by instanceUuid instead of UUID
Martin Kletzander [Tue, 12 May 2026 10:16:54 +0000 (12:16 +0200)] 
esx: Track VMs by instanceUuid instead of UUID

The difference is that the usual UUID is supposed to be unique per host
and instanceUuid should be unique across the whole cluster.  One could
think of them as HUID and CUID (as the first "U" does apparently mean
something else in the Broadcom world).  That _would_ be fine for our
scenario.  However, that piece of information turns out to be false as
well and the UUID we were using (`config.uuid`, or in VMX the
`uuid.bios`) can be the same in two machines on the same host.

Fortunately the `FindByUuid()` function can also search for VMs based on
their `instanceUuid`, dictated by the so far omitted third parameter.
Unfortunately that parameter is not parsed (or at least properly) before
vSphere API 4.0 (the documentation says 2.0, but we are not using that
namespace and 4.0 is the lowest we can target), which we are not
specifying in the server returns a 500 HTTP error if we use the
`instanceUuid` parameter.

So this patch adds the `SOAPAction: urn:vim25/4.0` header to the cURL
requests which makes that `FindByUuid()` function work even with the
`instanceUuid` set, but without any extra labor.

After that this patch also changes all UUIDs to be parsed from the
`config.instanceUuid` (or `vc.uuid` in the VMX, but there's a fallback
to the old `uuid.bios`) and adjusts tests accordingly.

To give users (and management applications) the possibility to revert
back to the previous (legacy) behaviour a new URI query parameter is
introduced, called `legacy_uuid` which, if set to `1`, still keeps the
code working as it did before this patch.

Last, but not least it changes the parameter to aforementioned function
to be true (unless the legacy behaviour is requested, of course) and
henceforth all searching ought to be done with the more unique ID.

Resolves: https://redhat.atlassian.net/browse/RHEL-174300
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
10 days agovirsh: Provide no auth callbacks for bash completer
Michal Privoznik [Thu, 14 May 2026 14:32:30 +0000 (16:32 +0200)] 
virsh: Provide no auth callbacks for bash completer

Our bash completion script parses (partially incomplete) command
line and looks for two arguments: --readonly and --connect
because in the next step it executes virsh with those two
arguments like this:

  virsh --readonly --connect $URI complete -- "text to complete"

Now, whenever virsh sees connection URI specified on its cmd line
it connects to it right away (before executing any command). This
happens inside virshConnect(). Here, virConnectOpenAuth() is
called with the default auth callback (virConnectAuthPtrDefault).
In majority of the cases this is desirable, as it might ask user
for credentials (password for example). But in case of bash
completion this is not desired because bash completion script
must not expect users to input anything (that's why we even
close stdin in cmdComplete()).

Therefore, when connecting from virsh that's executed by the bash
completion script provide no auth callbacks to prevent virsh from
asking for credentials.

Resolves: https://gitlab.com/libvirt/libvirt/-/work_items/879
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Richrad W.M. Jones <rjones@redhat.com>
10 days agovirnetlibsshsession: Check later for auth callback in virNetLibsshAuthenticatePassword()
Michal Privoznik [Fri, 15 May 2026 07:53:10 +0000 (09:53 +0200)] 
virnetlibsshsession: Check later for auth callback in virNetLibsshAuthenticatePassword()

The first thing that virNetLibsshAuthenticatePassword() does is
read password from config file. For this it does not need auth
callback. If that password fails to authenticate then
corresponding callback from the auth callback is called. This is
actual place where auth callback should be checked for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Richrad W.M. Jones <rjones@redhat.com>
10 days agovirnetsshsession: Don't check for auth callbacks in virNetSSHAuthenticatePassword()
Michal Privoznik [Thu, 14 May 2026 18:22:04 +0000 (20:22 +0200)] 
virnetsshsession: Don't check for auth callbacks in virNetSSHAuthenticatePassword()

For the VIR_NET_SSH_AUTH_PASSWORD authentication mechanism the
virNetSSHAuthenticatePassword() is called. Inside it,
virAuthGetPasswordPath() is called to obtain password. Firstly
reading from our auth.conf file is attempted and if that fails
then corresponding callback from virConnectAuthCallbackPtr is
called. But virAuthGetPasswordPath() checks whether the callback
is NULL or not. There is no need for
virNetSSHAuthenticatePassword() to check it too. Drop the
duplicate check.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Richrad W.M. Jones <rjones@redhat.com>
12 days agobhyve: add agent support
Roman Bogorodskiy [Tue, 5 May 2026 05:22:46 +0000 (07:22 +0200)] 
bhyve: add agent support

Implement QEMU Guest Agent support for bhyve. In bhyve it can configured
using the virtio-console device.

This change covers only two APIs using the agent:

 - DomainQemuAgentCommand -- the most generic one.
 - DomainGetHostname -- extended to support not only DHCP lease source,
   but an agent as well.

It shares the qemu agent implementation with the qemu driver.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
12 days agoqemu: move qemu_agent.c to hypervisor/
Roman Bogorodskiy [Wed, 13 May 2026 16:22:57 +0000 (18:22 +0200)] 
qemu: move qemu_agent.c to hypervisor/

To prepare for the qemu agent support for the bhyve driver,
move the implementation from qemu/ to hypervisor. This way
this implementation can be shared across multiple drivers.

The move is mostly mechanical except qemuAgentOpen()
which now accepts the "timeout" argument for the agent timeout.
As the original code used QEMU_DOMAIN_PRIVATE() to access
the agent timeout value, this change allows to make the code
driver-independent.

qemuAgentOpenUnix() is wrapped with #ifndef WIN32 so it does not fail on
mingw.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 days agoNEWS: document resctrl energy monitoring
Jedrzej Wasiukiewicz [Thu, 14 May 2026 14:41:06 +0000 (16:41 +0200)] 
NEWS: document resctrl energy monitoring

Signed-off-by: Jedrzej Wasiukiewicz <jedrzej.wasiukiewicz@intel.com>
Signed-off-by: Christopher M. Cantalupo <christopher.m.cantalupo@intel.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 days agoqemu: resctrl energy counters via domstats
Jedrzej Wasiukiewicz [Thu, 14 May 2026 14:41:05 +0000 (16:41 +0200)] 
qemu: resctrl energy counters via domstats

Added energy reporting from resctrl PERF_PK_MON through domstats:
  cpu.energy.monitor.count=1
  cpu.energy.monitor.0.name=vcpus_0
  cpu.energy.monitor.0.vcpus=0
  cpu.energy.monitor.0.pkg.count=2
  cpu.energy.monitor.0.pkg.0.id=0
  cpu.energy.monitor.0.pkg.0.core_energy=0.000000
  cpu.energy.monitor.0.pkg.0.activity=0.000000
  cpu.energy.monitor.0.pkg.1.id=1
  cpu.energy.monitor.0.pkg.1.core_energy=2.888203
  cpu.energy.monitor.0.pkg.1.activity=1.718601

Changes:
 - Added VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_* macros to libvirt-domain.h
 - Added qemuDomainGetStatsEnergy() to qemu_driver.c

Signed-off-by: Jedrzej Wasiukiewicz <jedrzej.wasiukiewicz@intel.com>
Signed-off-by: Christopher M. Cantalupo <christopher.m.cantalupo@intel.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 days agoconf: add energytune to domain XML
Jedrzej Wasiukiewicz [Thu, 14 May 2026 14:41:04 +0000 (16:41 +0200)] 
conf: add energytune to domain XML

The new XML element is <energytune> under <cputune> following earlier pattern for
resctrl features (cachetune, memorytune). Energytune doesn't currently support
the "tuning" part, only monitoring. I added it as energytune for consistency with
cache and memory features, keeping all resctrl handling under cputune. This also makes
sense with current resctrl architecture - all monitoring groups are part of an
allocation group.

Changes:
 - Added <energytune> parsing to domain_conf.c
 - Added schema definition in domaincommon.rng
 - Documented the element in formatdomain.rst
 - Added energytune test

Signed-off-by: Jedrzej Wasiukiewicz <jedrzej.wasiukiewicz@intel.com>
Signed-off-by: Christopher M. Cantalupo <christopher.m.cantalupo@intel.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 days agoconf: report energy monitoring in host capabilities
Jedrzej Wasiukiewicz [Thu, 14 May 2026 14:41:03 +0000 (16:41 +0200)] 
conf: report energy monitoring in host capabilities

Expose PERF_PKG_MON energy monitoring capabilities in the host
capabilities XML.
<energy>
  <monitor maxMonitors='576'>
    <feature name='core_energy'/>
    <feature name='activity'/>
  </monitor>
</energy>

Changes:
 - Add virCapabilitiesFormatEnergy() to emit <energy> XML block
 - Add virCapabilitiesInitEnergy() to init from PERF_PKG_MON info
 - Add <energy> element and energyMonitorFeature to capability.rng
 - Update qemu_driver to support VIR_RESCTRL_MONITOR_TYPE_ENERGY
 - Add virCapsHostEnergy struct

Signed-off-by: Jedrzej Wasiukiewicz <jedrzej.wasiukiewicz@intel.com>
Signed-off-by: Christopher M. Cantalupo <christopher.m.cantalupo@intel.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 days agoutil: add PERF_PKG_MON energy monitoring support in virresctrl
Jedrzej Wasiukiewicz [Thu, 14 May 2026 14:41:02 +0000 (16:41 +0200)] 
util: add PERF_PKG_MON energy monitoring support in virresctrl

Linux 7.0 introduced in resctrl PERF_PKG_MON interface that exposes per-package
energy and performance counters. This patch extends virresctrl implementation
to discover and read energy counters from this new resource type.
(core_energy - Joules, activity - Farads)

Changes:
 - Add Energy features allow-list virResctrlEnergyFeatures
   since PERF_PKG_MON is not prefix-based.
 - Added perf_monitor_info to _virResctrlInfo to contain _virResctrlInfo capabilities
 - New virResctrlGetPerfMonitorInfo following earlier virResctrlGetMonitorInfo
   to check new resource capabilities
 - Added VIR_RESCTRL_MONITOR_TYPE_ENERGY and mapped it to energy allow-list
 - Added dvals/ndvals pair to _virResctrlMonitorStats to support floating-point
   counters and integer counters in single monitor (to support integer perf counters
   in the future).
 - Added floating-point read + parse in virResctrlMonitorGetStats for energy counters
 - Stubbed VIR_RESCTRL_MONITOR_TYPE_ENERGY in qemu_driver

Signed-off-by: Jedrzej Wasiukiewicz <jedrzej.wasiukiewicz@intel.com>
Signed-off-by: Christopher M. Cantalupo <christopher.m.cantalupo@intel.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 days agoutil: virGetSubIDs: do not limit file size
Ján Tomko [Tue, 12 May 2026 11:10:43 +0000 (13:10 +0200)] 
util: virGetSubIDs: do not limit file size

On systems with many users, this file can be larger than BUFSIZ.
Since the file should only be editable by root and virFileReadAll
reallocates the buffer in increments as needed as opposed to
allocating for 'maxlen' upfront, set the maximum to INT_MAX.

https://gitlab.com/libvirt/libvirt/-/work_items/874

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
13 days agoesx: include viralloc.h for VIR_FREE usage
Ján Tomko [Thu, 14 May 2026 21:29:00 +0000 (23:29 +0200)] 
esx: include viralloc.h for VIR_FREE usage

Fixes: af83ac00eba56e50de70d7d29d1dc7f726786aa5
Signed-off-by: Ján Tomko <jtomko@redhat.com>
13 days agoRevert "esx: switch VIR_FREE->g_free in esx*Free*()"
Martin Kletzander [Thu, 14 May 2026 13:52:53 +0000 (15:52 +0200)] 
Revert "esx: switch VIR_FREE->g_free in esx*Free*()"

This reverts commit 443c79dd7f7d4051fc0084baaa6c56a55d2aace4.

Change from VIR_FREE() to g_free meant there is a possible double free
when there is an error during parsing because the parsing it done
directly into the parsedUri member of the esxPrivate, free'd when it
fails and then the caller calls free on it again.  Changing back to
VIR_FREE() means there is no double free and no crash.

Reproducible easily with `virsh -c esx://l?no_verify=2`.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 weeks agocputest: Detect unused files
Michal Privoznik [Thu, 7 May 2026 09:25:42 +0000 (11:25 +0200)] 
cputest: Detect unused files

Use newly introduced testutils APIs to detect unused files.
This is pretty much straightforward, except for one small thing:
some test cases depend on QEMU (and are NOP if built without it).
Hence the condition in testCaseEnumerate().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agocputestdata: Drop unused files
Michal Privoznik [Thu, 7 May 2026 09:38:54 +0000 (11:38 +0200)] 
cputestdata: Drop unused files

There are couple of files under tests/cputestdata/ that are not
used by any test case:

1) ppc64-guest-host-model.xml - unused since its introduction in
   v1.2.19-rc1~31
2) ppc64-host+guest-host-model.xml - Same
3) x86_64-bogus-vendor.xml - Introduced in v0.8.7~195 under
   slightly different name, then renamed to the current name (in
   v3.1.0-rc1~3) but never used actually.

Just drop these three files.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agonetworkxmlconftest: Detect unused files
Michal Privoznik [Wed, 6 May 2026 12:45:25 +0000 (14:45 +0200)] 
networkxmlconftest: Detect unused files

Use newly introduced testutils APIs to detect unused files.
This is pretty much straightforward except for one test case:
hostdev. This test case queries sysfs under the hood and thus is
expected to succeed on Linux and fail everywhere else. Though,
hostdev.expect.xml is thus used on Linux only. Therefore, do not
collect it on non-Linux platforms.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agonetworkxmlconfdata: Remove passthrough-pf.conf
Michal Privoznik [Wed, 6 May 2026 13:42:13 +0000 (15:42 +0200)] 
networkxmlconfdata: Remove passthrough-pf.conf

The passthrough-pf.conf file is not used really, because the test
case is defined as:

  DO_TEST_VALIDATE_ERROR("passthrough-pf");

meaning the test is expected to fail in XML validation phase.
Hence, no .conf file is ever generated for it. Remove the file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agoqemuxmlconftest: Switch to virTestEnumerateTestCases()
Michal Privoznik [Wed, 6 May 2026 12:27:11 +0000 (14:27 +0200)] 
qemuxmlconftest: Switch to virTestEnumerateTestCases()

The qemuxmlconftest detects unused files in qemuxmlconfdata/
directory. But it uses its own implementation for that. But now
that there's a generic implementation available, switch to that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agotestutils: Introduce unused file detection
Michal Privoznik [Wed, 6 May 2026 12:05:43 +0000 (14:05 +0200)] 
testutils: Introduce unused file detection

This is basically a generalized version of what we have in
qemuxmlconftest (functions testConfXMLEnumerate(),
testQemuConfMarkUsed() and testConfXMLCheck()). The idea is to
reuse the code in other tests.

There's one slight difference to the original - while
qemuxmlconftest always allocated the hash table, in this
generalized version NULL table is okay.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agoqemuDomainSetIOThreadParams: Move typed parameter validation to top level
Peter Krempa [Thu, 23 Apr 2026 08:51:22 +0000 (10:51 +0200)] 
qemuDomainSetIOThreadParams: Move typed parameter validation to top level

This will allow introspecting them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agoqemuDomainSetSchedulerParameters: Make typed parameters introspectable
Peter Krempa [Thu, 23 Apr 2026 11:54:49 +0000 (13:54 +0200)] 
qemuDomainSetSchedulerParameters: Make typed parameters introspectable

For making introspection possible both qemuDomainSetSchedulerParameters
and qemuDomainSetSchedulerParametersFlags need to have the check
present.

Refactor the flag validation to make it present in both APIs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agoutil: hostmem: Make parameters for 'virHostMemSetParameters' introspectable
Peter Krempa [Thu, 23 Apr 2026 11:13:52 +0000 (13:13 +0200)] 
util: hostmem: Make parameters for 'virHostMemSetParameters' introspectable

Refactor the validation using 'virTypedParamsValidateTemplate' and
export the template so that 'qemuNodeSetMemoryParameters' can expose
them via introspection.

In addition since 'virHostMemSetParameters' is conditionally compiled,
platforms which don't support it will not expose given params.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agoqemu: Reimplement 'qemuDomainValidateBlockIoTune' using 'virTypedParamsValidateTemplate'
Peter Krempa [Thu, 23 Apr 2026 11:28:43 +0000 (13:28 +0200)] 
qemu: Reimplement 'qemuDomainValidateBlockIoTune' using 'virTypedParamsValidateTemplate'

Make the block io tuning params introspectable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agoqemu: migration: Use 'virTypedParamsValidateTemplate' for migration params
Peter Krempa [Fri, 24 Apr 2026 12:53:13 +0000 (14:53 +0200)] 
qemu: migration: Use 'virTypedParamsValidateTemplate' for migration params

Refactor the code to use the new helper for validating migration params
and making them later available for introspection.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 weeks agoutil: typedparam: Introduce 'virTypedParamsValidateTemplate'
Peter Krempa [Wed, 22 Apr 2026 08:11:31 +0000 (10:11 +0200)] 
util: typedparam: Introduce 'virTypedParamsValidateTemplate'

While 'virTypedParamsValidate', which uses varargs to pass the template
to validate parameters against, is convenient for single uses we have
multiple occasions where we want to validate the same list of parameters
in muliple places. We use either a macro which expands to the parameter
list in place or a function which encapsulates the validation.

For introspection of input typed parameters we'll need to have the list
of supported typed parameters in each function which uses them as input
and either of the approaches is inconvenient for generating the
introspection parts.

Refactor 'virTypedParamsValidate', to split the actual validation
internals into ''virTypedParamsValidateInternal' and create two
wrappers:
 - 'virTypedParamsValidate' which uses varargs
 - 'virTypedParamsValidateTemplate' which uses an array of structs
    containing the template.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>