Commit Graph

48970 Commits

Author SHA1 Message Date
Michal Privoznik
33b7948983 tools: Fix vshControl declaration and initialization
Both virsh and virt-admin have vshControl typed variables and
also pointers to these variables. In both cases these are
declared on a single line. Do the following:

  1) break declaration into two lines,
  2) use struct zero initializer for vshControl and
     virshControl/vshAdmControl structs,
  3) drop explicit memset(.., 0, ...) ;

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
2023-08-03 16:30:56 +02:00
Laine Stump
a8262cb331 qemu: don't add --mac-addr option to passt commandline
When I implemented passt support in libvirt, I saw the --mac-addr
option on the passt commandline, immediately assumed that this was
used for setting the guest interface's mac address somewhere within
passt, and read no further. As a result, "--mac-addr" is always added
to the passt commandline, specifying the setting from <mac
addr='blah'/> in the guest's interface config.

But as pointed out in this bugzilla comment:

https://bugzilla.redhat.com/2184967#c8

That is *not at all* what passt's --mac-addr option does. Instead, it
is used to force the *remote* mac address for incoming traffic to a
specific value. So setting --mac-addr results in all traffic on the
interface having the same (the guest's) mac address for both source
and destination in all traffic. Surprisingly, this still works, so
nobody noticed it during testing.

The proper thing is to not specify any mac address to passt - the
remote MAC addresses can and should remain untouched, and the local
MAC address will end up being known to passt just by the guest sending
out packets with that MAC address.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
2023-08-02 19:33:02 -04:00
Michal Privoznik
99349ba18e Revert "qemu_passt: Precreate passt logfile"
This reverts commit 8511b96a31.

Turns out, we need to do a bit more than just plain
qemuSecurityDomainSetPathLabel() which sets svirt_image_t. Passt
has its own SELinux policy and as a part of that they invent
passt_log_t for log files. Right now, I don't know how libvirt
could query that and even if I did, passt SELinux policy would
need to permit relabelling from svirt_t to passt_log_t, which it
doesn't [1].

Until these problems are addressed we shouldn't be pre-creating
the file as it puts users into way worse position - even
scenarios that used to work don't work. But then again - using
log file for passt is usually valuable for developers only and
not regular users.

1: https://bugzilla.redhat.com/show_bug.cgi?id=2209191#c10
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-08-02 17:23:13 +02:00
Michal Privoznik
bc9a254dc7 Revert "qemu_passt: Actually use @logfd"
This reverts commit 83686f1eea.

This is needed only so that the next revert is clean.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-08-02 17:23:05 +02:00
Michal Privoznik
98216cead9 domain_event: Drop virDomainEventMemoryDeviceSizeChangePtr
We dropped our private virXXXPtr typedefs in v7.3.0-rc1~229 but
somehow v7.9.0-rc1~292 introduced one back:
virDomainEventMemoryDeviceSizeChangePtr. There's no need for it
and it's internal only. Drop it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2023-08-02 08:59:13 +02:00
Jim Fehlig
fa048f88ef libvirt-guests: Remove unused variable 'libvirtd'
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-08-01 10:46:11 -06:00
Jiri Denemark
b185dce64e Post-release version bump to 9.7.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2023-08-01 11:49:29 +02:00
Jiri Denemark
fb12c5e049 Release of libvirt-9.6.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2023-08-01 11:47:03 +02:00
Peter Krempa
fe306190bf NEWS: Mention CVE-2023-3750 and BeeGFS migration support
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-08-01 09:25:38 +02:00
김인수
a3a8cc0415 Translated using Weblate (Korean)
Currently translated at 100.0% (10393 of 10393 strings)

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

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
2023-07-31 12:27:48 +02:00
Michal Privoznik
c964dd09f0 NEWS: Document my contributions for upcoming release
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-07-31 12:25:29 +02:00
Yuri Chornoivan
010cfec969 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (10393 of 10393 strings)

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

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
2023-07-27 18:21:06 +02:00
Pavel Borecki
caf4344339 Translated using Weblate (Czech)
Currently translated at 100.0% (10393 of 10393 strings)

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

Co-authored-by: Pavel Borecki <pavel.borecki@gmail.com>
Signed-off-by: Pavel Borecki <pavel.borecki@gmail.com>
2023-07-27 18:21:06 +02:00
Andrea Bolognani
e33054b72c rpm: Delete unused macros
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-07-27 18:03:00 +02:00
Andrea Bolognani
a7bc8d1606 rpm: Switch to new macros for handling of systemd units
In most cases the replacement is straightforward, with the
biggest difference being that we now schedule restarts during
%pre instead of %post. This also means that we can get rid of
%post for most packages, reducing the number of scriptlets that
need to run during install/upgrade.

Notable exceptions are libvirt-guests.service, where we stop
using the standard systemd macros to adopt our custom ones, as
well as the virtlogd and virtlockd services, where the reload
operation is moved from %postun to %posttrans.

https://bugzilla.redhat.com/show_bug.cgi?id=2210058

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-07-27 18:02:58 +02:00
Andrea Bolognani
3bfc76a953 rpm: Introduce new macros for handling of systemd units
systemd provides a number of standard RPM macros but they don't
quite satisfy our requirements, as evidenced by the fact that we
have already built some custom tooling around them.

Scenarios that the standard macros don't cover and that we're
already addressing with our custom ones:

  * for some services (libvirtd, virtnetworkd, virtnwfilterd)
    there are multiple conditions that might lead to a restart,
    and we want to make sure that they're not needlessly
    restarted several times per transaction;

  * some services (virtlogd, virtlockd) must not be restarted
    during upgrade, so we have to reload them instead.

Issues that neither the standard macros nor our custom ones
address:

  * presets for units should be applied when the unit is first
    installed, not when the package that contains it is.

The package split that happened in 9.1.0 highlighted why this
last point is so important: when virtproxyd and its sockets
were moved from libvirt-daemon to the new libvirt-daemon-proxy
package, upgrades from 9.0.0 caused presets for them to be
applied.

On a platform such as Fedora, where modular daemons are the
default, this has resulted in breaking existing deployments in
at least two scenarios.

The first one is machines that were configured to use the
monolithic daemon, either because the local admin had manually
changed the configuration or because the installation dated
back to before modular daemons had become the default. In this
case, virtproxyd.socket being enabled resulted in a silent
conflict with libvirtd.socket, which by design shares the same
path, and thus a completely broken setup.

The second one is machines where virtproxy-tls.socket, which is
disabled by default, had manually been enabled: in this case,
applying the presets resulted in it being disabled and thus a
loss of remote availability.

Note that these are just two concrete scenarios, but the problem
is more generic. For example, if we were to add more units to an
existing package, per the current approach they wouldn't have
their presets applied.

The new macros are designed to avoid all of the pitfalls
mentioned above. As a bonus, they're also simpler to use: where
the current approach requires restarts and other operations to
be handled separately, the new one integrates the two so that,
for each scriptlet, a single macro call is needed.

https://bugzilla.redhat.com/show_bug.cgi?id=2210058

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-07-27 18:02:57 +02:00
Andrea Bolognani
df1e4e34cc rpm: Remove custom libvirtd restart logic
This logic was necessary when socket activation was introduced
in libvirt 5.6.0/5.7.0 in order to guarantee smooth upgrades.

These days, even the oldest platform that we target ships a
version of libvirtd that implements socket activation, so the
additional code is no longer useful and we can treat libvirtd
the same as all other services.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-07-27 18:02:56 +02:00
Andrea Bolognani
ea45933d35 rpm: Reduce use of with_modular_daemons
The current implementation pretty much assumes that targets
where modular daemons are the default will stick with that
configuration, as will targets where they're not, or that
changes to these defaults will be performed by the admin after
the packages have been installed.

This is unnecessarily limiting: for example, on a target that
defaults to using the monolithic daemon, it's entirely possible
to create a local preset such as

  # /etc/systemd/system-preset/00-virt.preset
  disable libvirtd.service
  disable libvirtd*.socket
  enable virtqemud.service

to opt into a modular daemon deployment. The opposite is of
course also true. We shouldn't get in the way of these
reasonable use cases.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-07-27 18:02:55 +02:00
Andrea Bolognani
1f3065a552 rpm: Reorder scriptlets
To make things more readable, use the same order (%pre, %post,
%posttrans, %preun, %postun) everywhere.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-07-27 18:02:53 +02:00
Andrea Bolognani
05ef4da4d7 rpm: Style/alignment tweaks
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-07-27 18:02:51 +02:00
Andrea Bolognani
bdb10f9de8 rpm: Bump min_fedora
According to our platform support policy, now that Fedora 38 is
out we no longer target Fedora 36 and older. This allows us to
simplify a few conditionals.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-07-27 18:02:41 +02:00
Weblate
8e958c1644 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
2023-07-26 14:06:59 +02:00
Jiri Denemark
dab2b7529b po: Refresh potfile for v9.6.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2023-07-26 14:00:00 +02:00
Oleg Vasilev
ea4c67f567 remote: handle partial data transmission
A new bug was introduced as a part of use-after-free fix below:

    commit 411cbe7199
    Author: Oleg Vasilev <oleg.vasilev@virtuozzo.com>
    Date:   Tue Jul 4 13:10:22 2023 +0600

        remote: fix stream use-after-free

When the message was processed partially, it is actually supposed to
stay in the queue to be processed again. In such case, reinsert it back.

Signed-off-by: Oleg Vasilev <oleg.vasilev@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-07-26 10:27:13 +02:00
Han Han
0cec8abdba docs: formatdomain: Mention the QEMU requirement for discard_no_unref
Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2023-07-26 10:08:26 +02:00
Michal Privoznik
3d9e35b837 virrandom: Accept "nodedev" driver in virRandomGenerateWWN()
The virRandomGenerateWWN() is used solely by nodedev driver to
autogenerate WWNN and WWNP when parsing a nodedev XML. Now, the
idea was (at least during monolithic daemon) that depending on
which hypervisor driver called the nodedev XML parsing (and
virRandomGenerateWWN() under the hood) the corresponding OUI is
used (e.g. "001a4a" for the QEMU driver).

But in era of split daemons things are not that easy. We do not
know which hypervisor driver called us. And there might be no
hypervisor driver at all - users are allowed to connect to
individual drivers directly (e.g. "nodedev:///system").

In this case, we can't use proper OUI. Well, do the next best
thing: pick one (QUMRANET_OUI).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2023-07-25 14:54:37 +02:00
Michal Privoznik
baeefe0327 qemu_domain: Partially validate memory amounts when auto-adding NUMA node
When automatically adding a NUMA node (qemuDomainDefNumaAutoAdd()) the
memory size of the node is computed as:

  total_memory - sum(memory devices)

And we have a nice helper for that: virDomainDefGetMemoryInitial() so
it looks logical to just call it. Except, this code runs in post parse
callback, i.e. memory sizes were not validated and it may happen that
the sum is greater than the total memory. This would be caught by
virDomainDefPostParseMemory() but that runs only after driver specific
callbacks (i.e. after qemuDomainDefNumaAutoAdd()) and because the
domain config was changed and memory was increased to this huge
number no error is caught.

So let's do what virDomainDefGetMemoryInitial() would do, but
with error checking.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2216236
Fixes: f5d4f5c8ee
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2023-07-25 14:51:35 +02:00
Pavel Borecki
5b6badcfbf Translated using Weblate (Czech)
Currently translated at 100.0% (10395 of 10395 strings)

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

Co-authored-by: Pavel Borecki <pavel.borecki@gmail.com>
Signed-off-by: Pavel Borecki <pavel.borecki@gmail.com>
2023-07-25 13:18:58 +02:00
Peter Krempa
658660681c util: file: Mark 'BeeGFS' as shared filesystem
BeeGFS is a shared/distributed filesystem:

https://doc.beegfs.io/latest/overview/overview.html

Mark it as shared based on it's magic number:

https://git.beegfs.io/pub/v7/-/blob/master/client_module/source/filesystem/FhgfsOpsSuper.h#L14

Closes: https://gitlab.com/libvirt/libvirt/-/issues/508
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2023-07-25 13:14:08 +02:00
Michal Privoznik
51ae80d6a7 ci: Switch to OpenSUSE Leap 15.5
OpenSUSE Leap was released recently (2023-06-07). Refresh our CI
with latest lcitool which brings this minor update.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2023-07-25 11:47:56 +02:00
Tim Wiederhake
edf17b5e99 sync_qemu_models_i386.py: Add missing features
This brings the tool's list of features in sync with qemu
commit 6f05a92ddc73ac8aa16cfd6188f907b30b0501e3.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-07-25 10:32:16 +02:00
Tim Wiederhake
a2c6000c72 cpu_map: Add missing feature "pbrsb-no"
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-07-25 10:32:14 +02:00
Tim Wiederhake
db81435b92 cpu_map: Add missing feature "psdp-no"
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-07-25 10:32:11 +02:00
Tim Wiederhake
4143916b1d cpu_map: Add missing feature "fbsdp-no"
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-07-25 10:32:08 +02:00
Tim Wiederhake
fb426d7957 cpu_map: Add missing feature "sbdr-ssdp-no"
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-07-25 10:32:01 +02:00
Tim Wiederhake
95a442dee6 cpu_map: Add missing feature "mcdt-no"
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-07-25 10:31:55 +02:00
Han Han
8cb0c11f29 docs: Mention vhostuser for queues and queue_size
These two attributes are supported for vhost-user-blk as well.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-07-25 10:24:59 +02:00
Han Han
ba9a8b5b56 NEWS: qemu: Implement QEMU NBD reconnect delay attribute
Signed-off-by: Han Han <hhan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-07-25 10:20:58 +02:00
Oleg Vasilev
411cbe7199 remote: fix stream use-after-free
Inside daemonStreamHandleWrite on stream completion (status=OK) we
reuse msg object to send confirmation.

Only after that, msg is poped from the queue and checked for continue.
By that time, msg might've already been processed for the confirmation
and freed.

Signed-off-by: Oleg Vasilev <oleg.vasilev@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-07-24 14:32:08 +02:00
Oleg Vasilev
54e59e9135 net: add debug logs
Helped to debug next patch use-after-free.

Signed-off-by: Oleg Vasilev <oleg.vasilev@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-07-24 14:32:02 +02:00
Michal Privoznik
6c3ef66cc6 qemu_tpm: Try harder to create emulator state
If a per-domain SWTPM state directory exists but is empty our
code still considers it a valid state and skips running
'swtpm_setup' (handled in qemuTPMEmulatorRunSetup()).
While we should not try to inspect individual files created by
swtpm, we can still consider empty folder as non-existent state.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/320
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-07-21 15:01:39 +02:00
Michal Privoznik
1b33578854 virfile: Introduce virDirIsEmpty()
There might be cases where we want to know whether given
directory is empty or not. Introduce a helper for that:
virDirIsEmpty().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-07-21 14:55:18 +02:00
Han Han
ac9c9b621f conf/domain_validate: Validate the disk queue_size
Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-07-21 14:19:37 +02:00
Han Han
cef25914eb conf/domain_validate.c: Improve the err for queue validation
Queues is supported by virtio bus, including virtio-blk and
vhost-user-blk.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-07-21 14:19:37 +02:00
Göran Uddeborg
986596f7a5 Translated using Weblate (Swedish)
Currently translated at 51.0% (5310 of 10395 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>
2023-07-20 23:21:05 +02:00
Peter Krempa
033c4fcddf qemu_monitor: Remove helpers for 'query-commands'
Now that we don't use it for probing at all we can remove all the
corresponding monitor code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-07-20 17:28:21 +02:00
Peter Krempa
0af5a514ee qemu: capabilities: Don't probe 'query-commands'
The capability code now probes the presence of commands from the QMP
schema instead of using 'query-commands'. Don't call the command and
adjust the '.replies' files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-07-20 17:27:19 +02:00
Peter Krempa
d8b6801095 qemu: capabilities: Probe presence of commands from QMP schema instead of 'query-commands'
Move the probing code to extract the data from the QMP schema rather
than invoking 'query-commands'. This patch doesn't yet remove the actual
invocation of 'query-commands', just moves the actual probing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-07-20 17:23:43 +02:00
Peter Krempa
7ca777cc09 node_device: Don't leak error message buffer from virMdevctlListDefined|Active
nodeDeviceUpdateMediatedDevices invokes virMdevctlListDefined and
virMdevctlListActive both of which were passed the same 'errmsg' buffer.

Since virCommandSetErrorBuffer() always allocates the error buffer one
of them was leaked.

Fix it by populating the 'errmsg' buffer only on failure of
virMdevctlListActive|Defined which invoke the command.

Add a comment to nodeDeviceGetMdevctlListCommand reminding how
virCommandSetErrorBuffer() works.

Fixes: 44a0f2f0c8
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2023-07-20 15:25:03 +02:00
Peter Krempa
294cf405d5 qemu: capabilities: Retire QEMU_CAPS_(IDE|SCSI)_DRIVE_WWN
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-07-20 15:24:43 +02:00