Commit Graph
54001 Commits
Author SHA1 Message Date
Peter Krempa 189f1bbec3 qemuConnectDomainQemuMonitorEventRegister: Add top-level flag validation
The implementation uses 'virDomainQemuMonitorEventStateRegisterID'
internally. To have a top level flag validation for the upcoming flag
introspection export the supported flags as a macro and add a
'virCheckFlags'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:10 +02:00
Peter Krempa c86f0e31f5 qemuDomainQemuMonitorCommand: Add top-level flag validation
The implementation uses 'qemuDomainQemuMonitorCommandWithFiles'
internally. To have a top level flag validation for the upcoming flag
introspection export the supported flags as a macro and add a
'virCheckFlags'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:10 +02:00
Peter Krempa 6a0e6a5502 qemuDomainManagedSaveDefineXML: Add top-level flag validation
The implementation for managed save uses 'qemuDomainSaveImageDefineXML'
internally which validates the flags. To have a top level flag
validation for the upcoming flag introspection export the supported
flags as a macro and add a 'virCheckFlags' to
'qemuDomainManagedSaveDefineXML'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:10 +02:00
Peter Krempa 7fbfb59938 qemuDomainDetachDeviceAlias: Move 'flags' validation to top level
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:10 +02:00
Peter Krempa 40629050b5 qemuDomainGetLaunchSecurityInfo: Move flag check to top level
The flag check inside 'qemuDomainGetSEVInfo' makes no sense because it
only validates the 'VIR_TYPED_PARAM_STRING_OKAY' which is not actually
used.

Remove the 'flags parameter from 'qemuDomainGetSEVInfo' and validate
flags at 'qemuDomainGetLaunchSecurityInfo'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:10 +02:00
Peter Krempa c707c1d17d qemu: snapshot: Move flag checks to top level functions
Move the 'virCheckFlags' invocations to the top level driver function so
that they become available for introspection.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:10 +02:00
Peter Krempa ce9b94437c qemuDomainRestore(Flags|Params): Refactor flag checking
Create QEMU_DOMAIN_RESTORE_FLAGS define which collects all the flags
used by either of the implementations of the 'Restore' API and move the
flag checking into the implementation function so that it's available
later for introspection.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:10 +02:00
Peter Krempa 9f6ff63d3b qemu: checkpoint: Move 'virCheckFlags' to top level functions
Move the flag check to the top level to allow programatic introspection
of supported flags.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:10 +02:00
Peter Krempa cf53aafa70 qemu: dump: Move 'virCheckFlags' to top level functions
Move the flag check to the top level to allow programatic introspection
of supported flags.

Extract the supported flags as a macro so that they can be reused in
both coredump APIs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:09 +02:00
Peter Krempa a55ca07c8a qemu: attach/detach device: Move 'virCheckFlags' to top level functions
Move the flag check to the top level to allow programatic introspection
of supported flags.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:09 +02:00
Peter Krempa 227f4570d8 qemu: backup: Move 'virCheckFlags' to top level functions
Move the flag check to the top level to allow programatic introspection
of supported flags.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:09 +02:00
Peter Krempa a5c6aff2c1 virNodeSuspend: Remove unused 'flags'
Remove the unused argument and bump the 'virCheckFlags' calls to the top
level.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:09 +02:00
Peter Krempa f4b5da14b6 virHostMemGet(Stats|Parameters): Remove unused 'flags'
The utility functions which get memory stats don't actually use the
flags. Remove the argument and move the 'virCheckFlags' to driver
implementation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:09 +02:00
Peter Krempa e8ad1aec1d virHostCPUGet(Map|Stats): Remove unused 'flags'
The utility functions which get CPU map and stats don't actually use the
flags. Remove the argument and move the 'virCheckFlags' to driver
implementation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:09 +02:00
Peter Krempa 197a368de5 scripts: check-symfile: Allow also symbols in 'readonly' section
Validate also variables exported as 'extern' e.g. from the util
submodule.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:09 +02:00
Peter Krempa 6756e1d193 util: typedparam: Refactor and fix typed param validation
'virTypedParamsValidate' has special logic to handle the internal
VIR_TYPED_PARAM_UNSIGNED type, but unfortunately the implementation of
the error which is reported is flawed as it only updated the
'expecttype' string when the type actually matched. In cases when it
didn't we'd report the following error:

  error: invalid argument: invalid type 'string' for parameter 'poll_shrink', expected '(null)'

To fix it we can re-implement the validation part by using
virTypedParamValidateType simply by adding the VIR_TYPED_PARAM_UNSIGNED
to 'virTypedParameterTypeToString' handling which is now private and
adding logic to allow either one of the unsigned types, which allows us
to use the same function in both cases, simplifying the code.

Fixes: 07652410a7
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:09 +02:00
Peter Krempa acc7c387ee util: typedparam: Unexport virTypedParameterTypeFromString/virTypedParameterTypeToString
The enum handler implementation has already some special values,
upcoming patches will add more so keep the only internal to avoid
surprises.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:09 +02:00
Peter Krempa a8a6fd26dc util: Replace open-coded internals of VIR_TYPED_PARAMS_DEBUG with 'virTypedParamDebugstr'
Replace the internals of the macro by a function so that
'virTypedParameterToString' doesn't need to be exported as it also
adds mappings for values which don't exist in the public API.

This change also prevents a NULL to be passed to string formatters in
case when the caller sends an unknown typed parameter type as we now
also make sure that the type is in range.

Fixes: 54dd75fd97
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:09 +02:00
Peter Krempa 043d809613 util: virTypedParamValidateType: Don't report unknown typed parameter type as '(null)'
If the actual type of the typed parameter is an invalid number the type
checker would still attempt to convert it to a string resulting in an
attempt to print a NULL string. libc saves us from the crash but the
error message is still wrong. Fix it.

Fixes: 54dd75fd97
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:09 +02:00
Peter Krempa 0e35fe608c util: typedparam: Convert VIR_TYPED_PARAM_CHECK_TYPE into a function
Create 'virTypedParamValidateType' which will use the same logic
encapsulated in a function. Use the error message wording from
'virTypedParamsValidate' as it contains less fluff.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:09 +02:00
Peter Krempa ad40d3c822 qemu: driver: Unify coding style
Reformat qemu_driver.c to use the contemporary coding style. It will
help also for the upcoming script for generating list of supported flags
for APIs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:09 +02:00
Peter Krempa cf5b4bbaef remote_protocol-structs: fix mis-aligned 'remote_domain_set_throttle_group_args'
Fixes: a10b3ffebb
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-14 12:13:09 +02:00
Denis V. Lunev 1b32fbdfca virStorageSource: note that capacity/allocation/physical are stale caches
These three fields are cached values that do not reflect reality unless
the caller refreshes them. 'allocation' is in addition ultra-unreliable:
any guest write into a previously unallocated part of a sparse image
invalidates it, even right after a refresh.

Document this on the struct so new callers do not trust the values.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-12 13:39:23 +02:00
Akash Kulhalli via Devel 19e1dcf860 API/qemu: add async unplug flag to virDomainSetVcpu
Add VIR_DOMAIN_SETVCPU_ASYNC_UNPLUG for virDomainSetVcpu().

Define a dedicated virDomainSetVcpuBehaviour flag type and wire the
new flag through the QEMU driver. As with setvcpus async unplug,
success indicates request acceptance while final completion is
reported by the vcpu-removed event.

Update the API documentation and add virsh support for the async path to
the setvcpu subcommand.

Signed-off-by: Akash Kulhalli <akash.kulhalli@oracle.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-12 13:39:07 +02:00
Akash Kulhalli via Devel fb2791327e API/qemu: add async unplug flag to virDomainSetVcpusFlags
Add VIR_DOMAIN_VCPU_ASYNC_UNPLUG for virDomainSetVcpusFlags().

With this flag, success indicates that QEMU accepted the unplug
request, while final completion is reported by the vcpu-removed
event. Rejected requests continue to be reported by the
device-removal-failed event.

Wire the flag through the QEMU driver, document its semantics, and
add virsh support for the async path in the setvcpus subcommand.

Signed-off-by: Akash Kulhalli <akash.kulhalli@oracle.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-12 13:39:07 +02:00
Akash Kulhalli via Devel 6f4e3b40a8 qemu: thread async vcpu unplug through internal helpers
Thread an async_unplug flag through the internal QEMU vCPU unplug
helpers.

When set, the unplug path returns after QEMU accepts the device
deletion request and leaves final completion to the existing
DEVICE_DELETED handling routines.

All callers still pass false, so this does not change behaviour yet.

Signed-off-by: Akash Kulhalli <akash.kulhalli@oracle.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-12 13:39:07 +02:00
Akash Kulhalli via Devel 03d339dc03 qemu: emit vcpu-removed event on unplug completion
Emit the vcpu-removed event when QEMU vCPU unplug completes.

Hook this into qemuDomainRemoveVcpu(), which covers both the
synchronous completion path and the DEVICE_DELETED-driven alias
removal path.

Some architectures may have multiple vcpus grouped under a single qemu
vcpu object; on those platforms a `vcpu-removed` event will be emitted
for each vcpu that is removed from this group.

Signed-off-by: Akash Kulhalli <akash.kulhalli@oracle.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-12 13:39:07 +02:00
Akash Kulhalli via Devel bbc7d1a2a0 conf,remote: add vcpu-removed domain event
Add a new domain event for completed vCPU removal.

Wire the event through the internal event framework and extend the
remote protocol so remote clients can receive it. Update virsh and
the event-test example accordingly.

The event is not emitted anywhere yet.

Signed-off-by: Akash Kulhalli <akash.kulhalli@oracle.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-12 13:39:07 +02:00
Peter Krempa c3af80575b test: qemu: Fix error message when populating fd groups
The 'new->fds' array is not yet initialized at the point where the check
if the FD is occupied happens so the error would always report that FD
'0' is in use. Use 'new->testfds' instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2026-05-12 13:37:11 +02:00
Peter Krempa 59197dc16f syntax-check: Enforce no linebreaks in VIR_WARN messages
Since VIR_WARN doesn't use translatable messages, the
'sc_prohibit_error_message_on_multiple_lines' check doesn't catch those.

Introduce another check for VIR_WARN.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2026-05-12 13:36:53 +02:00
Peter Krempa 9bf824b506 Don't break up strings for VIR_WARN messages
The 'warn' level messages are logged in the default settings so may end
up in something which the user looks for. Random line breaks prevent
grepping for the message.

Similarly to 'error' level messages remove the arbitrary line breaks in
the source to make the messages greppable in the source.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2026-05-12 13:36:53 +02:00
Paolo Bonzini 543280d8c8 sync_qemu_models_i386: add new features for nested virtualization
These features do not appear yet in the CPU models, but
will be added soon:

https://lore.kernel.org/qemu-devel/20260330193428.1663253-2-jon@nutanix.com/
https://lore.kernel.org/qemu-devel/20260330193428.1663253-4-jon@nutanix.com/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2026-05-07 11:06:10 +02:00
Michal Privoznik d19d088a3f qemu: capabilities: Bump minimum qemu to qemu-7.2
Following minimum versions are needed based on our support policy:

           Alpine Linux 3.23: 9.0
             CentOS Stream 9: 10.1
                   Debian 12: 7.2
                   Fedora 43: 10.1
          openSUSE Leap 15.6: 8.2
                Ubuntu 24.04: 8.2
               FreeBSD ports: 11.0
              macOS homebrew: 11.0
              macOS macports: 11.0

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-06 10:47:13 +02:00
Michal Privoznik 3fb4292016 qemucapabilitiesdata: domaincapsdata: Drop old capabilities
Soon the minimal version is going to be bumped to QEMU-7.2. Drop
older capabilities, which are unused anyways, thanks to previous
cleanups.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-06 10:47:13 +02:00
Michal Privoznik ba6e82c14c qemuxmlconftest: Switch sgx-epc to 11.0.0
The sgx-epc test case is currently pinned to capabilities of that
QEMU-7.0. Well, soon the minimal version of QEMU is going to be
bumped. But thanks to previous commit the capabilities of 11.0.0
version support SGX too. Switch the test case to the newer
capabilities.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-06 10:47:13 +02:00
Michal Privoznik 06bbb14170 qemucapabilitiesdata: Add SGX support to caps_11.0.0_x86_64
Detecting SGX support is done in two ways and both have to
succeed in order for caps to have the capability:

  1) the sgx-epc device needs to be present,
  2) the query-sgx-capabilities command needs to return data
     instead of an error.

So far, the only caps file that meets both requirements is
caps_7.0.0_x86_64. Soon the minimal version is going to be bumped
to QEMU-7.2. But caps_11.0.0_x86_64 has the device and the only
thing missing is the proper reply to the monitor command.
Therefore, create new qemu_11.0.0_x86_64+sgx capabilities with
reply to query-sgx-capabilities command copied from caps_7.0.0.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-06 10:47:13 +02:00
Michal Privoznik 142675a00a qemuxmlconftest: Drop ppc64-default-cpu-kvm-pseries-2.7 test cases
Both ppc64-default-cpu-kvm-pseries-2.7 and
ppc64-default-cpu-tcg-pseries-2.7 test cases rely on pseries-2.7
machine type. It was removed in QEMU-7.2. Soon the minimal
version is going to be bumped to QEMU-7.2 rendering those tests
obsolete. Drop them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-06 10:47:12 +02:00
Michal Privoznik 3f922292c0 qemuxmlconftest: Drop old cpu model expansion tests
Soon the minimal version is going to be bumped to QEMU-7.2. Drop
older cpu model expansion test cases (6.2.0, 7.0.0, 7.1.0).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-06 10:47:12 +02:00
Michal Privoznik 642d4e7b41 qemuxmlconftest: Drop disk-network-tlsx509-nbd-hostname test for 6.2.0
Setting TLS hostname for NBD disks was introduced in QEMU-7.0.0.
Soon the minimal version is going to be bumped to QEMU-7.2. Drop
old test.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-06 10:47:12 +02:00
Michal Privoznik 83bbf72d60 qemuxmlconftest: Drop machine-i8042-{on/off} tests for 6.2.0
Toggling PS/2 state is available from QEMU-7.0 onwards. Soon the
minimal version is going to be bumped to QEMU-7.2. Drop old
tests.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-06 10:47:12 +02:00
Michal Privoznik 9dd28f4b7a ci: regenerate with 'lcitool manifest'
This picks up a fix of FreeBSD 15 image name.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-06 10:46:50 +02:00
Michal Privoznik 64e7822145 qemuxmlconftest: Add new cpu host model expansions tests
In qemuxmlconftest there's a section which aim on testing
'host-model' cpu mode expansion. Since this depends on what QEMU
reports (and thus can change with its version) we have a test
case for each QEMU version supported. Unfortunately, when adding
capabilities for new QEMUs this section was forgotten. Add
missing test cases (10.2.0 and 11.0.0).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-05 15:16:14 +02:00
Michal Privoznik af0debefcc ci: regenerate with 'lcitool manifest'
Notable changes:
- Drop Fedora 42, add Fedora 44
- Drop Freebsd 13, add Freebsd 15
- Drop Ubuntu 22.04, add Ubuntu 26.04

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-05 14:11:54 +02:00
Shalini Chellathurai Saroja 3ec9c7d8cb tests: Add capabilities for QEMU 11.0.0 on s390x
Introduce the qemu capabilities files for QEMU 11.0.0 on s390x.

Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-05 08:58:20 +02:00
Peter Krempa 1674095d8a virNetDevOpenvswitchInterfaceStats: Add 'ifname' to error messages
Report the interface name which caused the error.

Resolves: https://redhat.atlassian.net/browse/RHEL-170993
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2026-05-05 07:35:01 +02:00
Peter Krempa 9ba73e7f6f vsh: cmdComplete: Don't exit when connecting to the daemon fails
Invoke the 'connHandler' without checking return value. 'virsh complete'
can provide useful completions even when the daemon connection is
broken.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-05 07:32:11 +02:00
Peter Krempa 9899c91515 vsh: Suppress attempts to write to stderr when it was closed in 'cmdComplete'
The completer closes stderr to suppress anything polluting the shell
when completion would cause any errors.

Since 'virshReconnect' would call 'vshError' on connection failure this
causes vshError to be killed by SIGPIPE and not provide any completions
if the connection is not possible.

To avoid this add a flag called 'stderr_closed' to vshControl and use it
to suppress output in 'vshPrintStderr'. Keep only the log.

Prior to this patch, attempt to run completion on a host with all
daemons shut down would result in:

 # virsh complete -- "start" "--doma" ; echo $?
 141
 #

With this patch the completion will still fail but the return code will
be 1. Further patch will allow completion.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-05 07:32:11 +02:00
Peter Krempa a8a06cf1c6 virProcessGetStatInfo: Improve debug message
Label the 'pid'/'tid' field. Use proper typecast also for 'tid'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-05 07:32:11 +02:00
Peter Krempa 0938278a95 qemuDomainGetStatsCpuProc: Don't fetch stats for inactive VMs
CPU stats for inactive VM make no sense. In this case it's especially
misleading because 'vm->pid' of an inactive VM is '0' so
virProcessGetStat returns stats for virtqemud itself.

Fixes: 044b8744d6
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-05-05 07:32:11 +02:00
Roman Bogorodskiy 4f96feef86 docs: bhyve: document virtio-console and blkiotune
Add sections describing usage of the virtio-console device
and about block I/O tuning.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-05-04 17:49:36 +02:00