1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 07:59:00 +00:00

51997 Commits

Author SHA1 Message Date
Peter Krempa
f48fb17d72 qemuHotplugRemoveManagedPR: Integrate check whether removal is needed
Calls to 'qemuHotplugRemoveManagedPR' needed to be guarded by a check if
the removed elements actually caused us to add the manager in the first
place.

The two new calls added in commit 1697323bfe6000c2f5a2519c06f0ba81 were
not guarded by such check and thus would spam the debug log with:

  [{"id": "libvirt-59", "error": {"class": "GenericError", "desc": "object 'pr-helper0' not found"}}]

Luckily 'qemuHotplugRemoveManagedPR' didn't request the error to be
reported as a proper error.

Don't attempt the removal unless needed.

Fixes: 1697323bfe6000c2f5a2519c06f0ba81f7b792eb
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2025-03-20 06:42:43 +01:00
Peter Krempa
ad94d8fb19 qemuDomainChangeEjectableMedia: Separate rollback and success code paths
Do not use the rollback code path on success just to avoid extra call to
qemuHotplugRemoveManagedPR.

Rename the label and use it only when rolling back.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2025-03-20 06:42:43 +01:00
Peter Krempa
1f00a208ea qemu: Remove return value from 'qemuHotplugRemoveManagedPR'
The only place which actually checked the return value would skip code
e.g. to delete unused files or stop no longer used services. The rest of
the callers ignored the value.

As this is expected to be used on cleanup code paths which have no
possibility to report errors we should remove the return value
completely.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2025-03-20 06:42:43 +01:00
Peter Krempa
d87e5a1de1 qemu: Do not replace filter nodes with virDomainBlockCopy
The block copy operation is supposed to just move the disk to a new
destination. While in certain scenarios it'd make sense to drop the
copy-on-read layer, the definition would not correspond to it.

This was caused by a fix to the behaviour of the block job after
conversion to -blockdev as 'blockdev-mirror' requires the top node of
the disk to be selected. This also causes that the 'copy-on-read' filter
is ejected but libvirt doesn't unplug it.

Instead we need to use the 'replaces' argument of 'blockdev-mirror'
which allows to keep filters in place. This will preserve the
configuration (which can be optimized later) and also fixes a spurious
error logged when trying to unplug the first real file node after
copy-on-read which still looks used to qemu.

This is also needed for the upcoming feature which adds 'throttle'
filter layers as we need to keep those in place too to facilitate the
throttling.

Resolves: https://issues.redhat.com/browse/RHEL-40077
Fixes: e3137539a9c4af25ab085506d5467ec0847b0ecc
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2025-03-20 06:42:43 +01:00
Peter Krempa
ca429f102c qemu: monitor: Wire up 'replaces' attribute for 'blockdev-mirror'
The 'replaces' field controls which node will be replaced by the job.
This can be used to e.g. keep filter nodes in place after the copy
finishes.

This will be used to keep the 'copy-on-read' and 'throttle' layers in
place after a copy.

This patch wires up the monitor and test, but the real callers pass NULL
for now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2025-03-20 06:42:43 +01:00
Peter Krempa
6ccf67f5a7 NEWS: Mention multiple iothread support for 'virtio-scsi' controller
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-03-19 15:38:00 +01:00
Peter Krempa
a4cbad35c9 qemuxmlconftest: Add 'iothreads-virtio-scsi-mapping' case
Test the XML and commandline for iothread<->virtqueue mapping for
'virtio-scsi' controllers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-03-19 15:38:00 +01:00
Peter Krempa
adb812f068 qemu: Implement support for iothread <-> virtqueue mapping for 'virtio-scsi' controllers
Similarly to 'virtio-blk' users can map multiple iothreads and pin them
appropriately for 'virtio-scsi' controllers to ensure the best
performance.

Implement the validation and command line generation based on the
helpers we have for 'virtio-blk'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-03-19 15:38:00 +01:00
Peter Krempa
9c4664e8e5 conf: Add support for iothread to queue mapping config for 'virtio-scsi'
Upcoming qemu release will support configuring mapping iothreads to
virtio queues for 'virtio-scsi' controllers in order to improve
performance.

Reuse the infrastructure we have from the same configuration for
'virti-blk' to implement the conf support for this feature.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-03-19 15:38:00 +01:00
Peter Krempa
285ae7feb3 qemu: capabilities: Introduce QEMU_CAPS_VIRTIO_SCSI_IOTHREAD_MAPPING
The 'virtio-scsi' controller now supports iothread<->virtqueue mapping
configuration.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-03-19 15:38:00 +01:00
Peter Krempa
d2414079f7 qemucapabilitiestest: Update 'caps_10.0.0_x86_64' to v9.2.0-2799-g0462a32b4f
Notable changes:
 - 'virtio-scsi' supports 'iothread-vq-mapping'
 - 'vfio-pci' device gained two unstable options 'x-igd-legacy-mode'
   and 'x-igd-lpc'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-03-19 15:38:00 +01:00
Ján Tomko
815c22a3a7 conf: also free auth for rdp in virDomainGraphicsDefFree
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: bfa7d5aaa8834c6801cacbfc6c6ea83a8ecaca9c
2025-03-18 19:03:00 +01:00
Ján Tomko
cae2d23a83 qemu: remove unreachable breaks in qemuDomainAssignMemoryDeviceSlot
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2025-03-18 18:01:33 +01:00
Boris Fiuczynski
9ef080d6d9 qemu_domain_address: fix CCW virtio-mem hotplug
Since commit f23f8ff91a virtio-mem supports also CCW. When hotplugging a
virtio-mem device with a CCW address results in a PCI device getting
attached. The method qemuDomainAssignMemoryDeviceSlot is only
considering PCI as address type and overwriting the CCW address. Adding
support for address type CCW.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2025-03-18 17:59:33 +01:00
Marc-André Lureau
be30b8eef9 tests: add qemu <graphics type='rdp'/> test
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:56 +01:00
Marc-André Lureau
d80f1f8e63 qemu: add RDP support
Wire the external server RDP support with QEMU.

Check the configuration, allocate a port, start the process
and set the credentials.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:56 +01:00
Marc-André Lureau
f5e5a9bec9 qemu: add 'rdp' capability if qemu-rdp is available
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:56 +01:00
Marc-André Lureau
e008d229f4 qemu: pass virQEMUDriverConfig to capabilities
This will help with the following patch, which also requires config access.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:56 +01:00
Marc-André Lureau
469e161946 qemu: add qemu-rdp helper unit
Helpers to start the qemu-rdp server and set it up.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:56 +01:00
Marc-André Lureau
cdee56a955 qemu: validate RDP configuration
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:56 +01:00
Marc-André Lureau
507be3425b qemu/dbus: log daemon stdout/err, use domainLogContext
Currently, if dbus-daemon writes on errfd, it will SIGPIPE.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:56 +01:00
Marc-André Lureau
dbfb96d18c qemu/dbus: keep a connection to the VM D-Bus
The following changes are going to communicate with the qemu-rdp server
through the VM D-Bus bus, keep a connection for that and further usage.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:56 +01:00
Marc-André Lureau
3af8f135e9 qemu/virtiofs: use domainLogContext
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:56 +01:00
Marc-André Lureau
a4d8df93ce qemu: limit to one <graphics type='rdp'>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:56 +01:00
Marc-André Lureau
cab7d25371 qemu: add RDP ports range allocator
RDP server uses port 3389 by default.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:56 +01:00
Marc-André Lureau
14146b05b6 qemu: use virDomainDefHasGraphics
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:56 +01:00
Marc-André Lureau
97829d016d conf: generalize virDomainDefHasSpiceGraphics
Generalize the function, broaden its potential usage.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:56 +01:00
Marc-André Lureau
bfa7d5aaa8 conf: parse optional RDP username & password
Like VNC, allow to set credentials for RDP.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:55 +01:00
Marc-André Lureau
bd5f4d3237 qemu: add qemu RDP configuration
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:55 +01:00
Marc-André Lureau
12d7b9fe26 qemu: add rdp state directory
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:55 +01:00
Marc-André Lureau
ebdcec7dc9 util: annotate non-null arguments for virGDBusCallMethod()
Helps avoid/debug a potential SEGV if conn is NULL, since gio will not
set the "gerror" in that case and we will crash later at:
  virReportError(VIR_ERR_DBUS_SERVICE, "%s", gerror->message);

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:55 +01:00
Marc-André Lureau
de9b1f0e72 qemu-slirp: drop unneeded check for OOM
glib anti-pattern, since it aborts on OOM.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:55 +01:00
Marc-André Lureau
44089b4eea build: fix -Werror=maybe-uninitialized
When compiled with -Doptimization=g

../tools/nss/libvirt_nss_macs.c:155:8: error: ‘jerr’ may be used uninitialized [-Werror=maybe-uninitialized]
  155 |     if (jerr == json_tokener_continue) {
      |        ^

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:55 +01:00
Marc-André Lureau
7253dda517 build-sys: drop -Winline when optimization=g
The warning is triggered when compiling with various build options, such
as -Doptimization=g.

From gcc(1) man page about -Winline:
seemingly insignificant changes in the source program can cause the warnings produced by -Winline to appear or disappear.

Such flaky behaviour is best left to the user discretion.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-18 14:15:55 +01:00
Martin Kletzander
7dcfa95e47 news: Add item for guest load averages
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2025-03-18 12:22:29 +01:00
Daniel P. Berrangé
acf2f9e1ef src: add new target for regenerating protocol structs files
Introduce a new ninja target

   ninja -C build regen-{PROTO}

eg

   ninja -C build regen-admin_protocol

that will re-create the reference output file based on what the
current pdwtags command emits. A small change is made to squash
whitespace on enum declarations so that introducing a new longer
enum name doesn't trigger re-indent of all existing enum names.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2025-03-18 09:21:20 +00:00
Daniel P. Berrangé
dcd1132937 src: normalize whitespace in protocol structs files
This makes the output match what current pdwtags will emit,
modulo some whitespace changes made by the check script
before comparison.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2025-03-18 09:20:57 +00:00
Kirill Shchetiniuk
fc201e0fcc 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>
2025-03-17 14:11:15 +01:00
Kirill Shchetiniuk
1db1244752 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>
2025-03-17 14:02:45 +01:00
Thomas Huth
5a20684788 docs: Fix some typos
Found with the codespell utility.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-03-17 12:37:48 +01:00
Daniel P. Berrangé
01a7e84be9 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>
2025-03-17 11:36:31 +00:00
Daniel P. Berrangé
cb3a6e8806 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>
2025-03-17 11:35:54 +00:00
Daniel P. Berrangé
40c0c9c838 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>
2025-03-17 11:34:12 +00:00
Laine Stump
4c979edaa5 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>
2025-03-14 13:43:44 -04:00
Ján Tomko
902237664f 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>
2025-03-14 16:23:36 +01:00
Ján Tomko
c6f0819f1d 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>
2025-03-14 16:23:36 +01:00
Ján Tomko
5c52740587 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>
2025-03-14 16:23:35 +01:00
Ján Tomko
cda322b8b2 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>
2025-03-14 16:23:35 +01:00
Ján Tomko
fc43efc312 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>
2025-03-14 16:23:35 +01:00
Ján Tomko
7e0fbdf91d 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>
2025-03-14 16:23:35 +01:00