]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
20 months agotests: Consistently use /path/to/guest_VARS.fd
Andrea Bolognani [Mon, 15 May 2023 17:04:12 +0000 (19:04 +0200)]
tests: Consistently use /path/to/guest_VARS.fd

That's what we already use in almost all cases.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
20 months agotests: Use virt-4.0 machine type for aarch64
Andrea Bolognani [Mon, 15 May 2023 16:39:18 +0000 (18:39 +0200)]
tests: Use virt-4.0 machine type for aarch64

Using the unversioned machine type means that firmware
descriptors can't be used to discover additional information
about the chosen firmware build.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
20 months agotests: Switch to firmware autoselection for hvf
Andrea Bolognani [Mon, 15 May 2023 16:42:27 +0000 (18:42 +0200)]
tests: Switch to firmware autoselection for hvf

Firmware selection is not relevant to these tests, so adopt
the most convenient approach.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
20 months agotests: Use DO_TEST_CAPS_*_ABI_UPDATE() for ppc64
Andrea Bolognani [Tue, 30 May 2023 15:48:58 +0000 (17:48 +0200)]
tests: Use DO_TEST_CAPS_*_ABI_UPDATE() for ppc64

We have a number of tests that can benefit from this macro
instead of open-coding it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
20 months agotest: qemu: Update qemu-8.1 test data on x86_64
Peter Krempa [Thu, 10 Aug 2023 11:33:53 +0000 (13:33 +0200)]
test: qemu: Update qemu-8.1 test data on x86_64

Update to v8.1.0-rc4

Notable changes:
 - 'dirty-limit' migration feature added
    - 'vcpu-dirty-limit', 'x-vcpu-dirty-limit-period' parameters added
    - 'dirty-limit-ring-full-time', 'dirty-limit-throttle-time-per-round' statistics added
 - migration statistic of number of skipped zero pages is now deprecated

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Thu, 17 Aug 2023 21:21:13 +0000 (23:21 +0200)]
Translated using Weblate (Swedish)

Currently translated at 52.2% (5426 of 10393 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>
20 months agoqemu_domain: Drop unused variables from qemuDomainChrDefDropDefaultPath()
Michal Privoznik [Thu, 17 Aug 2023 15:43:54 +0000 (17:43 +0200)]
qemu_domain: Drop unused variables from qemuDomainChrDefDropDefaultPath()

In mu previous commits I've moved internals of
qemuDomainChrDefDropDefaultPath() into a separate function
(qemuDomainChrMatchDefaultPath()) but forgot to remove @buf and
@regexp variables which are now unused.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
20 months agoqemu: Move channelTargetDir into stateDir
Michal Privoznik [Thu, 20 Apr 2023 08:16:43 +0000 (10:16 +0200)]
qemu: Move channelTargetDir into stateDir

For historical reasons (i.e. unknown reason) we put channel
sockets into a path derived from cfg->libDir which is a path that
survives host reboots (e.g. /var/lib/libvirt/...). This is not
necessary and in fact for session daemon creates a longer prefix:

  XDG_CONFIG_HOME -> /home/user/.config
  XDG_RUNTIME_DIR -> /run/user/1000

Worse, if host is rebooted suddenly (e.g. due to power loss) then
we leave files behind and nobody will ever remove them.

Therefore, place the channel target dir into state dir.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2173980
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
20 months agoqemu: Generate shorter channel target paths
Michal Privoznik [Tue, 18 Apr 2023 15:34:12 +0000 (17:34 +0200)]
qemu: Generate shorter channel target paths

A <channel/> device is basically an UNIX socket into guest.
Whatever is sent from the host, appears in the guest and vice
versa. But because of that, the length of the path to the socket
is important (underscored by fact that we derive the path from
domain short name). But there are still cases where we might not
fit into UNIX_PATH_MAX limit (usually 108 characters), because
the path is derived also from other variables, e.g.
XDG_CONFIG_HOME for session domains.

There are two components though, that are needless: "/target/"
and "domain-" prefix. Drop them. This is safe to do, because
running domains have their path saved in status XML and even
though paths are dropped on migration, they are not part of guest
ABI and thus we are free to change them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
20 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Wed, 16 Aug 2023 15:21:14 +0000 (17:21 +0200)]
Translated using Weblate (Swedish)

Currently translated at 51.8% (5386 of 10393 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>
20 months agoci: Udate FreeBSD-13 image with lcitool manifest
Erik Skultety [Wed, 16 Aug 2023 08:39:48 +0000 (10:39 +0200)]
ci: Udate FreeBSD-13 image with lcitool manifest

Now that we have a local OS target override for lcitool in place, we
can bump the cirrus FreeBSD image version in GitLab CI.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
20 months agoci: Introduce a new 'lcitool' data directory
Erik Skultety [Wed, 16 Aug 2023 08:21:33 +0000 (10:21 +0200)]
ci: Introduce a new 'lcitool' data directory

We've reached a point in lcitool where we can't steer its development
based solely on libvirt's needs IOW there will be times where a local
override of value (e.g. package mapping) will be necessary - an example
of this would be QEMU.
In case of this particular patch we need to add an override for the
cirrus FreeBSD 13 image we request in our CI to fix:

    /usr/local/lib/libtasn1.so.6: Undefined symbol "strverscmp@FBSD_1.7"

The reason why we can't/should not make the fix in upstream lcitool
just yet is that we store a libosinfo ID in lcitool's OS target YAML
configs and at the time of writing this patch libosinfo does not have
a corresponding entry/ID for FreeBSD 13.2 so we have to stick with 13.1
in lcitool until they do so.

For the time being, the fix can easily be done on libvirt side as does
this patch.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
20 months agoci: Move Debian-11 workloads to Debian-12
Erik Skultety [Fri, 11 Aug 2023 09:46:20 +0000 (11:46 +0200)]
ci: Move Debian-11 workloads to Debian-12

Let's move our Debian CI workloads to Debian-12 since it's the latest
release and mark Debian-11 jobs as optional.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
20 months agoci: Add Debian-12 target
Erik Skultety [Fri, 11 Aug 2023 09:37:46 +0000 (11:37 +0200)]
ci: Add Debian-12 target

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
20 months agoTranslated using Weblate (Korean)
김인수 [Tue, 8 Aug 2023 05:41:35 +0000 (07:41 +0200)]
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/

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>
20 months agoci: build.sh: Join MESON_ARGS and MESON_OPTS
Erik Skultety [Wed, 1 Feb 2023 14:22:59 +0000 (15:22 +0100)]
ci: build.sh: Join MESON_ARGS and MESON_OPTS

It is quite confusing seeing these two in a call like this one:
    $ meson build $MESON_OPTS $MESON_ARGS

One has to ask 'how are they different' and 'shouldn't these be
merged'. In fact, these variables hold very different things and we
should make it more obvious. The problem is that renaming MESON_OPTS to
something more meaningful, like 'MESON_CROSS_OPTS' which is what
MESON_OPTS really does would require changes to lcitool and would
impact Dockerfile generation which in turn might have an impact on
other projects which rely on this lcitool functionality which is risky.

Instead, provide a docstring for the former to supplement the latter
and join the two variables in a single one MESON_ARGS which is then
passed to meson's command line so it's a little less confusing.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
20 months agoci: build.sh: Drop the CI prefix from the CI_{MESON,NINJA}_ARGS vars
Erik Skultety [Tue, 31 Jan 2023 17:06:53 +0000 (18:06 +0100)]
ci: build.sh: Drop the CI prefix from the CI_{MESON,NINJA}_ARGS vars

Although it is currently consistent with the other variables we define
when running ci in a local container environment, it isn't consistent
with the variable naming we use in GitLab recipes. Since the idea is
to unite the two, we're likely going to drop a few other variables from
the local env configuration anyway, hence this renaming.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
20 months agoci: build.sh: Always assume -Dsystem=true
Erik Skultety [Thu, 2 Feb 2023 15:40:37 +0000 (16:40 +0100)]
ci: build.sh: Always assume -Dsystem=true

There's no harm in always building in system mode, i.e. setting the
right paths.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
20 months agoci: build.sh: Use 'meson setup' explicitly
Erik Skultety [Wed, 25 Jan 2023 12:22:49 +0000 (13:22 +0100)]
ci: build.sh: Use 'meson setup' explicitly

Even though 'setup' is assumed when no other command is given, we're
being explicit in our GitLab recipes, so do the same for the local
build.sh script too.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
20 months agoci: build.sh: Drop the commentary about CI_BUILD_SCRIPT
Erik Skultety [Wed, 1 Feb 2023 14:33:47 +0000 (15:33 +0100)]
ci: build.sh: Drop the commentary about CI_BUILD_SCRIPT

build.sh is not the place where this should be mentioned as the
official entrypoint for this script locally is ci/helper which can
download the right image from our upstream CI registry. Since the idea
is to ultimately drop the usage of a Makefile for the local executions,
this patch doesn't provide an alternative place for the comment in
question as the functionality is going to be altered substantially in
the future.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
20 months agogitlab-ci.yml: Use $HOME for rpmbuild's topdir instead of PWD
Erik Skultety [Wed, 1 Feb 2023 17:02:01 +0000 (18:02 +0100)]
gitlab-ci.yml: Use $HOME for rpmbuild's topdir instead of PWD

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
20 months agogitlab-ci.yml: Replace all explicit calls to ninja with meson commands
Erik Skultety [Fri, 27 Jan 2023 10:12:06 +0000 (11:12 +0100)]
gitlab-ci.yml: Replace all explicit calls to ninja with meson commands

This is continuation of what commit b56e2be68e3 started. If we stick to
only calling meson commands directly, we can achieve much better
consistency in passing arguments to meson especially if we unify the
recipes run in gitlab CI and what we can currently run locally in
containers using docker/podman.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
20 months agodocs: index: Add a quick link to Submitting patches
Erik Skultety [Tue, 4 Jul 2023 08:06:18 +0000 (10:06 +0200)]
docs: index: Add a quick link to Submitting patches

We still get MRs in Gitlab from individual contributors on a regular
basis which in some ways just makes maintainer's or reviewer's life
just a bit more complicated. This ultimately means our guidelines are
probably not visible enough on the main page
(or some people wouldn't read them anyway). While this patch can't make
the problem go away, it can at least attempt to mitigate it by creating
a quick link to the 'hacking' page, skipping a lot of TL;DR contents
in contributing.rst which we link from the main page.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
20 months agoci: integration: Drop the Fedora 35 check
Erik Skultety [Tue, 18 Jul 2023 08:09:05 +0000 (10:09 +0200)]
ci: integration: Drop the Fedora 35 check

We're already past Fedora 35 and so all new fedora's default to
modular daemon setup.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
21 months agovirsh: doMigrate: Require --copy-storage-(all|inc) with --migrate-disks
Peter Krempa [Wed, 9 Aug 2023 13:14:35 +0000 (15:14 +0200)]
virsh: doMigrate: Require --copy-storage-(all|inc) with --migrate-disks

Users need to enable non-shared-storage migration, otherwise the disks
specified via '--migrate-disks' will be ignored.

Add an error message to inform the users of their wrong config.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
21 months agovirsh: doMigrate: Rework virsh option to migration flag conversion
Peter Krempa [Wed, 9 Aug 2023 13:02:04 +0000 (15:02 +0200)]
virsh: doMigrate: Rework virsh option to migration flag conversion

Convert the flags declaratively as in the vast majority of cases it's a
simple binary addition if the flag exists.

In one instance there was also an additional check, which was moved up
after the new code, and the error message was fixed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
21 months agoqemuMigrationSrcBeginPhase: Require storage migration when 'migrate_disks' parameter...
Peter Krempa [Wed, 9 Aug 2023 12:18:58 +0000 (14:18 +0200)]
qemuMigrationSrcBeginPhase: Require storage migration when 'migrate_disks' parameter is specified

If a user passes a list of disks to migrate but don't actually use
'VIR_MIGRATE_NON_SHARED_DISK' or 'VIR_MIGRATE_NON_SHARED_INC' flags the
parameter would be simply ignored without informing the user of the
error.

Add a proper error in such case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
21 months agoqemuMigrationSrcBeginPhase: Properly report error when non-shared storage migration...
Peter Krempa [Wed, 9 Aug 2023 12:10:14 +0000 (14:10 +0200)]
qemuMigrationSrcBeginPhase: Properly report error when non-shared storage migration is requested over tunnel

When VIR_MIGRATE_TUNNELLED is used without
VIR_MIGRATE_NON_SHARED_DISK/VIR_MIGRATE_NON_SHARED_INC
an error was reported without actually returning failure.

This was caused by a refactor which dropped many error paths.

Fixes: 6111b235224
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
21 months agovirStorageBackendLogicalCheckPool: Properly mark empty logical pools as active
Peter Krempa [Tue, 8 Aug 2023 13:53:53 +0000 (15:53 +0200)]
virStorageBackendLogicalCheckPool: Properly mark empty logical pools as active

The '/dev' filesystem convenience directory for a LVM volume group is
not created when the volume group is empty.

The logic in 'virStorageBackendLogicalCheckPool' which is used to see
whether a pool is active was first checking presence of the directory,
which failed for an empty VG.

Since the second step is virStorageBackendLogicalMatchPoolSource which
is checking mapping between configured PVs and the VG, we can simply
rely on the function to also check presence of the pool.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2228223
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
21 months agoconf: fix error message
Анастасия Белова [Mon, 7 Aug 2023 13:37:34 +0000 (16:37 +0300)]
conf: fix error message

In case of invalid placement its value should
be passed as a parameter of virReportError
instead of mode.

Fixes: 93e82727ec ("numatune: Encapsulate numatune configuration in order to unify results")
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
21 months agolxc_container: Increase stack size for lxcContainerChild()
Michal Privoznik [Fri, 4 Aug 2023 12:56:37 +0000 (14:56 +0200)]
lxc_container: Increase stack size for lxcContainerChild()

When spawning a new container (via clone()) we allocate stack for
lxcContainerChild(). So far, we allocate 4 pages for the stack
and this used to be enough until we started rewriting everything
to glib. With glib we switched to g_strerror() which localizes
errno strings and thus increases stack usage, while the
previously used strerror_r() was more compact.

Fortunately, the solution is easy - just increase how much stack
the child can use (16 pages ought to be enough for anybody).

And while at it, lets use mmap() for allocation which offer some
nice features:

MAP_STACK - align allocation to be suitable for stack (even
            though, currently ignored on Linux),
MAP_GROWSDOWN - kernel guards out of bounds access from child

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/511
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
21 months agosrc: fix max file limits in systemd services
Daniel P. Berrangé [Wed, 2 Aug 2023 09:00:22 +0000 (10:00 +0100)]
src: fix max file limits in systemd services

This fixes

  commit 38abf9c34dc481b0dc923bdab446ee623bdc5ab6
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Wed Jun 21 13:22:40 2023 +0100

    src: set max open file limit to match systemd >= 240 defaults

The bug referenced in that commit had suggested to set

  LimitNOFile=512000:1024

on the basis that matches current systemd default behaviour and is
compatible with old systemd. That was good except

 * The setting is LimitNOFILE and these are case sensitive
 * The hard and soft limits were inverted - soft must come
   first and so it would have been ignored even if the
   setting name was correct.
 * The default hard limit is 524288 not 512000

Reported-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
21 months agodaemon: Treat logging of VIR_ERR_MULTIPLE_INTERFACES same as VIR_ERR_NO_INTERFACE
Peter Krempa [Wed, 2 Aug 2023 08:05:57 +0000 (10:05 +0200)]
daemon: Treat logging of VIR_ERR_MULTIPLE_INTERFACES same as VIR_ERR_NO_INTERFACE

When a query for an interface via virInterfaceLookupByMACString finds
multiple interfaces an error is returned. Treat such error with the same
'debug' priority as we treat when the interface was not found to avoid
spamming logs with such configurations.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/514
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
21 months agovirLXCProcessReportStartupLogError: Strip trailing newline from error
Peter Krempa [Wed, 2 Aug 2023 07:25:22 +0000 (09:25 +0200)]
virLXCProcessReportStartupLogError: Strip trailing newline from error

Since the error message originates from a log file it contains a
trailing newline. Strip it as all error handling adds it's own newline.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
21 months agovirLXCProcessReadLogOutputData: Refill buffer after filtering out noise
Peter Krempa [Wed, 2 Aug 2023 07:20:24 +0000 (09:20 +0200)]
virLXCProcessReadLogOutputData: Refill buffer after filtering out noise

The caller passes in a 1k buffer, which when debug logging is in use is
easily filled with debug messages only. Thus after the first pass which
is common if the controller process already terminated the buffer will
not contain the real error, but rather a truncated debug message,
which will result in an error such as:

  error: internal error: guest failed to start: 2023-08-01 12:58:31.948+0000: 798195: i

instead of the proper error:

 error: internal error: guest failed to start: Failure in libvirt_lxc startup: Failed to create /home/rootfs/.oldroot: Permission denied

To fix the above retry the reading loop if the filtering function made
space in the buffer.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
21 months agovirLXCControllerSetupUsernsMap: Modify debug logging for clean startup errors
Peter Krempa [Tue, 1 Aug 2023 13:32:16 +0000 (15:32 +0200)]
virLXCControllerSetupUsernsMap: Modify debug logging for clean startup errors

Avoid logging multiline debug logs so that the function which attempts
to extract a non-debug log error message can work properly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
21 months agolib: Prefer sizeof(variable) instead of sizeof(type) in memset
Michal Privoznik [Thu, 3 Aug 2023 08:25:43 +0000 (10:25 +0200)]
lib: Prefer sizeof(variable) instead of sizeof(type) in memset

If one of previous commits taught us something, it's that:
sizeof(variable) and sizeof(type) are not the same. Especially
because for live enough code the type might change (e.g. as we
use autoptr more). And since we don't get any warnings when an
incorrect length is passed to memset() it is easy to mess up. But
with sizeof(variable) instead, it's not as easy. Therefore,
switch to using memset(variable, 0, sizeof(*variable)), or its
alternatives, depending on level of pointers.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
21 months agolib: Finish using struct zero initializer manually
Michal Privoznik [Thu, 3 Aug 2023 09:48:30 +0000 (11:48 +0200)]
lib: Finish using struct zero initializer manually

There are some cases left after previous commit which were not
picked up by coccinelle. Mostly, becuase the spatch was not
generic enough. We are left with cases like: two variables
declared on one line, a variable declared in #ifdef-s (there are
notoriously difficult for coccinelle), arrays, macro definitions,
etc.

Finish what coccinelle started, by hand.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
21 months agolib: use struct zero initializer instead of memset
Michal Privoznik [Wed, 2 Aug 2023 08:09:52 +0000 (10:09 +0200)]
lib: use struct zero initializer instead of memset

This is a more concise approach and guarantees there is
no time window where the struct is uninitialized.

Generated using the following semantic patch:

  @@
  type T;
  identifier X;
  @@
  -  T X;
  +  T X = { 0 };
     ... when exists
  (
  -  memset(&X, 0, sizeof(X));
  |
  -  memset(&X, 0, sizeof(T));
  )

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
21 months agovirnetdaemon.c: Use struct zero initializer instead of memset
Michal Privoznik [Thu, 3 Aug 2023 07:45:14 +0000 (09:45 +0200)]
virnetdaemon.c: Use struct zero initializer instead of memset

Ideally, these would be fixed by coccinelle (see next commit),
but because of various reasons they aren't. Fix them manually.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
21 months agovirnetclient: Update comment about memset()
Michal Privoznik [Thu, 3 Aug 2023 09:48:57 +0000 (11:48 +0200)]
virnetclient: Update comment about memset()

Instead of suggesting to zero structs out using memset() we
should suggest initializing structs with zero initializer.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
21 months agovirnetlink: Drop unused variable from virNetlinkCommand()
Michal Privoznik [Thu, 3 Aug 2023 08:43:13 +0000 (10:43 +0200)]
virnetlink: Drop unused variable from virNetlinkCommand()

The fds variable inside of virNetlinkCommand() is not used
really. It's passed to memset() (hence compilers do not
complain), but that's about it. Drop it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
21 months agovirfirewalld: Drop useless memset() in virFirewallDApplyRule()
Michal Privoznik [Thu, 3 Aug 2023 08:30:12 +0000 (10:30 +0200)]
virfirewalld: Drop useless memset() in virFirewallDApplyRule()

This is a residue of v6.8.0-rc1~100. The error variable inside of
virFirewallDApplyRule() is already initialized to NULL. There's
no need to memset() it to zero again.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
21 months agoremote_driver: Drop explicit memset(&sargs) in remoteAuthSASL()
Michal Privoznik [Thu, 3 Aug 2023 07:39:03 +0000 (09:39 +0200)]
remote_driver: Drop explicit memset(&sargs) in remoteAuthSASL()

Inside of remoteAuthSASL() the sargs variable is already
initialized to zero during declaration. There's no need to
memset() it again as it's unused in between it's declaration and
said memset().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
21 months agoqemu: Don't reuse variable in processSerialChangedEvent()
Michal Privoznik [Thu, 3 Aug 2023 06:52:57 +0000 (08:52 +0200)]
qemu: Don't reuse variable in processSerialChangedEvent()

When a VSERPORT_CHANGE event is processed, we firstly do a little
detour and try to detect whether the event is coming from guest
agent. If so, we notify threads that are currently talking to the
agent about this fact. Then we proceed with usual event
processing (BeginJob(), update domain def, emit event, and so
on).

In both cases we use the same @dev variable to refer to domain
device. While this works, it will make writing semantic patch
unnecessary harder (see next commit(s)). Therefore, introduce a
separate variable for the detour code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
21 months agoDecrease scope of some variables
Michal Privoznik [Wed, 2 Aug 2023 13:30:04 +0000 (15:30 +0200)]
Decrease scope of some variables

There are couple of variables that are declared at function
beginning but then used solely within a block (either for() loop
or if() statement). And just before their use they are zeroed
explicitly using memset(). Decrease their scope, use struct zero
initializer and drop explicit memset().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
21 months agovirt-aa-helper: Use struct zero initializer instead of memset
Michal Privoznik [Wed, 2 Aug 2023 13:42:31 +0000 (15:42 +0200)]
virt-aa-helper: Use struct zero initializer instead of memset

This is similar to the previous commit, except this is for a
different type (vahControl) and also fixes the case where _ctl is
passed not initialized to vah_error() (via ctl pointer so that's
probably why compilers don't complain).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
21 months agotools: Fix vshControl declaration and initialization
Michal Privoznik [Wed, 2 Aug 2023 12:57:44 +0000 (14:57 +0200)]
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>
21 months agoqemu: don't add --mac-addr option to passt commandline
Laine Stump [Thu, 13 Jul 2023 15:51:28 +0000 (11:51 -0400)]
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>
21 months agoRevert "qemu_passt: Precreate passt logfile"
Michal Privoznik [Tue, 1 Aug 2023 14:20:58 +0000 (16:20 +0200)]
Revert "qemu_passt: Precreate passt logfile"

This reverts commit 8511b96a319836700b4829816cdae27c3630060d.

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>
21 months agoRevert "qemu_passt: Actually use @logfd"
Michal Privoznik [Tue, 1 Aug 2023 14:18:47 +0000 (16:18 +0200)]
Revert "qemu_passt: Actually use @logfd"

This reverts commit 83686f1eea1a001a37a92f2c054ffb2689c43a40.

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>
21 months agodomain_event: Drop virDomainEventMemoryDeviceSizeChangePtr
Michal Privoznik [Tue, 27 Jun 2023 08:10:26 +0000 (10:10 +0200)]
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>
21 months agolibvirt-guests: Remove unused variable 'libvirtd'
Jim Fehlig [Mon, 31 Jul 2023 16:53:41 +0000 (10:53 -0600)]
libvirt-guests: Remove unused variable 'libvirtd'

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
21 months agoPost-release version bump to 9.7.0
Jiri Denemark [Tue, 1 Aug 2023 09:49:29 +0000 (11:49 +0200)]
Post-release version bump to 9.7.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
21 months agoRelease of libvirt-9.6.0
Jiri Denemark [Tue, 1 Aug 2023 09:47:03 +0000 (11:47 +0200)]
Release of libvirt-9.6.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
21 months agoNEWS: Mention CVE-2023-3750 and BeeGFS migration support
Peter Krempa [Mon, 31 Jul 2023 13:54:17 +0000 (15:54 +0200)]
NEWS: Mention CVE-2023-3750 and BeeGFS migration support

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
21 months agoTranslated using Weblate (Korean)
김인수 [Sun, 30 Jul 2023 05:21:05 +0000 (07:21 +0200)]
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>
21 months agoNEWS: Document my contributions for upcoming release
Michal Privoznik [Fri, 28 Jul 2023 14:32:45 +0000 (16:32 +0200)]
NEWS: Document my contributions for upcoming release

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
21 months agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Thu, 27 Jul 2023 16:21:06 +0000 (18:21 +0200)]
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>
21 months agoTranslated using Weblate (Czech)
Pavel Borecki [Thu, 27 Jul 2023 16:21:06 +0000 (18:21 +0200)]
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>
21 months agorpm: Delete unused macros
Andrea Bolognani [Wed, 5 Jul 2023 16:51:40 +0000 (18:51 +0200)]
rpm: Delete unused macros

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
21 months agorpm: Switch to new macros for handling of systemd units
Andrea Bolognani [Wed, 5 Jul 2023 16:48:32 +0000 (18:48 +0200)]
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>
21 months agorpm: Introduce new macros for handling of systemd units
Andrea Bolognani [Wed, 5 Jul 2023 16:07:34 +0000 (18:07 +0200)]
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>
21 months agorpm: Remove custom libvirtd restart logic
Andrea Bolognani [Wed, 5 Jul 2023 15:37:34 +0000 (17:37 +0200)]
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>
21 months agorpm: Reduce use of with_modular_daemons
Andrea Bolognani [Mon, 3 Jul 2023 16:41:18 +0000 (18:41 +0200)]
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>
21 months agorpm: Reorder scriptlets
Andrea Bolognani [Wed, 5 Jul 2023 16:49:17 +0000 (18:49 +0200)]
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>
21 months agorpm: Style/alignment tweaks
Andrea Bolognani [Mon, 3 Jul 2023 16:35:06 +0000 (18:35 +0200)]
rpm: Style/alignment tweaks

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
21 months agorpm: Bump min_fedora
Andrea Bolognani [Mon, 3 Jul 2023 16:25:49 +0000 (18:25 +0200)]
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>
21 months agoUpdate translation files
Weblate [Wed, 26 Jul 2023 12:06:59 +0000 (14:06 +0200)]
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>
21 months agopo: Refresh potfile for v9.6.0
Jiri Denemark [Wed, 26 Jul 2023 12:00:00 +0000 (14:00 +0200)]
po: Refresh potfile for v9.6.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
21 months agoremote: handle partial data transmission
Oleg Vasilev [Wed, 26 Jul 2023 07:47:15 +0000 (13:47 +0600)]
remote: handle partial data transmission

A new bug was introduced as a part of use-after-free fix below:

    commit 411cbe7199ce533ae5fa78f5558dddca6f88ef1a
    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>
21 months agodocs: formatdomain: Mention the QEMU requirement for discard_no_unref
Han Han [Wed, 26 Jul 2023 03:11:39 +0000 (11:11 +0800)]
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>
21 months agovirrandom: Accept "nodedev" driver in virRandomGenerateWWN()
Michal Privoznik [Mon, 17 Jul 2023 13:05:11 +0000 (15:05 +0200)]
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>
21 months agoqemu_domain: Partially validate memory amounts when auto-adding NUMA node
Michal Privoznik [Fri, 21 Jul 2023 10:57:39 +0000 (12:57 +0200)]
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: f5d4f5c8ee44e9f1939070afcc5381bdd5545e50
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
21 months agoTranslated using Weblate (Czech)
Pavel Borecki [Sat, 22 Jul 2023 19:20:59 +0000 (21:20 +0200)]
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>
21 months agoutil: file: Mark 'BeeGFS' as shared filesystem
Peter Krempa [Tue, 25 Jul 2023 10:38:57 +0000 (12:38 +0200)]
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>
21 months agoci: Switch to OpenSUSE Leap 15.5
Michal Privoznik [Thu, 8 Jun 2023 08:05:22 +0000 (10:05 +0200)]
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>
21 months agosync_qemu_models_i386.py: Add missing features
Tim Wiederhake [Thu, 13 Jul 2023 09:58:48 +0000 (11:58 +0200)]
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>
21 months agocpu_map: Add missing feature "pbrsb-no"
Tim Wiederhake [Thu, 13 Jul 2023 09:38:06 +0000 (11:38 +0200)]
cpu_map: Add missing feature "pbrsb-no"

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agocpu_map: Add missing feature "psdp-no"
Tim Wiederhake [Thu, 13 Jul 2023 09:37:52 +0000 (11:37 +0200)]
cpu_map: Add missing feature "psdp-no"

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agocpu_map: Add missing feature "fbsdp-no"
Tim Wiederhake [Thu, 13 Jul 2023 09:37:36 +0000 (11:37 +0200)]
cpu_map: Add missing feature "fbsdp-no"

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agocpu_map: Add missing feature "sbdr-ssdp-no"
Tim Wiederhake [Thu, 13 Jul 2023 09:37:18 +0000 (11:37 +0200)]
cpu_map: Add missing feature "sbdr-ssdp-no"

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agocpu_map: Add missing feature "mcdt-no"
Tim Wiederhake [Thu, 13 Jul 2023 09:36:51 +0000 (11:36 +0200)]
cpu_map: Add missing feature "mcdt-no"

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agodocs: Mention vhostuser for queues and queue_size
Han Han [Thu, 20 Jul 2023 09:00:22 +0000 (17:00 +0800)]
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>
21 months agoNEWS: qemu: Implement QEMU NBD reconnect delay attribute
Han Han [Tue, 25 Jul 2023 06:43:06 +0000 (14:43 +0800)]
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>
21 months agoremote: fix stream use-after-free
Oleg Vasilev [Tue, 4 Jul 2023 07:10:22 +0000 (13:10 +0600)]
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>
21 months agonet: add debug logs
Oleg Vasilev [Tue, 4 Jul 2023 07:10:21 +0000 (13:10 +0600)]
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>
21 months agoqemu_tpm: Try harder to create emulator state
Michal Privoznik [Fri, 21 Jul 2023 08:47:59 +0000 (10:47 +0200)]
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>
21 months agovirfile: Introduce virDirIsEmpty()
Michal Privoznik [Fri, 21 Jul 2023 08:41:35 +0000 (10:41 +0200)]
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>
21 months agoconf/domain_validate: Validate the disk queue_size
Han Han [Fri, 21 Jul 2023 02:36:40 +0000 (10:36 +0800)]
conf/domain_validate: Validate the disk queue_size

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agoconf/domain_validate.c: Improve the err for queue validation
Han Han [Fri, 21 Jul 2023 02:36:39 +0000 (10:36 +0800)]
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>
21 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Thu, 20 Jul 2023 21:21:05 +0000 (23:21 +0200)]
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>
21 months agoqemu_monitor: Remove helpers for 'query-commands'
Peter Krempa [Fri, 14 Jul 2023 13:25:08 +0000 (15:25 +0200)]
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>
21 months agoqemu: capabilities: Don't probe 'query-commands'
Peter Krempa [Fri, 14 Jul 2023 13:19:15 +0000 (15:19 +0200)]
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>
21 months agoqemu: capabilities: Probe presence of commands from QMP schema instead of 'query...
Peter Krempa [Fri, 14 Jul 2023 13:16:32 +0000 (15:16 +0200)]
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>
21 months agonode_device: Don't leak error message buffer from virMdevctlListDefined|Active
Peter Krempa [Wed, 19 Jul 2023 13:22:22 +0000 (15:22 +0200)]
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: 44a0f2f0c8f
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
21 months agoqemu: capabilities: Retire QEMU_CAPS_(IDE|SCSI)_DRIVE_WWN
Peter Krempa [Tue, 18 Jul 2023 13:54:38 +0000 (15:54 +0200)]
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>
21 months agoqemu: Always assume support for QEMU_CAPS_IDE_DRIVE_WWN
Peter Krempa [Tue, 18 Jul 2023 13:47:56 +0000 (15:47 +0200)]
qemu: Always assume support for QEMU_CAPS_IDE_DRIVE_WWN

The support for configuring the 'wwn' of a IDE disk was added in qemu
commit 95ebda85e09 (v1.0-1869-g95ebda85e0) and can't be compiled
out.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
21 months agoqemu: Always assume support for QEMU_CAPS_SCSI_DISK_WWN
Peter Krempa [Tue, 18 Jul 2023 13:47:56 +0000 (15:47 +0200)]
qemu: Always assume support for QEMU_CAPS_SCSI_DISK_WWN

The support for configuring the 'wwn' of a SCSI disk was added in qemu
commit 27395add759ff4caeb0 (v1.0-3326-g27395add75) and can't be compiled
out.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
21 months agoqemu: capabilities: Update capabilities test data for qemu-8.1 dev cycle
Peter Krempa [Tue, 27 Jun 2023 11:58:09 +0000 (13:58 +0200)]
qemu: capabilities: Update capabilities test data for qemu-8.1 dev cycle

Update the test data on x86_64 to v8.0.0-2835-g361d539735

Notable changes:

 - added new commands:
    - cxl-inject-dram-event
    - cxl-inject-general-media-event
    - cxl-inject-memory-module-event
    - cxl-inject-poison
    - switchover-ack
 - q35-8.1 machine type now supports 1024 cpus
 - new cpu models:
    - 'SapphireRapids-v2'
    - 'GraniteRapids-v1'
 - removed commands:
    - x-query-profile
 - cpu features which can be emulated now:
    - rdseed, rdpid, 3dnowprefetch, xsaveerptr, wbnoinvd
 - applicable CPU bug mitigation flags are now exposed to TCG guests to
   allow using more named models

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>