Commit Graph
54182 Commits
Author SHA1 Message Date
Peter Krempa 9e43cf3e58 virQEMUCapsCacheLookupDefault: Fix error message when no emulators are installed
When querying capabilities for the default emulator with no other
arguments (e.g. 'virsh domcapabilities) fix error whithout emulator
installed an error is reported but the error would mention '(null)'
architecture:

  # virsh domcapabilities
  error: failed to get emulator capabilities
  error: unsupported configuration: unable to find any emulator to serve '(null)' architecture

This happens as the error formatting takes 'archStr' which is NULL for
the default architecture instead of using 'arch' which is populated by
the host's architecture and converting it back.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-18 11:03:36 +02:00
Peter Krempa 011ae74640 qemu: postparse: Process VM config with qemuCaps influenced by <qemu:capabilities>
The user configuration of added/removed qemu capabilities via the qemu
namespace element was applied only right before generating a
commandline, but the post parse code code didn't see these.

Apply the capability modification prior to running post parse code so
that defaults are properly picked based on the configuration.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-18 11:03:36 +02:00
Peter Krempa 5319dd6f0d qemu: validate: Validate VM config with qemuCaps influenced by <qemu:capabilities>
The user configuration of added/removed qemu capabilities via the qemu
namespace element was applied only right before generating a
commandline, but the validation code didn't see these.

Modify the validation entry points so that they apply this optionally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-18 11:03:35 +02:00
Peter Krempa 9ec26e2c4f qemu: Allow reuse of 'qemuProcessStartUpdateCustomCaps'
Move and rename the function to 'qemuDomainUpdateCustomCapabilities' and
modify the arguments so that it will be possible to reuse it also in the
post-parse and validation code which ought to base decisions on the same
logic as VM startup would.

Since copying of the qemu capabilities object is very expensive (I've
observed an almost 4x slowdown of qemuxmlconftest)
'qemuDomainUpdateCustomCapabilities' copies the capabilities only when
necessary.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-18 11:03:35 +02:00
Peter Krempa 1bbefb6409 qemu: capabilities: Export 'virQEMUCapsNewCopy' outside of 'qemu_capspriv'
Upcoming patch will add a function which will need to optionally copy
passed capabilities for modification. Export 'virQEMUCapsNewCopy'
outside of tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-18 11:03:35 +02:00
Peter Krempa b8dfb9551e qemu: capabilities: Apply 'capability_filters' configration option on all capabilities
The 'capability_filters' allows admins to globally disable some qemu
capabilities via the config file.

Until now it was applied only directly when starting the VM, but that is
too late as the capability is still present when e.g. the post-parse
code is picking defaults.

Rework the code so that 'capability_filters' is applied directly after
probing qemu so all existing capabilities will lack the filtered out
ones.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-18 11:03:35 +02:00
Mark Cave-Ayland e4dde4cea5 docs/uri.rst: document ext transport argv parameter
This new parameter was added as part of commit ee06a78790 ("remote: allow
passing argv to the ext transport").

Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-17 14:13:47 +02:00
Michal Privoznik 0dcf3e5ea3 ci: refresh with 'lcitool manifest'
Switch from openSUSE Leap 15.5 to 16.0. Not just CI build job,
but also codestyle_job which runs on Leap too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-06-17 14:09:01 +02:00
Roman Bogorodskiy 99e04f1ac0 bhyve: fix bhyveConnectAgent()
The bhyveConnectAgent() function calls qemuAgentOpen() to open an agent
connection. If it fails, e.g. because of insufficient permissions to
open the socket, it returns NULL. Currently, if that happens,
bhyveConnectAgent() just sets agentError to true and exits with 0.
This does not match the contract of bhyveDomainEnsureAgent(), which
should either provide an agent connection or fail.

Fix that by returning -1 when qemuAgentOpen() fails. To make intent
clearer, add a documentation for bhyveConnectAgent().

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-06-15 18:48:52 +02:00
Michal Privoznik c675146d13 ci: refresh with 'lcitool manifest'
This switches Alpine from 3.23 to 3.24.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2026-06-12 13:05:28 +02:00
Roman Bogorodskiy aa89b808f5 bhyve: support populating SMBIOS fields
bhyve supports populating SMBIOS fields. Each
field is set using the -o option, such as:

 -o system.product_name=Virt-Manager

There are 4 groups of options:

 - bios.*
 - system.*
 - board.*
 - chassis.*

As a side note, the '-o' option can be used
for setting options not related to the SMBIOS fields.

Extend virBhyveProcessBuildBhyveCmd() to build the appropriate
arguments for what's specified in the domain's
`<sysinfo type='smbios'>` section.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-10 18:07:52 +02:00
Roman Bogorodskiy 3a3d5014dc bhyve: respect domain's on_reboot action
Currently, the bhyve driver reboot implementation
does not take into account domain's on_reboot action.
Update it so it shuts a domain down on reboot when it is
configured this way.

Additionally, introduce the bhyveDomainShutdownSignal() helper
which shares a common shutdown and reboot implementation
using a signal.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-10 17:28:01 +02:00
Roman Bogorodskiy 2e0b1d4272 bhyve: respect domain's on_poweroff action
Currently, the bhyve driver shutdown implementation
does not take into account domain's on_poweroff action.
Update it so it reboots a domain on shutdown when it is
configured this way.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-10 17:27:54 +02:00
Peter Krempa 1721249ff6 qemuxmlconftest: Fail if test case tried to pass STDIO or invalid fds to 'virCommandPassFD'
Trying to pass STDIO fds to a virCommand is very bad and test cases must
not do that.

Same way with invalid FDs.

Add code which makes qemuxmlconftest fail if any test case would attempt
that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-10 11:23:52 +02:00
Peter Krempa 77b6c501d4 virTestDummyFDContext: Add fields to track errors and 'virTestDummyFDContextMarkError'
Add 'errors' field for tracking a list of errors and
'virTestDummyFDContextMarkError' function to add to the list.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-10 11:23:52 +02:00
Peter Krempa b23765a58f testutils: Turn 'virTestDummyFDContext' into a proper type
'virTestDummyFDContext' was a copy of GHashTable to be able to register
a cleanup function. Upcoming patches will want to track more data
together with the hash table so turn virTestDummyFDContext into a proper
struct which contains the hash table.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-10 11:23:52 +02:00
Peter Krempa 856077138a Avoid use of glib's G_REGEX_OPTIMIZE flag
glib's G_REGEX_OPTIMIZE invokes pcre's JIT optimizer which requires
writable executable memory. On hosts with SELinux this by default caused
AVC denials to be logged. The solution in Fedora's SELinux policy was
to allow execmem for e.g. virtqemud, but e.g. virtlogd or
libvirt_leaseshelper on the other hand got a 'dontaudit' rule.

Now the optimizer itself does have a substantial effect; I've measured
around 3x speedup when matching VIR_LOG_REGEX against a sample of a qemu
VM log file. On the other hand, only 3 out of 10 uses of 'g_regex_new'
used the flag and also none of the regexes which used 'G_REGEX_OPTIMIZE'
are on a hot path:

 - virDomainQemuMonitorEventStateRegisterID

    Used only when custom qemu monitor event callback is registered,
    which resides in libvirt_qemu.so so noone will actually use this
    in production.

 - virCommandRunRegex

   Used in:
    - virStorageBackendFileSystemNetFindNFSPoolSources

      Invoked only via API on output of 'showmount'. Unlikely to ever
      see lots of data.

    - virStorageBackendLogicalFindLVs
    - virStorageBackendLogicalGetPoolSources
    - virStorageBackendLogicalRefreshPool

      Invoked on output of lvs/pvs/vgs. Neither of them are likely to
      ever see lots of output to match.

    - virISCSIGetSession
    - virISCSIScanTargetsInternal

      Invoked on output of iscsiadm, unlikely to see lots of data.

 - virLogProbablyLogMessage
    - virLXCProcessIgnorableLogLine
    - domainLogContextReadFiltered

      Both of the above are used on code paths processing log output
      when failure to startup a VM process or one of the helper
      processes for devices for a qemu domain. Thus they are not invoked
      on success and the processed buffer is capped to 1k of data.

Since none of the above are on anything resembling a hot path and thus
likely to substantially benefit from the optimizer, and we do have
plenty of other uses without optimization, drop the optimizations
everywhere and add a note to sc_G_REGEX_OPTIMIZE that we're currently
avoiding the use of this flag.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-06-10 11:22:32 +02:00
Peter Krempa c081898565 syntax-check: Add warning about implications of G_REGEX_OPTIMIZE
glib's G_REGEX_OPTIMIZE flag for regex operations implies the use of
pcre's JIT optimizer for regexes which requires writable executable
memory for the optimized code.

Security frameworks such as SELinux can restrict program's access to
writable executable memory to harden the code.

glib's implementation of the regex functions handles downgrade to
interpreted evaluation of regexes gracefully if writable executable
memory is unavailable, but that is non-obvious and has a performance
penalty.

Add a syntax check which requires all uses of G_REGEX_OPTIMIZE to be
annotated so that the reader of the code can be hinted to why
G_REGEX_OPTIMIZE should perhaps be avoided.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-06-10 11:22:32 +02:00
Fima Shevrin a0a2b1d2ef qemu: validate: treat only real backing chains as NVRAM backingStore
qemuDomainInitializePflashStorageSource() always attaches a non-NULL
src->backingStore used as an empty virStorageSource chain terminator
(type VIR_STORAGE_TYPE_NONE). qemuValidateDomainDefNvram() incorrectly
interpreted every non-NULL backingStore as a genuine backing overlay and
reported VIR_ERR_CONFIG_UNSUPPORTED, so legitimate UEFI/NVRAM setups were
rejected.

Use 'virStorageSourceHasBacking' helper as the check.

Fixes: d57630c282

Signed-off-by: Fima Shevrin <efim.shevrin@virtuozzo.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-06-10 11:16:13 +02:00
Akash Kulhalli 1ab6d18bee virsh: allow async vcpu options to reach drivers
Do not reject setvcpu --enable --async or setvcpus --guest --async in virsh.

For setvcpu, async only affects live unplug and is documented as having no
effect when enabling vCPUs. For setvcpus, guest+async is a driver-visible flag
combination; drivers should decide whether they can support it. Keep virsh
validation limited to API-level constraints and let drivers report unsupported
combinations.

Signed-off-by: Akash Kulhalli <akash.kulhalli@oracle.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-06-10 11:12:27 +02:00
Akash Kulhalli 09d6f9fa5d domain: use vcpu-specific flag aliases consistently
The vCPU APIs have API-specific flag enums that alias the generic
VIR_DOMAIN_AFFECT_* values for live and config state.

Use the vCPU-specific aliases in the public API checks, QEMU driver flag masks,
and virsh flag construction. The values are unchanged; this is only a
consistency cleanup.

Signed-off-by: Akash Kulhalli <akash.kulhalli@oracle.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-06-10 11:12:27 +02:00
Baptiste Daroussin 4d32c89fcd virpci: don't fail VFIO passthrough when /sys/module/*/drivers is inaccessible
On monolythic kernel /sys/modules/*/drivers may not exist (ENOENT)
On kernels with enhanced security (e.g. grsecurity), it might not be
accessible: EACCESS or EPERM.

Directly try to open if it fails with any of those errors, we fallback
on the module name.

Signed-off-by: Baptiste Daroussin <baptiste.daroussin@ovhcloud.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-10 09:03:52 +02:00
Baptiste Daroussin 2cb57390ba virpci: don't fail VFIO passthrough when modules.alias is missing
When modules.alias is not available (e.g. monolithic kernel),
virPCIDeviceFindBestVFIOVariant() would fail, causing the entire
PCI device detach to abort.

Instead, log a warning and return success with no variant found,
allowing the caller to fall back to the generic vfio-pci driver.

Signed-off-by: Baptiste Daroussin <baptiste.daroussin@ovhcloud.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-10 09:03:44 +02:00
PUSHKARAJ PATILandPeter Krempa 1729178da1 virt-aa-helper: Prevent spurious denials for AoE disks
virt-aa-helper calls virStorageSourceGetMetadata before adding a disk
path to a domain's apparmor profile. This probes the device and may
trigger an AppArmor denial when the disk is an AoE device under
/dev/etherd/.

The return value of virStorageSourceGetMetadata is not checked, so the
denial has no functional impact but results in noisy dmesg logs.

Explicitly deny read access to /dev/etherd/e*.* in the virt-aa-helper profile to
avoid these spurious denials.

Co-Authored-By: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: PUSHKARAJ PATIL <pushkaraj.patil@in.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-10 08:47:18 +02:00
Roman Bogorodskiy fcce05b1b9 bhyve: implement domainAuthorizedSSHKeys{Get,Set} APIs
Implement the domainAuthorizedSSHKeys{Get,Set} APIs using
the guest agent.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-09 19:34:41 +02:00
Roman Bogorodskiy c378712533 bhyve: implement domainSetUserPassword API
Implement the domainSetUserPassword API for setting user
password using the guest agent.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-09 19:34:34 +02:00
Roman Bogorodskiy 18c0c23854 bhyve: implement domain{Get,Set}Time APIs
Implement the domain{Get,Set}Time APIs for getting and setting
domain time.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-09 19:34:24 +02:00
Roman Bogorodskiy f726cb8621 bhyve: fix domainQemuAgentCommand
Currently, bhyveDomainQemuAgentCommand() uses
bhyveDomainAgentAvailable()
which works only if the agent was already initialized.
It should use bhyveDomainEnsureAgent() instead.

Also, remove the bhyveDomainAgentAvailable() function,
there are no cases when it should be used instead of
bhyveDomainEnsureAgent().

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-09 19:15:05 +02:00
Roman Bogorodskiy b9047fb344 bhyve: process: properly handle misconfigured agent
Currently, bhyveDomainEnsureAgent() returns successfully (with 0 return
value) even in cases when the agent is not configured.

That happens because the bhyveConnectAgent() function does not fail
if it cannot find the agent configuration. This might result in
accessing the agent pointer at NULL.

Fix by making bhyveConnectAgent() failing if the agent is not
configured.

Additionally, only call bhyveFindAgentConfig() when the agent is
not configured to avoid unnecessary checks every time the agent is
needed.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-09 19:15:05 +02:00
Denis V. Lunev 98caeeae14 qemu: Inherit SCSI controller model from existing peers
virDomainDefMaybeAddHostdevSCSIcontroller() already inherits the
model of an existing SCSI controller when auto-adding peers driven
by a hostdev whose drive address overflows the highest declared
idx. virDomainDefAddDiskControllersForType(), called for the
disk-driven analogue, does not -- it passes model=-1 unconditionally.
The unspecified peers then arrive at qemuDomainDefaultSCSIControllerModel()
and pick up whichever model the capability cascade settles on
(typically lsilogic). A user-declared virtio-scsi controller at
idx 0 ends up alongside auto-added lsilogic peers at idx 1+.

Plug the same inheritance into qemuDomainDefaultSCSIControllerModel()
itself so it covers both the disk-driven path and any other caller
that arrives with an unresolved model. The function already prefers
architectural defaults (PSeries, ARM virt, RISC-V virt, LoongArch,
s390, built-in ESP) over capabilities; peer inheritance slots in
just before the capability cascade. A virtio-scsi domain keeps the
new peers as virtio-scsi; an lsisas1068 domain stays lsisas1068; a
fresh domain with no SCSI controllers still gets the cap-driven
default. controller-scsi-auto, the only existing test that flows
through this helper, is unaffected (it has no peers to inherit
from). controller-scsi-inherit-model covers the new behavior.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-09 17:46:22 +02:00
Sergey Dyasli 1740686873 remote: allow migrations with the ext transport
Add virURICheckExtCommand() in a similar fashion to the existing
virURICheckUnixSocket() and use it for (1) the same host migration check
and (2) in remoteConnectOpen().

This allows to migrate VMs using the ext transport, as the external
command can act as a proxy to the remote libvirt.

Signed-off-by: Sergey Dyasli <sergey.dyasli@nutanix.com>
Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-09 17:39:12 +02:00
Sergey Dyasli ee06a78790 remote: allow passing argv to the ext transport
Allow passing arguments to the ext program via the query parameters. The
name of each argument is "argv" and it can be repeated multiple times to
pass several arguments.

URI example:

    qemu+ext:///system?command=/bin/prog&argv=192.168.0.10&argv=8080

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Sergey Dyasli <sergey.dyasli@nutanix.com>
Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-09 17:39:12 +02:00
Daniel P. Berrangé 1e194060d0 ci: refresh with 'lcitool manifest'
This brings in a workaround for broken deps with OpenSUSE
repos, by allowing downgrades.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2026-06-09 14:16:35 +01:00
Michal Privoznik d5301e593a domaincapstest: Drop support for old qemu
The aim of domaincapstest is to check domain capabilities XML
with respect to qemu capabilities. And we used to have old qemu
capabilities where only TPM-1.2 was supported. But as of
v12.4.0-rc1~130 QEMU-7.2 or newer is required which means the
code that's handling older QEMUs is required no more. Drop it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2026-06-09 14:10:53 +02:00
Laine Stump f0c89a8aa9 virsh: new command "domifannounce"
virsh domifannounce is a thin wrapper around the new API
virDomainAnnounceInterface(). Syntax:

     virsh domifannounce guestname [interfacename] [parameters]

where the optional interfacename can be either the MAC address of the
interface to announce, or the name of the tap device used to connect
the domain's interface to the real network (if the connection is with
a tap device), and [parameters] is one or more of the following options:

  --initial [unsigned integer]
  --max     [unsigned integer]
  --rounds  [unsigned integer]
  --step    [unsigned integer]

For example:

    virsh domifannounce myguest 52:54:00:BE:EF:E1 --initial 100
    virsh domifannounce other vnet2
    virsh domifannounce myguest

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2026-06-08 02:33:43 -04:00
Laine Stump 7191d29326 qemu: implement virDomainAnnounceInterface() API
using qemuMonitorAnnounceSelf(). Note that the other public domain
interface APIs expect interface to be specified by either its "target"
name (i.e. the name of the tap/macvtap device on the host) or by the
MAC address, but qemuMonitorAnnounceSelf() expects the QEMU "device
id" (which is known in libvirt as the "alias"), so we have to convert.

Resolves: https://redhat.atlassian.net/browse/RHEL-7047
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2026-06-08 02:33:00 -04:00
Laine Stump 6924b73d30 API: Introduce virDomainAnnounceInterface()
This API provides a way for a libvirt client to force a guest to
inject a "Gratuitous ARP" packet into the outgoing stream of one, or
all, network devices of the guest; this will be used to update the
forwarding tables of any network switches in the local broadcast
domain so that they will begin forwarding traffic correctly in a more
timely manner after network topology changes.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2026-06-08 02:31:42 -04:00
Laine Stump 6b2c18913f qemu: new monitor function qemuMonitorAnnounceSelf()
This new function sends the command "announce-self" to QEMU, causing
it to inject a series of gratuitous ARP (GARP) response packets into
the output stream of one or all guest interfaces, which will force any
switches in the same collision domain to update their forwarding db
for that interface's MAC address.

There are several parameters that control which interfaces the GARP
packets are sent on, as well as their number and interval, but all of
these parameters have sane defaults (even though QEMU's own
self-announce requires they all be specified in the QMP command).

Here is an example of the fully formed JSON for an announce-self:

{"execute":"announce-self",
 "arguments":{"interfaces":["net1"],
              "initial":50,
              "max":550,
              "rounds":5,
              "step":50},
 "id":"libvirt-16"}

All parameters except "interface" are unsigned integers that are
mandatory in the JSON command sent to QEMU. libvirt's
qemuMonitoAnnounceSelf() function, however, makes them optional by
replacing anything set to 0 with the same default value used
internally by QEMU when it is executing announce-self for a guest at
the end of a migration (initial=50, max=550, rounds-5, step=50).

"interfaces" (the only optional parameter from QEMU's point of view)
is (again, from QEMU's PoV) a *list* of the QEMU device-ids for the
interfaces to announce (if it's missing then announce-self injects
announcements on *all* of this guest's interfaces), but it seems much
more likely that someone will either want to announce a single
interface, or all of them, so to simplify calling in the more common
cases, our function just accepts a *single* device name (that can be
NULL) and creates a JSON array containing that one interface name (in
the rare case that someone wants to announce multiple interfaces but
not all of them, they can call our API multiple times).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2026-06-08 02:28:50 -04:00
Marc-André Lureau 57aac37767 qemu: add tests for standalone VNC graphics
Add xml2argv tests verifying the standalone VNC feature:

- graphics-vnc-standalone: when both <graphics type='dbus'/> and
  <graphics type='vnc'/> are present, the -vnc QEMU argument is
  omitted since qemu-vnc handles VNC externally via D-Bus.

- graphics-vnc-standalone-socket: same behavior with a Unix socket
  listen address.

- graphics-vnc-standalone-p2p: when dbus is p2p mode, standalone
  VNC is NOT triggered and the built-in -vnc argument is preserved.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-04 14:20:46 +02:00
Marc-André Lureau fa0a4c899f qemu: wire up standalone VNC in driver APIs
Route the OpenGraphics, OpenGraphicsFD, and GraphicsReload driver
APIs through the standalone qemu-vnc D-Bus interface when active.
Client connections are passed via D-Bus fd-passing (AddClient),
certificate reloading uses the ReloadCertificates method, and
password changes use SetPassword.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-04 14:20:46 +02:00
Marc-André Lureau 176b3df2e4 qemu: integrate standalone VNC in domain lifecycle
When both a D-Bus display and a VNC graphics device are configured
and the qemu-vnc binary is available, use the standalone VNC server
instead of QEMU's built-in VNC.

During domain preparation, detect whether the standalone VNC path
applies and allocate the qemuVnc context. Skip the built-in -vnc
command line argument when standalone VNC is active. Start and stop
the qemu-vnc process through the external device hooks.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-04 14:20:46 +02:00
Marc-André Lureau 209e40a347 qemu: add qemu-vnc helper unit
Add helpers to manage the standalone qemu-vnc VNC server process.
The qemu-vnc server connects to QEMU via the D-Bus display interface,
providing VNC access decoupled from the QEMU process.

The helper handles process lifecycle (start/stop), D-Bus name
watching, and provides D-Bus methods for password management,
certificate reloading, and client connections.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-04 14:20:46 +02:00
Marc-André Lureau 16cd2886ae qemu: add qemu-vnc configuration
Add qemu_vnc configuration entry to specify the path to the
standalone qemu-vnc binary.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-04 14:20:46 +02:00
Marc-André Lureau 2a46474ca2 qemu: add standalone VNC state directory
Add a state directory for the standalone qemu-vnc process, following
the same pattern used for the RDP state directory.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-04 14:20:46 +02:00
Jonathon Jongsma 0f014efea3 hyperv: report nested virtualization setting in domain XML
When Hyper-V is configured to expose virtualization extensions to a
guest, report this in the domain XML by adding the vendor-appropriate
CPU feature flag:

- Intel hosts: <feature policy='require' name='vmx'/>
- AMD hosts: <feature policy='require' name='svm'/>

This requires adding ExposeVirtualizationExtensions and several other
fields introduced in Windows 10 to the Msvm_ProcessorSettingData WMI
class definition.

Resolves: https://redhat.atlassian.net/browse/RHEL-159129

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-03 09:52:38 -05:00
Jonathon Jongsma c072aea5a9 hyperv: Rename hypervGetProcessorsByName() to hypervGetProcessorList()
Make the 'name' parameter optional and return all processors from the
host if name is not specified.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-03 09:48:47 -05:00
Jonathon Jongsma 645d98b14a hyperv: fix error handling of hypervGetProcessorsByName()
We were checking the output pointer for NULL rather than checking the
dereferenced value for NULL. So the case where no processors were
returned would not have returned an error as expected.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-03 09:48:47 -05:00
Peter Krempa db7b3de701 qemucapabilitiestest: Add data for the qemu-11.1 dev cycle (aarch64)
The dump is based on QEMU commit 'v11.0.0-1600-g5611a9268d'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-03 15:21:44 +02:00
Peter Krempa ace61064f0 qemucapabilitiestest: Add data for the qemu-11.1 dev cycle (x86_64)
The dump is based on QEMU commit 'v11.0.0-1600-g5611a9268d'

Notable changes:

 - machine types for the 11.1.0 release added
 - (auto) deprecated 8.1 machine type
 - 'poll-weight' property added for 'iothread' object
 - 'clipboard' property added for 'gtk' display backend
 - 'vhost-user-rtc' device added
 - new CPU models/versions
    - Cascadelake-Server-v6-x86_64-cpu
    - Cascadelake-Server-v7-x86_64-cpu
    - ClearwaterForest-v4-x86_64-cpu
    - DiamondRapids-v2-x86_64-cpu
    - EPYC-Genoa-v3-x86_64-cpu
    - EPYC-Milan-v4-x86_64-cpu
    - EPYC-Turin-v2-x86_64-cpu
    - GraniteRapids-v6-x86_64-cpu
    - GraniteRapids-v7-x86_64-cpu
    - Icelake-Server-v8-x86_64-cpu
    - Icelake-Server-v9-x86_64-cpu
    - SapphireRapids-v7-x86_64-cpu
    - SapphireRapids-v8-x86_64-cpu
    - SierraForest-v6-x86_64-cpu
    - Skylake-Server-v6-x86_64-cpu
 - 'query-kvm' command is now deprecated
 - removed 'gluster' blockdev backend
 - 'blkdebug' blockdev backend allows injecting delays
 - chardev backends support 'encoding' property
 - 'remaining' amount reported in 'query-migrate'
 - 'target-info-x86_64' QOM type added
 - 'x-rdma-chunk-size' migration parameter added

The few changed '.args' files update the machine type to the actual
version because they were frozen before we've added a newer capability
dump (latest machine type is masked to stabilize test outputs).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-03 15:21:44 +02:00
Peter Krempa fc834144aa qemublocktest: Skip schema validation on 'gluster' backend tests
qemu-11.1 will drop support for the 'gluster' block backend driver. We
want to keep the tests around to validate that nothing in the
parser/generator has changed but there's no point in wiring up QMP
schema validation against older versions.

Skip the schema validation for gluster qemublocktests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2026-06-03 15:21:44 +02:00