]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
5 months agoch: Fix refcounting in virCHEventHandlerLoop() and virCHStartEventHandler()
Kirill Shchetiniuk [Fri, 14 Mar 2025 11:51:19 +0000 (12:51 +0100)] 
ch: Fix refcounting in virCHEventHandlerLoop() and virCHStartEventHandler()

When event handler thread is created inside of
virCHStartEventHandler() the monitor object is refed because the thread
(virCHEventHandlerLoop()) that's created in the very next step
uses it. But right after that, the monitor object is unrefed,
which is wrong because it takes away the reference which was
handed over to the thread. The monitor must be unrefed inside the
thread, when no longer needed.

And while at it, move the unref call of the domain object after
the debug print which obviously accesses the domain definition.

Signed-off-by: Kirill Shchetiniuk <kshcheti@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoch: preserve last error in virCHProcessStop()
Kirill Shchetiniuk [Fri, 14 Mar 2025 11:51:18 +0000 (12:51 +0100)] 
ch: preserve last error in virCHProcessStop()

If starting a CH domain fails an error is reported and
virCHProcessStart() calls virCHProcessStop() to clean up any
residues. Problem is, inside of virCHProcessStop() some public
APIs might be called (e.g. virNetworkLookupByName(),
virNetworkPortLookupByUUID() and/or virNetworkPortDelete()). Per
our design, public APIs reset last error which means the useful
error reported earlier is lost.

Fix this by calling virErrorPreserveLast() + virErrorRestore()
combo inside of virCHProcessStop().

Signed-off-by: Kirill Shchetiniuk <kshcheti@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agodocs: Fix some typos
Thomas Huth [Mon, 17 Mar 2025 10:41:20 +0000 (11:41 +0100)] 
docs: Fix some typos

Found with the codespell utility.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
5 months agodocs: remove references to removed APIs
Daniel P. Berrangé [Mon, 17 Mar 2025 10:02:24 +0000 (10:02 +0000)] 
docs: remove references to removed APIs

The glib adoption docs was suggesting avoidance of certain APIs that
were obsoleted by glib, during the transition period. Now that the
referenced APIs no longer exist in libvirt code, they can also be
removed from the docs.

NB, the virStringListRemoveDuplicates method remains since there is
no glib equivalent.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agoscripts: add execute permission to several files
Daniel P. Berrangé [Mon, 17 Mar 2025 10:11:01 +0000 (10:11 +0000)] 
scripts: add execute permission to several files

Most, but not all, files in scripts have execute permission. While we
don't need this in order to launch them via meson/ninja build rules,
it is nice to direct execution if they have execution permission. This
makes the practice consistent across all scripts.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agodocs: document workaround for DMARC countermeasures
Daniel P. Berrangé [Mon, 17 Mar 2025 11:18:17 +0000 (11:18 +0000)] 
docs: document workaround for DMARC countermeasures

If a contributor's email domain has a DMARC policy of 'p=quarantine'
or 'p=reject', mailman will apply DMARC countermeasures on all mails
sent to lists.libvirt.org rewriting the "From" header to remove the
sender's email address. e.g.

  From: Your Name via <lists.libvirt.org>

If these countermeasures were not applied, affected mail would either
have gone directly to SPAM, or have been entirely rejected. Mailman3
is unable to be configured to guarantee no mangling of the mail body
so these countermeasures are unavoidable for lists.libvirt.org.

Amongst the various downsides, the From address rewriting has the
bad effect of mangling git commit author attribution.

To avoid this it is required to add two additional git config
settings:

  $ git config --global format.from "Your Name <your@email.com>"
  $ git config --global format.forceInBodyFrom true

Note, *both* are required, even if your ``format.from`` matches
your existing git identity, because the latter only takes effect
once the former is set.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agoconf: parse interface/source/@dev for all interface types (with backend type='passt')
Laine Stump [Fri, 7 Mar 2025 00:19:12 +0000 (19:19 -0500)] 
conf: parse interface/source/@dev for all interface types (with backend type='passt')

The original implementation of the passt backend for vhost-user
interfaces erroneously forgot to parse:

  <source dev='blah'/>

for interface type='vhostuser', so it wasn't being added to the passt
commandline, and also wasn't being saved to the domain config. Now we
parse it whenever the <backend> type='passt', no matter what the
interface type, and then throw an error during validation if
source/@dev was specified for interface type = 'user|vhostuser' and
backend type != 'passt'.

Fixes: 1e9054b9c79d721a55f413c2983c5370044f8f60
Resolves: https://issues.redhat.com/browse/RHEL-82539
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoRemove unreachable breaks right after return
Ján Tomko [Thu, 13 Mar 2025 15:27:27 +0000 (16:27 +0100)] 
Remove unreachable breaks right after return

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoqemu: remove unused vm from qemuBuildPVCommandLine
Ján Tomko [Thu, 13 Mar 2025 15:03:23 +0000 (16:03 +0100)] 
qemu: remove unused vm from qemuBuildPVCommandLine

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoqemu: remove unused vm from qemuBuildSEVSNPCommandLine
Ján Tomko [Thu, 13 Mar 2025 15:01:03 +0000 (16:01 +0100)] 
qemu: remove unused vm from qemuBuildSEVSNPCommandLine

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoqemu: remove qemuCaps from qemuBuildIOThreadCommandLine
Ján Tomko [Thu, 13 Mar 2025 14:56:29 +0000 (15:56 +0100)] 
qemu: remove qemuCaps from qemuBuildIOThreadCommandLine

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoqemu: remove qemuCaps from qemuBuildObjectCommandline
Ján Tomko [Thu, 13 Mar 2025 14:55:53 +0000 (15:55 +0100)] 
qemu: remove qemuCaps from qemuBuildObjectCommandline

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoqemu: remove qemuCaps from qemuBuildTLSx509CommandLine
Ján Tomko [Thu, 13 Mar 2025 14:54:45 +0000 (15:54 +0100)] 
qemu: remove qemuCaps from qemuBuildTLSx509CommandLine

Also from qemuBuildGraphicsVNCCommandLine

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoqemu: remove qemuCaps from qemuBuildObjectSecretCommandLine
Ján Tomko [Thu, 13 Mar 2025 14:53:17 +0000 (15:53 +0100)] 
qemu: remove qemuCaps from qemuBuildObjectSecretCommandLine

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoqemu: remove qemuCaps from qemuBuildObjectCommandlineFromJSON
Ján Tomko [Thu, 13 Mar 2025 14:52:00 +0000 (15:52 +0100)] 
qemu: remove qemuCaps from qemuBuildObjectCommandlineFromJSON

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoqemu: validate: fs: remove unneeded parameter
Ján Tomko [Thu, 13 Mar 2025 14:45:53 +0000 (15:45 +0100)] 
qemu: validate: fs: remove unneeded parameter

No longer required since we don't require driver->privileged anymore.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoqemu: seccomp sandbox: remove incorect G_GNUC_UNUSED marker
Ján Tomko [Thu, 13 Mar 2025 14:45:18 +0000 (15:45 +0100)] 
qemu: seccomp sandbox: remove incorect G_GNUC_UNUSED marker

qemuCaps is obviously used.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoNEWS: Mention new 'image_format' parameter for virDomainSaveParams
Jim Fehlig [Mon, 3 Mar 2025 18:31:34 +0000 (11:31 -0700)] 
NEWS: Mention new 'image_format' parameter for virDomainSaveParams

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 months agodocs: Clarify what source and name attributes of TPM profile describe
Stefan Berger [Mon, 16 Dec 2024 19:16:44 +0000 (14:16 -0500)] 
docs: Clarify what source and name attributes of TPM profile describe

Clarify what source and name attributes of TPM profile describe and
update the version placeholder to the libvirt version when profiles
were first supported, v10.10. Also mention that profiles with prefix
'custom:' in their name can be modified.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5 months agoch: Rework virCHProcessConnectMonitor()
Michal Privoznik [Thu, 13 Mar 2025 12:03:02 +0000 (13:03 +0100)] 
ch: Rework virCHProcessConnectMonitor()

Firstly, let's switch from explicit virCHDriverGetConfig() +
virObjectUnref() combo to g_autoptr(virCHDriverConfig). This
leaves us with the @monitor variable which is initialized to NULL
only to be then set to the retval of virCHMonitorNew() and
returned instantly. Well, the variable is now useless and can be
dropped.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoch: Unref @cfg in virCHProcessStop()
Michal Privoznik [Thu, 13 Mar 2025 12:02:33 +0000 (13:02 +0100)] 
ch: Unref @cfg in virCHProcessStop()

At the beginning of virCHProcessStop() the ref to driver config
is obtained (via virCHDriverGetConfig()), but corresponding unref
call is lacking. Use g_autoptr() to make sure the config is
unrefed always.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoch: Free @iothreads array in virCHProcessSetupIOThreads()
Michal Privoznik [Thu, 13 Mar 2025 12:02:17 +0000 (13:02 +0100)] 
ch: Free @iothreads array in virCHProcessSetupIOThreads()

When the CH driver starts a domain virCHProcessSetupIOThreads()
is called eventually which in turn calls
virCHMonitorGetIOThreads(). The latter returns an array of
iothreads which is never freed leading to a memleak:

130 (104 direct, 26 indirect) bytes in 1 blocks are definitely lost in loss record 1,804 of 1,998
   at 0x484CEF3: calloc (vg_replace_malloc.c:1675)
   by 0x4F0E7A9: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.8000.5)
   by 0xB3A9359: virCHMonitorGetIOThreads (ch_monitor.c:1183)
   by 0xB3AA5BB: virCHProcessSetupIOThreads (ch_process.c:348)
   by 0xB3AAC59: virCHProcessSetup (ch_process.c:480)
   by 0xB3AC75A: virCHProcessStart (ch_process.c:973)
   by 0xB39B7D4: chDomainCreateXML (ch_driver.c:246)
   by 0x4CC9D32: virDomainCreateXML (libvirt-domain.c:188)
   by 0x168F91: remoteDispatchDomainCreateXML (remote_daemon_dispatch_stubs.h:5186)
   by 0x168F18: remoteDispatchDomainCreateXMLHelper (remote_daemon_dispatch_stubs.h:5167)
   by 0x4B20066: virNetServerProgramDispatchCall (virnetserverprogram.c:423)
   by 0x4B1FB99: virNetServerProgramDispatch (virnetserverprogram.c:299)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoch: Don't leak virCHDomainObjPrivate struct members
Michal Privoznik [Thu, 13 Mar 2025 12:01:58 +0000 (13:01 +0100)] 
ch: Don't leak virCHDomainObjPrivate struct members

There are some members of the virCHDomainObjPrivate struct that
are allocated at various stages of domain lifecycle but then are
never freed:

1) cgroup - allocated in virDomainCgroupSetupCgroup()
2) autoCpuset - this one is actually never allocated (and thus is
                always NULL, but soon it may be used. Just free
                it for now, which is a NOP anyways.
3) autoNodeset - same story as 2).

There are two more members, which shouldn't be freed:

1) driver - this is just a raw pointer to the CH driver (see
   virCHDomainObjPrivateAlloc()).

2) monitor - this member is cleared in virCHProcessStop(), way
             before control even gets to
             virCHDomainObjPrivateFree().

452 (400 direct, 52 indirect) bytes in 1 blocks are definitely lost in loss record 1,944 of 1,998
   at 0x484CEF3: calloc (vg_replace_malloc.c:1675)
   by 0x4F0E7A9: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.8000.5)
   by 0x49479CE: virCgroupNewFromParent (vircgroup.c:893)
   by 0x49481BA: virCgroupNewDomainPartition (vircgroup.c:1068)
   by 0x494915E: virCgroupNewMachineManual (vircgroup.c:1378)
   by 0x49492FE: virCgroupNewMachine (vircgroup.c:1432)
   by 0x4B5E3DE: virDomainCgroupInitCgroup (domain_cgroup.c:377)
   by 0x4B5E9CD: virDomainCgroupSetupCgroup (domain_cgroup.c:524)
   by 0xB3AC693: virCHProcessStart (ch_process.c:951)
   by 0xB39B7D4: chDomainCreateXML (ch_driver.c:246)
   by 0x4CC9D32: virDomainCreateXML (libvirt-domain.c:188)
   by 0x168F91: remoteDispatchDomainCreateXML (remote_daemon_dispatch_stubs.h:5186)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoch: Free retval of curl_slist_append()
Michal Privoznik [Thu, 13 Mar 2025 12:01:44 +0000 (13:01 +0100)] 
ch: Free retval of curl_slist_append()

There are two places where curl_slist_append() is called but
corresponding call to curl_slist_free_all() is missing:
virCHMonitorPutNoContent() and virCHMonitorGet() which leads to
memleaks:

41 (16 direct, 25 indirect) bytes in 1 blocks are definitely lost in loss record 992 of 1,998
   at 0x4845888: malloc (vg_replace_malloc.c:446)
   by 0x5B2F8FE: curl_slist_append (in /usr/lib64/libcurl.so.4.8.0)
   by 0xB3A7B41: virCHMonitorPutNoContent (ch_monitor.c:824)
   by 0xB3A89FF: virCHMonitorBootVM (ch_monitor.c:1030)
   by 0xB3AC6F1: virCHProcessStart (ch_process.c:967)
   by 0xB39B7D4: chDomainCreateXML (ch_driver.c:246)
   by 0x4CC9D32: virDomainCreateXML (libvirt-domain.c:188)
   by 0x168F91: remoteDispatchDomainCreateXML (remote_daemon_dispatch_stubs.h:5186)
   by 0x168F18: remoteDispatchDomainCreateXMLHelper (remote_daemon_dispatch_stubs.h:5167)
   by 0x4B20066: virNetServerProgramDispatchCall (virnetserverprogram.c:423)
   by 0x4B1FB99: virNetServerProgramDispatch (virnetserverprogram.c:299)
   by 0x4B28B5E: virNetServerProcessMsg (virnetserver.c:135)

88 (16 direct, 72 indirect) bytes in 1 blocks are definitely lost in loss record 1,501 of 1,998
   at 0x4845888: malloc (vg_replace_malloc.c:446)
   by 0x5B2F8FE: curl_slist_append (in /usr/lib64/libcurl.so.4.8.0)
   by 0xB3A7E41: virCHMonitorGet (ch_monitor.c:864)
   by 0xB3A92E2: virCHMonitorGetInfo (ch_monitor.c:1157)
   by 0xB3A9CEA: virCHProcessUpdateInfo (ch_process.c:142)
   by 0xB3AAD36: virCHProcessSetup (ch_process.c:492)
   by 0xB3AC75A: virCHProcessStart (ch_process.c:973)
   by 0xB39B7D4: chDomainCreateXML (ch_driver.c:246)
   by 0x4CC9D32: virDomainCreateXML (libvirt-domain.c:188)
   by 0x168F91: remoteDispatchDomainCreateXML (remote_daemon_dispatch_stubs.h:5186)
   by 0x168F18: remoteDispatchDomainCreateXMLHelper (remote_daemon_dispatch_stubs.h:5167)
   by 0x4B20066: virNetServerProgramDispatchCall (virnetserverprogram.c:423)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agonetwork: Free inhibitor in networkStateCleanup()
Michal Privoznik [Thu, 13 Mar 2025 12:01:19 +0000 (13:01 +0100)] 
network: Free inhibitor in networkStateCleanup()

The shutdown inhibitor is created in networkStateInitialize() but
corresponding call to virInhibitorFree() is missing in
networkStateCleanup() leading to a memleak:

116 (72 direct, 44 indirect) bytes in 1 blocks are definitely lost in loss record 1,769 of 1,998
   at 0x484CEF3: calloc (vg_replace_malloc.c:1675)
   by 0x4F0E7A9: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.8000.5)
   by 0x4993B9B: virInhibitorNew (virinhibitor.c:152)
   by 0x5279394: networkStateInitialize (bridge_driver.c:654)
   by 0x4CC74DC: virStateInitialize (libvirt.c:665)
   by 0x15B719: daemonRunStateInit (remote_daemon.c:613)
   by 0x49F2B44: virThreadHelper (virthread.c:256)
   by 0x5356662: start_thread (in /usr/lib64/libc.so.6)
   by 0x53D7DA3: clone (in /usr/lib64/libc.so.6)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoqemu: capabilites: Retire QEMU_CAPS_MIGRATION_PARAM_BLOCK_BITMAP_MAPPING
Peter Krempa [Wed, 12 Mar 2025 16:12:40 +0000 (17:12 +0100)] 
qemu: capabilites: Retire QEMU_CAPS_MIGRATION_PARAM_BLOCK_BITMAP_MAPPING

The capability is no logner used as all qemus support it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: migration: Always assume support for QEMU_CAPS_MIGRATION_PARAM_BLOCK_BITMAP_MAPPING
Peter Krempa [Wed, 12 Mar 2025 16:10:59 +0000 (17:10 +0100)] 
qemu: migration: Always assume support for QEMU_CAPS_MIGRATION_PARAM_BLOCK_BITMAP_MAPPING

The 'transform' attribute of 'bitmaps' was added in qemu-6.0, thus
we can assume all qemus we're willing to use support it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: domain: Remove qemuDomainSupportsCheckpointsBlockjobs
Peter Krempa [Wed, 12 Mar 2025 16:08:33 +0000 (17:08 +0100)] 
qemu: domain: Remove qemuDomainSupportsCheckpointsBlockjobs

The function now serves no real purpose.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: capabilites: Retire QEMU_CAPS_INCREMENTAL_BACKUP
Peter Krempa [Wed, 12 Mar 2025 16:06:39 +0000 (17:06 +0100)] 
qemu: capabilites: Retire QEMU_CAPS_INCREMENTAL_BACKUP

All supported qemu versions now support this. Retire the capability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: Always assume support for QEMU_CAPS_INCREMENTAL_BACKUP
Peter Krempa [Wed, 12 Mar 2025 16:04:04 +0000 (17:04 +0100)] 
qemu: Always assume support for QEMU_CAPS_INCREMENTAL_BACKUP

The support for incremental backup (not the backup api itself) was gated
on support for migrating bitmaps. As the ability to migrate bitmaps was
added in qemu-6.0 we can now assume that all supported qemu versions
support incremental backup.

Remove the interlocking.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: capabilities: Retire QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY
Peter Krempa [Wed, 12 Mar 2025 15:58:07 +0000 (16:58 +0100)] 
qemu: capabilities: Retire QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY

All supported qemus have this and we already deleted alternate code.
Retire the feature flag.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: Always assume support for QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY
Peter Krempa [Wed, 12 Mar 2025 15:56:29 +0000 (16:56 +0100)] 
qemu: Always assume support for QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY

qemu supports the @allow-write-only-overlay feature since qemu-5.0.
Remove the alternate code paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: capabilities: Retire QEMU_CAPS_BLOCKDEV_REOPEN
Peter Krempa [Wed, 12 Mar 2025 15:51:20 +0000 (16:51 +0100)] 
qemu: capabilities: Retire QEMU_CAPS_BLOCKDEV_REOPEN

'blockdev-reopen' is supported since qemu-6.1. Since we now don't have
any code using this capability we can retire it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: Always assume support for QEMU_CAPS_BLOCKDEV_REOPEN
Peter Krempa [Wed, 12 Mar 2025 15:48:53 +0000 (16:48 +0100)] 
qemu: Always assume support for QEMU_CAPS_BLOCKDEV_REOPEN

'blockdev-reopen' is supported since qemu-6.1, thus we can now remove
the interlocks.

Document the change to 'mirror' as this patch removes the last clue why
we overwrite the mirror's readonly state to false unconditionally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: capabilities: Retire QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT
Peter Krempa [Wed, 12 Mar 2025 15:42:07 +0000 (16:42 +0100)] 
qemu: capabilities: Retire QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT

The capability is no longer used as all qemus already support the
feature.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: monitor: Always assume support for QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT
Peter Krempa [Wed, 12 Mar 2025 15:39:21 +0000 (16:39 +0100)] 
qemu: monitor: Always assume support for QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT

The flat mode of 'query-named-block-nodes' is supported since qemu-5.0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: capabilities: Retire QEMU_CAPS_OBJECT_JSON
Peter Krempa [Wed, 12 Mar 2025 15:34:48 +0000 (16:34 +0100)] 
qemu: capabilities: Retire QEMU_CAPS_OBJECT_JSON

Now that we dropped support for old qemus which didn't support JSON
props for -object we can retire the capability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoutil: Drop 'virQEMUBuildCommandLineJSONArrayBitmap'
Peter Krempa [Wed, 12 Mar 2025 15:19:12 +0000 (16:19 +0100)] 
util: Drop 'virQEMUBuildCommandLineJSONArrayBitmap'

It was used to convert JSON arrays in legacy -object commandline
conversion. Since we now exclusively use JSON with -object, this
infrastructure is no longer needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: monitor: Drop support for extra wrapper for 'object_add'
Peter Krempa [Wed, 12 Mar 2025 15:23:17 +0000 (16:23 +0100)] 
qemu: monitor: Drop support for extra wrapper for 'object_add'

The QAPIfication of objects removed the extra wrapper object which we
were adding in the monitor code to simplify the other callers.

Now that we support only qemus which don't require this we can drop the
support code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuBuildObjectCommandlineFromJSON: Assume all qemus support QEMU_CAPS_OBJECT_JSON
Peter Krempa [Wed, 12 Mar 2025 15:11:21 +0000 (16:11 +0100)] 
qemuBuildObjectCommandlineFromJSON: Assume all qemus support QEMU_CAPS_OBJECT_JSON

'-object' was qapified (meaning it supports JSON props) in qemu-6.0,
thus now that we require qemu-6.2 we can drop the compatibility code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: capabilities: Retire QEMU_CAPS_COMPAT_DEPRECATED
Peter Krempa [Wed, 12 Mar 2025 15:31:52 +0000 (16:31 +0100)] 
qemu: capabilities: Retire QEMU_CAPS_COMPAT_DEPRECATED

The capability always exists in qemu and is no longer checked.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuBuildCompatDeprecatedCommandLine: Assume that QEMU_CAPS_COMPAT_DEPRECATED is...
Peter Krempa [Wed, 12 Mar 2025 15:28:36 +0000 (16:28 +0100)] 
qemuBuildCompatDeprecatedCommandLine: Assume that QEMU_CAPS_COMPAT_DEPRECATED is supported

Bumping minimum version of qemu to 6.2 means that the '-compat' option
is now always supported.

As we were unable to detect it in any other way we based this capability
on QEMU_CAPS_OBJECT_JSON.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agodomainbackupxml2xml: Add test case with unix socket server for pull mode backup
Peter Krempa [Wed, 12 Mar 2025 12:48:27 +0000 (13:48 +0100)] 
domainbackupxml2xml: Add test case with unix socket server for pull mode backup

While we show the example in the docs we don't have an example XML for
exercising the parser/formatter and schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agodocs: formatdomain: Clarify configuration of iothread <-> virtqueue mapping
Peter Krempa [Thu, 20 Feb 2025 15:33:59 +0000 (16:33 +0100)] 
docs: formatdomain: Clarify configuration of iothread <-> virtqueue mapping

Add an example for the automatic/round-robin mapping of iothreads which
users should preferrably use. Until now the example contained even the
full mapping which could push users to use that instead.

Mention that the queues are then automatically distributed among the
iothreads.

Also clarify the need to set 'queues' when mapping threads explicitly
and how the queues are identified.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agovirDomainIothreadMappingDefParse: Fix usage of virXMLNodeGetSubelementList
Peter Krempa [Tue, 25 Feb 2025 11:42:49 +0000 (12:42 +0100)] 
virDomainIothreadMappingDefParse: Fix usage of virXMLNodeGetSubelementList

virXMLNodeGetSubelementList always returns a non-NULL pointers thus we
should check the length instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agovirXMLNodeGetSubelementList: Document return value semantics
Peter Krempa [Tue, 25 Feb 2025 11:34:39 +0000 (12:34 +0100)] 
virXMLNodeGetSubelementList: Document return value semantics

The returned value is always non-NULL. Callers need to check the length
of the returned array instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: Use modern header formatting in 'qemu_command.h'
Peter Krempa [Mon, 24 Feb 2025 17:21:51 +0000 (18:21 +0100)] 
qemu: Use modern header formatting in 'qemu_command.h'

The file used intermixed style. Convert the last outliers to the new
formatting style.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: process: Remove un-updated 'qemuProcessStartWarnShmem'
Peter Krempa [Tue, 11 Mar 2025 08:04:18 +0000 (09:04 +0100)] 
qemu: process: Remove un-updated 'qemuProcessStartWarnShmem'

The checks in qemuProcessStartWarnShmem are no longer current. Since
previous patch made it fatal for vhost-user interfaces to be configured
without shared memory this warning code can be deleted.

Resolves: https://issues.redhat.com/browse/RHEL-80533
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoqemuValidateDomainDeviceDefNetwork: Require shared memory for all vhost-user interfaces
Peter Krempa [Tue, 11 Mar 2025 08:01:12 +0000 (09:01 +0100)] 
qemuValidateDomainDeviceDefNetwork: Require shared memory for all vhost-user interfaces

Currently we produce only a warning into the log if a non-passt
vhost-user interface is configured with shared memory.

Since we do make it fatal with all other vhost-user types, fix the check
to trigger also for normal-vhost-user interfaces.

Since passt-based vhost-user interfaces are checked separately the check
will no longer be required.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoqemuxmlconftest: Include shared memory 'net-vhostuser' test cases
Peter Krempa [Tue, 11 Mar 2025 08:01:03 +0000 (09:01 +0100)] 
qemuxmlconftest: Include shared memory 'net-vhostuser' test cases

The vhost-user protocol requires shared memory support to work properly.

Our test XMLs didn't have it configured as for interface the check if
shared memory is present only produces a warning instead of a proper
error.

Upcoming patches will be moving the check to become fatal so the test
cases need to be fixed first.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoqemuNodeGetSEVInfo: Use virTypedParamList to construct return value
Peter Krempa [Wed, 26 Feb 2025 16:07:59 +0000 (17:07 +0100)] 
qemuNodeGetSEVInfo: Use virTypedParamList to construct return value

Simplify the code by using the modern helpers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoqemuDomainGetLaunchSecurityInfo: Use virTypedParamList to construct return value
Peter Krempa [Wed, 26 Feb 2025 16:07:59 +0000 (17:07 +0100)] 
qemuDomainGetLaunchSecurityInfo: Use virTypedParamList to construct return value

Simplify the code by using the modern helpers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoqemuDomainGetLaunchSecurityInfo: Don't forget unlock VM object on (impossible) error
Peter Krempa [Wed, 26 Feb 2025 15:55:54 +0000 (16:55 +0100)] 
qemuDomainGetLaunchSecurityInfo: Don't forget unlock VM object on (impossible) error

If 'vm->def->sec->sectype' would be invalid; which is currently not
possible; we'd not unlock the domain object. Fix the logic even when the
bug currently can't happen.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agosrc: expand docs for guest stats constant version handling
Daniel P. Berrangé [Wed, 5 Mar 2025 15:24:31 +0000 (15:24 +0000)] 
src: expand docs for guest stats constant version handling

Explain that the 11.2.0 release dates are mostly reflecting when the
constant was first added, not when the key was introduced.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: expand docs for guest stats array handling
Daniel P. Berrangé [Wed, 5 Mar 2025 15:24:31 +0000 (15:24 +0000)] 
src: expand docs for guest stats array handling

Give an overview of how arrays are handled and represented in
the typed parameters returned by the guest stats API.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: document that no constants are provided for custom VM stats
Daniel P. Berrangé [Fri, 28 Feb 2025 13:42:48 +0000 (13:42 +0000)] 
src: document that no constants are provided for custom VM stats

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for domain stats 'dirtyrate.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'dirtyrate.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for domain stats 'memory.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'memory.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for domain stats 'iothread.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'iothread.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for domain stats 'perf.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'perf.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for domain stats 'block.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'block.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for domain stats 'net.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'net.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for domain stats 'vcpu.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'vcpu.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for domain stats 'balloon.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'balloon.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for domain stats 'cpu.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'cpu.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for domain stats 'state.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for domain stats 'state.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the domain stats data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the domain stats
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: expand docs for guest info constant version handling
Daniel P. Berrangé [Wed, 5 Mar 2025 15:24:31 +0000 (15:24 +0000)] 
src: expand docs for guest info constant version handling

Explain that the 11.2.0 release dates are mostly reflecting when the
constant was first added, not when the key was introduced.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: expand docs for guest info array handling
Daniel P. Berrangé [Wed, 5 Mar 2025 15:24:31 +0000 (15:24 +0000)] 
src: expand docs for guest info array handling

Give an overview of how arrays are handled and represented in
the typed parameters returned by the guest info API.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for guest info 'load.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for guest info 'load.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the guest info data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the guest info
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for guest info 'if.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for guest info 'if.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the guest info data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the guest info
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for guest info 'disk.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for guest info 'disk.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the guest info data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the guest info
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for guest info 'fs.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for guest info 'fs.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the guest info data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the guest info
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constant for the guest info 'hostname' parameter
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constant for the guest info 'hostname' parameter

Contrary to most APIs returning typed parameters, there are no constants
defined for the guest info data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the guest info
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for guest info 'timezone.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for guest info 'timezone.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the guest info data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the guest info
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for guest info 'os.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for guest info 'os.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the guest info data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the guest info
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agosrc: add constants for guest info 'user.' parameters
Daniel P. Berrangé [Thu, 27 Feb 2025 13:42:08 +0000 (13:42 +0000)] 
src: add constants for guest info 'user.' parameters

Contrary to most APIs returning typed parameters, there are no constants
defined for the guest info data keys. This is was because many of the
keys needs to be dynamically constructed using one or more array index
values.

It is possible to define constants while still supporting dynamic
array indexes by simply defining the prefixes and suffixes as constants.
The consuming code can then combine the constants with array index
value.

With this approach, it is practical to add constants for the guest info
API keys.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 months agoqemu: snapshot: error out early when reverting snapshot for VM with non-file disk
Pavel Hrdina [Wed, 26 Feb 2025 10:04:52 +0000 (11:04 +0100)] 
qemu: snapshot: error out early when reverting snapshot for VM with non-file disk

Before this patch the code would start the revert process by destroying
the VM and preparing to revert where it would fail with following error:

    error: unsupported configuration: source for disk 'sdb' is not a regular file; refusing to generate external snapshot name

and leaving user with offline VM even if it was running.

Make the check before we start the revert process to not destroy VMs.

Resolves: https://issues.redhat.com/browse/RHEL-30971
Resolves: https://issues.redhat.com/browse/RHEL-79928
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agosecurity: Don't stop restoring labels too early
Michal Privoznik [Tue, 11 Mar 2025 12:49:21 +0000 (13:49 +0100)] 
security: Don't stop restoring labels too early

The point of virSecurityManagerRestoreAllLabel() function is to
restore ALL labels and be tolerant to possible errors, i.e.
continue restoring seclabels and NOT return early.

Well, in two implementations of this internal API this type of
problem was found:

1) virSecurityDACRestoreAllLabel() returned early if
   virSecurityDACRestoreGraphicsLabel() failed, or when
   def->sec->sectype equals to an impossible value.

2) virSecuritySELinuxRestoreAllLabel() returned early if
   virSecuritySELinuxRestoreMemoryLabel() failed.

Fix all three places.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agodocs: Correct dbus graphics' accepted p2p values
Martin Kletzander [Tue, 11 Mar 2025 12:13:55 +0000 (13:13 +0100)] 
docs: Correct dbus graphics' accepted p2p values

The attribute is used (and formatted) as virTristateBool() and even in
schema defined as virYesNo, so the values are supposed to be `yes` and
`no`.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agotests: update capabilities for QEMU 9.2.0 on s390x
Shalini Chellathurai Saroja [Tue, 11 Mar 2025 12:49:10 +0000 (13:49 +0100)] 
tests: update capabilities for QEMU 9.2.0 on s390x

Update the replies and xml files for QEMU 9.2.0 on s390x based on
the released QEMU tag v9.2.0 with commit Id
ae35f033b874c627d81d51070187fbf55f0bf1a7.

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>
5 months agoesx: Refactor esxVI_LookupHostScsiTopologyLunListByTargetName
Jiri Denemark [Tue, 11 Mar 2025 09:35:58 +0000 (10:35 +0100)] 
esx: Refactor esxVI_LookupHostScsiTopologyLunListByTargetName

With a specific combination of compiler options gcc reported the
following bogus warning (I added a context to it to make the issue
visible):

../src/esx/esx_vi.c: In function ‘esxVI_LookupHostScsiTopologyLunListByTargetName’:
../src/esx/esx_vi.c:4674:32: error: potential null pointer dereference [-Werror=null-dereference]
 4671 |     if (!found || !hostScsiTopologyTarget)
 4672 |         goto cleanup;
 4673 |
 4674 |     if (!hostScsiTopologyTarget->lun) {
      |          ~~~~~~~~~~~~~~~~~~~~~~^~~~~

Most likely this is caused by found and hostScsiTopologyTarget doing
essentially the same thing as found is true if and only if
hostScsiTopologyTarget is non-NULL. The found variable is completely
redundant. Removing it would be enough, but I decided to make the code a
little bit easier to read by not using the iterator variable directly.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 months agoch: Enable SEV SNP support
Praveen K Paladugu [Tue, 11 Feb 2025 19:18:20 +0000 (13:18 -0600)] 
ch: Enable SEV SNP support

Enable SEV-SNP support for ch guests.

Co-Authored-by: Smit Gardhariya <sgardhariya@microsoft.com>
Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoutil: Introduce virStringFormatHex
Praveen K Paladugu [Tue, 11 Feb 2025 19:18:19 +0000 (13:18 -0600)] 
util: Introduce virStringFormatHex

virStringFormatHex converts an input byte array into hex string and
returns it.

Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agosecurity: Set seclabels on UEFI shim
Michal Privoznik [Wed, 5 Mar 2025 14:47:39 +0000 (15:47 +0100)] 
security: Set seclabels on UEFI shim

Again, trivial. Just copy what is done for kernel and initrd.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 months agoqemu_command: Generate cmd line for UEFI shim
Michal Privoznik [Wed, 5 Mar 2025 14:29:04 +0000 (15:29 +0100)] 
qemu_command: Generate cmd line for UEFI shim

Trivial.

Resolves: https://issues.redhat.com/browse/RHEL-68043
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 months agoqemu_validate: Check whether UEFI shim is supported
Michal Privoznik [Wed, 5 Mar 2025 14:04:21 +0000 (15:04 +0100)] 
qemu_validate: Check whether UEFI shim is supported

If UEFI shim is specified in domain XML but QEMU is too old, then
report an error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 months agoqemu_capabilities: Introduce QEMU_CAPS_MACHINE_SHIM
Michal Privoznik [Wed, 5 Mar 2025 12:40:04 +0000 (13:40 +0100)] 
qemu_capabilities: Introduce QEMU_CAPS_MACHINE_SHIM

In its commit v9.2.0-323-ga5bd044b15 QEMU introduced another
command line option: -shim. It's used to load kernel. Track
presence of it via QEMU_CAPS_MACHINE_SHIM.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 months agoconf: Introduce os/shim element
Michal Privoznik [Tue, 4 Mar 2025 14:46:13 +0000 (15:46 +0100)] 
conf: Introduce os/shim element

For secure boot environments where <loader/> is signed, it may be
unfeasible to keep the binary up to date (esp. when revoking
certificates contained within). To address that, QEMU introduced
'-shim' cmd line option which side loads another UEFI binary
which can then contain new certification authorities or list of
revocations. Expose it as <shim/> element that's nested under
<os/>, just like kernel and initrd are.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 months agoqemucapabilitiestest: Add data for the qemu-10.0 dev cycle on x86_64 for the '+amdsev...
Peter Krempa [Mon, 24 Feb 2025 15:52:20 +0000 (16:52 +0100)] 
qemucapabilitiestest: Add data for the qemu-10.0 dev cycle on x86_64 for the '+amdsev' variant

Add data based on 'v9.2.0-2369-g98c7362b1e'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoqemucapabilitiestest: Update 'caps_10.0.0_x86_64' to 'v9.2.0-2369-g98c7362b1e'
Peter Krempa [Mon, 24 Feb 2025 15:52:20 +0000 (16:52 +0100)] 
qemucapabilitiestest: Update 'caps_10.0.0_x86_64' to 'v9.2.0-2369-g98c7362b1e'

Notable changes:
 - 'uefi-vars-x64', 'uefi-vars-sysbus' qom type added
 - 'YongFeng-v1-x86_64-cpu' added
 - 'accel' qom type removed
 - 'addr' field of devices changed type to 'str'
 - 'vfio-pci' gained experimental feature 'x-migration-multifd-transfer'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoqemu: block: Drop 'sheepdog' protocol support
Peter Krempa [Mon, 10 Mar 2025 09:17:16 +0000 (10:17 +0100)] 
qemu: block: Drop 'sheepdog' protocol support

As now no supported qemu version supports the 'sheepdog' protocol drop
the code for configuring the blockdev layer.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoqemu: capabilities: Bump minimum qemu to qemu-6.2
Peter Krempa [Fri, 7 Mar 2025 15:56:05 +0000 (16:56 +0100)] 
qemu: capabilities: Bump minimum qemu to qemu-6.2

Following minimum versions are needed based on our support policy:

             CentOS Stream 9: 9.1
                   Debian 12: 7.2
                   Fedora 40: 8.2
          openSUSE Leap 15.6: 8.2
                Ubuntu 22.04: 6.2
               FreeBSD ports: 9.2
              macOS homebrew: 9.2
              macOS macports: 9.2

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoqemucapabilitiesdata: Drop un-updated 'qemu_8.0.0_riscv64' data
Peter Krempa [Fri, 7 Mar 2025 16:00:12 +0000 (17:00 +0100)] 
qemucapabilitiesdata: Drop un-updated 'qemu_8.0.0_riscv64' data

The riscv64 qemu-8.0 data were not updated to the release version. Drop
them instead of trying to do archaeology.

They are not used in any 'qemuxmlconftest' case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoqemucapabilitiesdata: Drop un-updated 'caps_7.0.0_aarch64' data
Peter Krempa [Mon, 10 Mar 2025 09:28:45 +0000 (10:28 +0100)] 
qemucapabilitiesdata: Drop un-updated 'caps_7.0.0_aarch64' data

The aarch-64 qemu-7.0 data were not updated to the release version. Drop
them instead of trying to do archaeology.

They are not used in any 'qemuxmlconftest' case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoqemucapabilitiesdata: Drop un-updated 'qemu_6.2.0_aarch64' data
Peter Krempa [Fri, 7 Mar 2025 16:00:12 +0000 (17:00 +0100)] 
qemucapabilitiesdata: Drop un-updated 'qemu_6.2.0_aarch64' data

We'll be bumping to qemu-6.2 as minimum and the aarch64 qemu-6.2 data
were not updated to the release version. Drop them instead of trying to
do archaeology.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoqemucapabilitiestest: Drop unused fake data 'caps_7.0.0_aarch64+hvf'
Peter Krempa [Mon, 10 Mar 2025 09:24:59 +0000 (10:24 +0100)] 
qemucapabilitiestest: Drop unused fake data 'caps_7.0.0_aarch64+hvf'

The 'caps_7.0.0_aarch64+hvf' caps dump is fake; obtained from copying
and doctoring the 'caps_7.0.0_aarch64' file (see commit 12aedb414578d3 )

Remove it now that it was superseded by a dump obtained from a proper
hvf-enabled host.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoqemucapabilitiestest: Add 'qemu_9.2.0.aarch64+hvf' test data
Peter Krempa [Mon, 10 Mar 2025 09:02:40 +0000 (10:02 +0100)] 
qemucapabilitiestest: Add 'qemu_9.2.0.aarch64+hvf' test data

The data is collected from an MacOS host with latest released qemu from
homebrew.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoqemucapabilitiestest: Drop qemu-6.1 data
Peter Krempa [Fri, 7 Mar 2025 15:54:18 +0000 (16:54 +0100)] 
qemucapabilitiestest: Drop qemu-6.1 data

Soon we'll bump to qemu-6.2 as minimum.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoqemucapabilitiestest: Drop qemu-6.0 data
Peter Krempa [Fri, 7 Mar 2025 15:54:18 +0000 (16:54 +0100)] 
qemucapabilitiestest: Drop qemu-6.0 data

Soon we'll bump to qemu-6.2 as minimum.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoqemucapabilitiestest: Drop qemu-5.2 data
Peter Krempa [Fri, 7 Mar 2025 15:54:18 +0000 (16:54 +0100)] 
qemucapabilitiestest: Drop qemu-5.2 data

Soon we'll bump to qemu-6.2 as minimum.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>