Commit Graph

49953 Commits

Author SHA1 Message Date
Jiri Denemark
2a6799fd43 build: Add userfaultfd_sysctl build option
This option controls whether the sysctl config for enabling unprivileged
userfaultfd will be installed.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-13 17:44:26 +01:00
Jiri Denemark
66643931e7 qemu: Add support for /dev/userfaultfd
/dev/userfaultfd device is preferred over userfaultfd syscall for
post-copy migrations. Unless qemu driver is configured to disable mount
namespace or to forbid access to /dev/userfaultfd in cgroup_device_acl,
we will copy it to the limited /dev filesystem QEMU will have access to
and label it appropriately. So in the default configuration post-copy
migration will be allowed even without enabling
vm.unprivileged_userfaultfd sysctl.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-13 17:44:26 +01:00
Timothée Ravier
a2c3e390f7 qemu: Add sysusers config file for qemu & kvm user/groups
Install a systemd sysusers config file for the qemu & kvm user/groups.

We can not use the sysusers_create_compat macro in the RPM specfile to
create those users as we want to keep the specfile standalone and not
relying on additionnal files.

Update the specfile to make the commands closer to what is generated by
the current macro.

See: https://src.fedoraproject.org/rpms/libvirt/pull-request/22
See: https://gitlab.com/libvirt/libvirt/-/merge_requests/319
See: https://bugzilla.redhat.com/show_bug.cgi?id=2095429
See: https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/

Based on previous work by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Timothée Ravier <tim@siosm.fr>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-02-13 16:59:57 +01:00
Peter Krempa
21b62329f3 docs: gitlab redirects: Drop '/libvirt' prefix for hosting the web through gitlab pages
The prefix needs to be dropped for the redirects to work properly once
hosting 'libvirt.org' via gitlab pages.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2024-02-13 16:56:49 +01:00
Michal Privoznik
d96a414c03 secret_conf: Modernize XML parsing & formatting
Our virSecret XML is still parsed and formatted using old way
(e.g. virXPathString() + virXXXTypeFromString() combo, or
formatting elements using plain virBufferAsprintf() instead of
virXMLFormatElement()). Modernize the code as it'll make it
easier for future expansion.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-13 16:11:21 +01:00
Michal Privoznik
bad17c4d88 virSecretDef: Convert 'usage_type' field to proper enum type
Convert the field and adjust the XML parsers to use
virXMLPropEnum().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-13 16:11:17 +01:00
Michal Privoznik
6db5362a30 secret_conf: Simplify calling of virSecretDefParseUsage()
The virSecretDefParseUsage() function is called conditionally.
Call it unconditionally and keep pointer to the <usage/> node as
it'll come handy soon.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-13 16:11:12 +01:00
Michal Privoznik
63a416f3a1 viraccessdriverpolkit: Add missing vtpm case
When adding vtpm virSecret usage type (in v5.6.0-rc1~61) we
forgot to update polkit access check. This limited user's ability
to match secrets in their rules. Add missing case into switch in
virAccessDriverPolkitCheckSecret().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-13 16:11:00 +01:00
Jonathon Jongsma
94365a4871 qemu: handle adding/removing nbdkit-backed disk sources
Previously we were only starting or stopping nbdkit when the guest was
started or stopped or when hotplugging/unplugging a disk. But when doing
block operations, the disk backing store sources can also be be added or
removed independently of the disk device. When this happens the nbdkit
backend was not being handled properly. For example, when doing a
blockcopy from a nbdkit-backed disk to a new disk and pivoting to that
new location, the nbdkit process did not get cleaned up properly. Add
some functionality to qemuDomainStorageSourceAccessModify() to handle
this scenario.

Since we're now starting nbdkit from the ChainAccessAllow/Revoke()
functions, we no longer need to explicitly start nbdkit in hotplug code
paths because the hotplug functions already call these allow/revoke
functions and will start/stop nbdkit if necessary.

Add a check to qemuNbdkitProcessStart() to report an error if we
are trying to start nbdkit for a disk source that already has a running
nbdkit process. This shouldn't happen, and if it does it indicates an
error in another part of our code.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-02-12 16:13:17 -06:00
Jonathon Jongsma
4495ec7d9b qemu: roll back if not all nbdkit backends are successful
When starting nbdkit processes for the backing store of a disk, we were
returning an error if any backing store failed, but we were not cleaning
up processes that succeeded higher in the chain. Make sure that if we
return a failure status from qemuNbdkitStartStorageSource() that we roll
back any processes that had been started.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-02-12 16:13:17 -06:00
Jonathon Jongsma
7a03785d88 qemu: add a 'chain' parameter to nbdkit start/stop
This will allow us to start or stop nbdkit for just a single disk source
or for every source in the backing chain. This will be used in following
patches.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-02-12 16:13:17 -06:00
Andrea Bolognani
20a5f77156 tests: Add capabilities for QEMU 8.2.0 on s390x
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-02-12 11:28:14 +01:00
Andrea Bolognani
f9ed4d385a tests: Update capabilities for QEMU 8.1.0 on s390x
The existing capabilities were generated against a build made
quite early in the QEMU 8.1.0 development cycle. Update them
to match the final release.

A notable effect of this is that the recently introduced
s390-usb-model test now passes instead of failing: QEMU 8.1.0
enables several new devices on s390x, including the qemu-xhci
USB controller.

There's a small amount of additional churn caused by the fact
that the machine on which I have generated these capabilities
is apparently slightly less fancy than the one used originally.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-02-12 11:28:12 +01:00
Andrea Bolognani
6e58fba9e4 tests: Add s390-usb-model
Show what happens when trying to use a specific type of USB
controller. This currently fails because the QEMU binary doesn't
include the necessary device.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-02-12 11:28:11 +01:00
Andrea Bolognani
c1ae871893 tests: Minimize s390-usb-*
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-02-12 11:28:09 +01:00
Andrea Bolognani
44257d1e93 tests: Rename s390-usb-*
These tests currently cover the scenarios in which the guest
can end up with no USB controller, one of which is specific
to s390x. We are going to add more USB on s390x scenarios, so
a different naming convention is needed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-02-12 11:28:04 +01:00
Jonathon Jongsma
bdece5518d qemu: fix nbdkit command test for backing chains
Previously this test only tested the generated nbdkit command for the
top level disk source. Update it to test the generated commmands for all
sources in the chain.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-02-09 14:45:20 -06:00
Ján Tomko
a883602c9a ci: regenerate
Regenerate the ci files using the latest libvirt-ci:
commit 5b9b11261fa28cae964fd91638056318f270e300
    examples: illustrate use of remote project reference

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-02-09 13:23:06 +01:00
Ján Tomko
aeadf4f9dc ci: lcitool: sync dependencies with libvirt-ci repo
libvirt commit 120a674f25
    ci: lcitool: Maintain project package deps lists here

added an override file for lcitool in August, but nobody regenerating
libvirt's ci files from the manifest seemed to use the override dir.

libvirt-ci commit 1f4184edfdd541964a187810b34ac4c7702b6577
    commandline: set --extra-data-dir default path
from January made $PWD/ci/lcitool the default.

Reflect the changes made in libvirt-ci's repo here too.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2024-02-09 13:23:06 +01:00
Andrea Bolognani
3f01ecd830 docs: Improve documentation for dies and clusters
I've seen examples in the wild of the cluster attribute having
non-zero value on x86_64.

This is obviously quite confusing, but it's the information that
Linux exposes to userspace and we don't really have a way to tell
apart a valid die/cluster ID from a dummy one.

What ultimately matters is that the underlying assumptions about
topology are respected, which they are: in the x86_64 cases that
I have analyzed, for example, each "cluster" contained exactly
one core, so any program that would use this information to
influence guest topology decisions would be unaffected by the
additional level showing up in the hierarchy.

In an attempt to reduce confusion, remove any reference to any
specific value for the attributes having any special meaning
attached to it.

In fact, since there are plans to make it possible to create
guests with multiple CPU clusters on x86_64, rework the note
into a more generic warning cautioning users that an attribute
showing up here does not imply that the same attribute can be
used when defining a guest CPU topology.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2024-02-08 18:41:47 +01:00
Peter Krempa
c4e35af08c docs: page.xsl: Split up 'href_base' for assets and links
To allow reuse of this template as-is in libvirt-wiki, we need to be
able to specify a distinct asset_href_base and link_href_base. Adjust
the template to allow that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-08 16:48:47 +01:00
Peter Krempa
334858bd40 docs: xsl: Properly propagate 'href_base' as XSL template parameter
Propagate it as a parameter both from site.xsl and from newapi.xsl, the
latter of which declared it as a variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-08 16:48:47 +01:00
Peter Krempa
8c0e313339 docs: Move 'html including' from page.xsl to site.xsl
Strip down the main template as much as possible.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-08 16:48:47 +01:00
Peter Krempa
799e38ef31 css: Move generic styles to 'generic.css'
Move the few generic styles to the appropriate document. 'libvirt.css'
will now be a compilation of styles related only to libvirt.org.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-08 16:48:47 +01:00
Peter Krempa
93030fa381 css: Move styles for the generated API documents to libvirt-api.css
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-08 16:48:47 +01:00
Peter Krempa
e460a37512 css: Remove unused CSS for migration support matrix table
The 'table tbody td.y' and 'table tbody td.n' selectors don't exist
since commit 8841302e3d which converted
the table to rST.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-08 16:48:47 +01:00
Peter Krempa
5dfc6e4e47 css: Split out page templated styles to 'libvirt-template.css'
Separate the styles related to the main page template and the build
process specifics (docutils-originated) into a separate CSS file.

Hint: Best viewed with 'git show --color-moved=blocks'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-08 16:48:47 +01:00
Peter Krempa
52145c8997 css: mobile: Split up libvirt.org specific styles from main template style
Separate the libvirt.org specific stuff from the main template style so
that the latter can be reused in libvirt-wiki without modification.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-08 16:48:47 +01:00
Peter Krempa
753a6add46 js: Separate the virt-tools blog planet loader code
In order to promote simple assets sharing between main libvirt web and
the libvirt-wiki separate the virt tools blog feed loader from the main
code used for search.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-08 16:48:47 +01:00
Peter Krempa
da851ed184 docs: page.xsl: Fix headerlinks with new docutils
New docutils generates a <section> element rather than a <div
class='section'> as it did before thus breaking our headerlink
generator.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-08 16:48:46 +01:00
Peter Krempa
01455a9f05 gitlab_pages: Fix 'maven' redirect
The redirect to the 'maven' repository of libvirt doesn't work currently
for libvirt pages as the ':splat' replacement doesn't match due to a
missing '/'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-08 16:48:46 +01:00
Michal Privoznik
9ef6541cec examples: Define _GNU_SOURCE for more examples
Some of our examples use GNU/Linux extensions functions/variables:

1) domtop.c uses usleep(3),
2) logging.c uses getopt(3).

Put _GNU_SOURCE definition at the top of corresponding files so
that users can just grab the code and compile it (in contrast
with the rest of the code where _GNU_SOURCE is declared in
meson-config.h).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-07 18:01:03 +01:00
Michal Privoznik
ce41108ecc virsh-domain: Fix return of virshGetDBusDisplay() in one error path
The virshGetDBusDisplay() function is declared to return a
pointer and yet, in one error path false is returned. Switch the
statement to return NULL, which is what other error paths use to
indicate an error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-07 18:01:03 +01:00
Göran Uddeborg
27b8b035a6 Translated using Weblate (Swedish)
Currently translated at 67.2% (7022 of 10447 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 67.0% (7002 of 10447 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2024-02-07 15:04:10 +01:00
Jiri Denemark
d03e6c8536 NEWS: Mention systemd-resolved support in network driver
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-07 14:19:42 +01:00
Jiri Denemark
43c0325b10 network: Make virtual domains resolvable from the host
This patch adds a new attribute "register" to the <domain> element. If
set to "yes", the DNS server created for the virtual network is
registered with systemd-resolved as a name server for the associated
domain. The names known to the dnsmasq process serving DNS and DHCP
requests for the virtual network will then be resolvable from the host
by appending the domain name to them.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-07 14:19:42 +01:00
Jiri Denemark
22ba0b39ff tests: Add tests for virSystemdResolvedRegisterNameServer
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-07 14:19:42 +01:00
Jiri Denemark
6b5c0ea45a util: Introduce virSystemdResolvedRegisterNameServer
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-07 14:19:42 +01:00
Jiri Denemark
55996822b1 util: Introduce virSocketAddrBytes
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-07 14:19:42 +01:00
Jiri Denemark
6a5f21632f util: Introduce virSystemdHasResolved
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-07 14:19:42 +01:00
Jiri Denemark
3869c2a281 util: Unify virSystemdHas{Machined,Logind}
When checking for machined we do not really care whether systemd itself
is running, we just need machined to be either running or socket
activated by systemd. That is, exactly the same we do for logind.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-07 14:19:42 +01:00
Michal Privoznik
f2a5494fbd qemu_monitor: Simplify qemuMonitorIOWriteWithFD()
After previous cleanups, qemuMonitorIOWriteWithFD() is but a thin wrapper
over virSocketSendMsgWithFDs(). Replace the body of the former
with a call to the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-07 12:35:02 +01:00
Michal Privoznik
91f4ebbac8 virsocket: Simplify virSocketSendFD()
After previous cleanups, virSocketSendFD() is but a thin wrapper
over virSocketSendMsgWithFDs(). Replace the body of the former
with a call to the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-07 12:34:54 +01:00
Michal Privoznik
495a826dbf virSocketSendMsgWithFDs: Introduce @payload_len argument
Instead of using strlen() to calculate length of payload we're
sending, let caller specify the size: they may want to send just
a portion of a buffer (even though the only current user
doesn't).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-07 11:01:30 +01:00
Michal Privoznik
e82f99283d virSocketSendMsgWithFDs: Don't report errors, just set errno
Currently, virSocketSendMsgWithFDs() reports two errors:

1) if CMSG_FIRSTHDR() fails,
2) if sendmsg() fails.

Well, the latter sets an errno, so caller can just use
virReportSystemError(). And the former - it is very unlikely to
fail because memory for whole control message was allocated just
a few lines above.

The motivation is to unify behavior of virSocketSendMsgWithFDs()
and virSocketSendFD() because the latter is just a subset of the
former (will be addressed later).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-07 10:57:00 +01:00
Göran Uddeborg
b051762e3e Translated using Weblate (Swedish)
Currently translated at 66.6% (6962 of 10447 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 66.0% (6902 of 10447 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2024-02-04 22:36:00 +01:00
Peter Krempa
442061583e virt-admin: Add warning when connection to default daemon fails
The admin connection defaults to the system-wide 'libvirtd' daemon to
manage (libvirtd:///system). As we've now switched to modular daemons
this will not work for most users out of the box:

 $ virt-admin version
 error: Failed to connect to the admin server
 error: no valid connection
 error: Failed to connect socket to '/run/user/1000/libvirt/libvirt-admin-sock': No such file or directory

As we don't want to assume which daemon the user wants to manage in the
modular topology there's no reasonable default to pick.

Give a hint to the users to use the '-c' if the connection to the
default URI fails:

 $ virt-admin version
 NOTE: Connecting to default daemon. Specify daemon using '-c' (e.g. virtqemud:///system)
 error: Failed to connect to the admin server
 error: no valid connection
 error: Failed to connect socket to '/run/user/1000/libvirt/libvirt-admin-sock': No such file or directory

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2024-02-02 16:06:15 +01:00
Peter Krempa
6eaf3614b6 qemuBlockStorageSourceNeedsFormatLayer: Stop formatting 'raw' driver when not needed
The 'raw' driver without any special configuration is not needed and
creates overhead in qemu.

Stop using the 'raw' format driver in cases when it's not needed. A
special case when it is needed is for FD passed images with only a
single writable FD passed, where we need an overlay driver to properly
reflect the 'read-only' flag.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-02 16:03:08 +01:00
Peter Krempa
abdcb46012 qemu: monitor: Use 'backing-mask-protocol' for blockjobs when available
Store whether qemu supports the appropriate option for block-stream and
block-commit commands and always use it if available.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-02 16:03:08 +01:00
Peter Krempa
c38b4e34c8 qemu: capabilities: Introduce QEMU_CAPS_BLOCKJOB_BACKING_MASK_PROTOCOL
The capability is asserted when both block-stream and block-commit QMP
commands support the 'backing-mask-protocol' argument.

The argument causes qemu to record 'raw' as the backing file format in
case when a protocol node is used directly. This is needed to preserve
compatibility of images after a block-commit or block-pull libvirt
operation with older libvirt versions in case when we'll want to remove
the unneded 'raw' format drivers from the block graph.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-02-02 16:03:08 +01:00