]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
23 months agovirmockstathelpers: Adapt to musl-1.2.4
Michal Privoznik [Mon, 15 May 2023 09:56:51 +0000 (11:56 +0200)]
virmockstathelpers: Adapt to musl-1.2.4

With musl-1.2.3: I get the following macros defined (from
$builddir/meson-config.h):

  #define WITH_LSTAT 1
  #define WITH_LSTAT64 1
  #define WITH_LSTAT_DECL 1
  #define WITH_STAT 1
  #define WITH_STAT64 1
  #define WITH_STAT_DECL 1
  #define WITH___LXSTAT 1
  #define WITH___LXSTAT64 1
  #define WITH___XSTAT 1
  #define WITH___XSTAT64 1

which in turn means the virmockstathelpers.c ends up defining:

  MOCK_STAT64
  MOCK_LSTAT64

But with  musl-1.2.4 everything changes and the set of defined
macros gets simplified to:

  #define WITH_LSTAT 1
  #define WITH_LSTAT_DECL 1
  #define WITH_STAT 1
  #define WITH_STAT_DECL 1
  #define WITH___LXSTAT 1
  #define WITH___XSTAT 1

which results in no MOCK_* macros defined in
virmockstathelpers.c, i.e. no stat() mocking, nada. The reason
for this simplification are these musl commits [1][2] which
removed all 64 bit aliases. And that's not what our logic for
deciding what flavor of stat() to mock counted with.

Nevertheless, we do build with Alpine Linux in our CI, so how
come we don't see this problem there? Well, simply because Alpine
Linux maintainers decided to revert the commits [3][4]. But on
distributions that use vanilla musl, this problem can be seen
easily.

1: https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4
2: https://git.musl-libc.org/cgit/musl/commit/?id=25e6fee27f4a293728dd15b659170e7b9c7db9bc
3: https://git.alpinelinux.org/aports/commit/main/musl?id=6a5563fbb45b3d9d60678d7bbf60dbb312a2d481
4: https://git.alpinelinux.org/aports/commit/main/musl?id=a089bd852f8983623fa85e0f5755a3e25bf53c72

Resolves: https://bugs.gentoo.org/906167
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
23 months agoTranslated using Weblate (Hungarian)
Dankaházi (ifj.) István [Fri, 12 May 2023 18:21:07 +0000 (20:21 +0200)]
Translated using Weblate (Hungarian)

Currently translated at 2.7% (284 of 10399 strings)

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

Co-authored-by: Dankaházi (ifj.) István <dankahazi.istvan@gmail.com>
Signed-off-by: Dankaházi (ifj.) István <dankahazi.istvan@gmail.com>
23 months agoqemu: Update documentation for dbus_daemon qemu.conf key
Andrea Bolognani [Wed, 10 May 2023 17:59:45 +0000 (19:59 +0200)]
qemu: Update documentation for dbus_daemon qemu.conf key

Reflect the new default value, and explain that a runtime
lookup will be performed if the value is not an absolute path.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
23 months agomeson: Stop looking for dbus-daemon
Andrea Bolognani [Wed, 10 May 2023 17:58:23 +0000 (19:58 +0200)]
meson: Stop looking for dbus-daemon

Now that we're performing the lookup at runtime, doing it at
build time is no longer necessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
23 months agoqemu: Find dbus-daemon at runtime
Andrea Bolognani [Wed, 10 May 2023 17:56:59 +0000 (19:56 +0200)]
qemu: Find dbus-daemon at runtime

Don't bother looking at /usr/libexec, since every distro
ships dbus-daemon in $PATH.

Note that it's still possible for the administrator to prevent
this lookup and use an arbitrary binary by setting the
appropriate key in qemu.conf.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Update documentation for qemu.conf keys
Andrea Bolognani [Fri, 5 May 2023 16:55:46 +0000 (18:55 +0200)]
qemu: Update documentation for qemu.conf keys

Reflect the new default value, and explain that a runtime
lookup will be performed if the value is not an absolute path.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agomeson: Stop looking for QEMU helpers
Andrea Bolognani [Tue, 25 Apr 2023 14:30:44 +0000 (16:30 +0200)]
meson: Stop looking for QEMU helpers

Now that we're performing the lookup at runtime, doing it at
build time is no longer necessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: Find helpers at runtime
Andrea Bolognani [Tue, 25 Apr 2023 14:38:53 +0000 (16:38 +0200)]
qemu: Find helpers at runtime

Use the recently introduced virFindFileInPathFull() function to
discover the path for qemu-bridge-helper and qemu-pr-helper at
runtime.

Note that it's still possible for the administrator to prevent
this lookup and use arbitrary binaries by setting the
appropriate keys in qemu.conf: this simply removes the need to
perform the lookup at build time, and thus to have the helpers
installed in the build environment.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoutil: Introduce virFileFindInPathFull()
Andrea Bolognani [Tue, 25 Apr 2023 14:18:35 +0000 (16:18 +0200)]
util: Introduce virFileFindInPathFull()

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoutil: Small refactor
Andrea Bolognani [Tue, 25 Apr 2023 14:11:07 +0000 (16:11 +0200)]
util: Small refactor

Prepare for further changes.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoci: integration: Flip QEMU upstream integration tests to Fedora 38
Erik Skultety [Wed, 3 May 2023 06:13:30 +0000 (08:13 +0200)]
ci: integration: Flip QEMU upstream integration tests to Fedora 38

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoci: Flip mingw jobs from Fedora 37 to Fedora 38
Erik Skultety [Tue, 2 May 2023 15:10:34 +0000 (17:10 +0200)]
ci: Flip mingw jobs from Fedora 37 to Fedora 38

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoci: Drop Fedora 36 target
Erik Skultety [Tue, 2 May 2023 15:08:58 +0000 (17:08 +0200)]
ci: Drop Fedora 36 target

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoci: Add Fedora 38 target
Erik Skultety [Tue, 2 May 2023 15:08:21 +0000 (17:08 +0200)]
ci: Add Fedora 38 target

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoTranslated using Weblate (Hungarian)
Dankaházi (ifj.) István [Wed, 10 May 2023 12:20:57 +0000 (14:20 +0200)]
Translated using Weblate (Hungarian)

Currently translated at 2.3% (243 of 10399 strings)

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

Co-authored-by: Dankaházi (ifj.) István <dankahazi.istvan@gmail.com>
Signed-off-by: Dankaházi (ifj.) István <dankahazi.istvan@gmail.com>
2 years agovirfirewallmock: Replace virFindFileInPath() with virFirewallDIsRegistered()
Michal Privoznik [Wed, 3 May 2023 08:44:10 +0000 (10:44 +0200)]
virfirewallmock: Replace virFindFileInPath() with virFirewallDIsRegistered()

Neither of tests that use virfirewallmock.c
(networkxml2firewalltest, nwfilterebiptablestest,
nwfilterxml2firewalltest, virfirewalltest) really call
virFindFileInPath(). But at least networkxml2firewalltest calls
virFirewallDIsRegistered(), under the hood. Now, the actual
implementation connects to dbus and something, which is
definitely not what we want in our test suite.

Therefore, drop virFindFileInPath() implementation and provide
implementation for virFirewallDIsRegistered() which just returns
-2 to signal that firewalld is not registered.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoutil: include virfirewall.h in virfirewalld.h
Michal Privoznik [Wed, 3 May 2023 08:42:12 +0000 (10:42 +0200)]
util: include virfirewall.h in virfirewalld.h

The virfirewalld.h file provides a declaration for
virFirewallDApplyRule() which accepts an argument of type
virFirewallLayer. But the typedef lives in virfirewall.h and thus
including just virfirewalld.h is not sufficient.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoconf: qemu: Add support for multi-channel mode for 'usb' sound cards
Peter Krempa [Tue, 9 May 2023 11:10:30 +0000 (13:10 +0200)]
conf: qemu: Add support for multi-channel mode for 'usb' sound cards

Allow users controlling the multi-channel mode by adding a
'multichannel' property parsed for USB audio devices and wire up the
support in the qemu driver.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/472
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: Register autoptr cleanup for 'virDomainSoundDef' and refactor virDomainSoundDef...
Peter Krempa [Tue, 9 May 2023 11:35:10 +0000 (13:35 +0200)]
conf: Register autoptr cleanup for 'virDomainSoundDef' and refactor virDomainSoundDefParseXML

Use our modern cleanup path pattern.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2(argv|xml)test: Modernize 'sound-device' case
Peter Krempa [Tue, 9 May 2023 11:13:19 +0000 (13:13 +0200)]
qemuxml2(argv|xml)test: Modernize 'sound-device' case

Drop the unnecessary disk definition and use x86_64 emulator.

For 'qemuxml2argvtest' replace the fake-caps invocation by a 4.2.0
version-locked invocation and  add a '_CAPS_LATEST' invocation.

For 'qemuxml2xmltest' convert to use '_CAPS_LATEST' only.

There are no sound-device relevant changes in the output files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2(argv|xml)test: Remove 'sound' case
Peter Krempa [Tue, 9 May 2023 11:18:18 +0000 (13:18 +0200)]
qemuxml2(argv|xml)test: Remove 'sound' case

The test case is a subset of what the 'sound-device' case tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs: formatdomain: Use code blocks to emphasize various sound device options
Peter Krempa [Tue, 9 May 2023 11:00:13 +0000 (13:00 +0200)]
docs: formatdomain: Use code blocks to emphasize various sound device options

Emphasize the various sound card models and other config options by
using ``...``.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Report domain name in unexpectedly closed monitor message
Michal Privoznik [Tue, 9 May 2023 07:51:40 +0000 (10:51 +0300)]
qemu: Report domain name in unexpectedly closed monitor message

When QEMU closes the monitor suddenly, the following error
message is reported:

  internal error: qemu unexpectedly closed the monitor: ...

And this works. But other error messages produced in the same
function include domain name too. Do that for the unexpectedly
closed monitor message too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agologging: Provide empty VIRTLOGD_ARGS in the unit file
Michal Privoznik [Tue, 9 May 2023 08:58:34 +0000 (11:58 +0300)]
logging: Provide empty VIRTLOGD_ARGS in the unit file

For all our daemons, we provide VIRXXXD_ARGS env var in the unit
file. The variable can then be overridden in corresponding file:

  EnvironmentFile=-@initconfdir@/virtxxxd

The daemon is then executed as:

  ExecStart=@sbindir@/virtxxxd $VIRTXXXD_ARGS

But virtlogd is exception, for no good reason. And while there
are probably no arguments we want to pass to virtlogd by default,
just mimic what we do for say virtlockd, where we also don't pass
any default argument.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years ago.gitlab-ci.yml: Fix Leap 15.4 codestyle job
Erik Skultety [Wed, 3 May 2023 09:09:15 +0000 (11:09 +0200)]
.gitlab-ci.yml: Fix Leap 15.4 codestyle job

Commit a3cc0e9ceb3e forgot to tweak the codestyle job so that we refer
to Leap 15.4 as Leap 15 (with the recent change in lcitool). However,
it was easy to miss as that job is not managed by the manifest.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemu: hotplug: Reorder setup of disk backend metadata
Peter Krempa [Fri, 5 May 2023 12:43:17 +0000 (14:43 +0200)]
qemu: hotplug: Reorder setup of disk backend metadata

The regular VM startup code first calls the setup of the disk backing
chain as defined in the XML and then calls the function to load the
rest of the backing chain from the image metadata. The hotplug code
did it the other way around, thus causing a failure when attempting
to attach a QCOW2 image via FD passing.

Reorder the hotplug code to have the same order.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2193315
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agomeson: Improve initconfdir defaults
Andrea Bolognani [Sun, 30 Apr 2023 10:02:38 +0000 (12:02 +0200)]
meson: Improve initconfdir defaults

Keep /etc/sysconfig as the fallback, but pick more suitable
values for various Linux distros.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agomeson: Move definition of os_release
Andrea Bolognani [Sun, 30 Apr 2023 09:52:27 +0000 (11:52 +0200)]
meson: Move definition of os_release

We're about to introduce another user of the value in a
different scope.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agorpm: Set initconfdir explicitly
Andrea Bolognani [Sat, 29 Apr 2023 16:52:24 +0000 (18:52 +0200)]
rpm: Set initconfdir explicitly

The default would already work fine for Fedora and RHEL, but
it's better to be explicit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agomeson: Use initconfdir
Andrea Bolognani [Sat, 29 Apr 2023 16:23:12 +0000 (18:23 +0200)]
meson: Use initconfdir

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agomeson: Introduce initconfdir option
Andrea Bolognani [Sat, 29 Apr 2023 16:13:56 +0000 (18:13 +0200)]
meson: Introduce initconfdir option

Right now we expect the configuration files for init scripts
to live in /etc/sysconfig, but that location is only used by
RHEL- and SUSE-derived distros.

This means that packagers for other distros have to patch
things as part of the build process, while people building
from source will get wonky integration.

This new option will provide a convenient way to override
the default location at build time that is usable by distro
packagers and people building from source alike.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoutil: Improve comment for workaround
Andrea Bolognani [Tue, 25 Apr 2023 13:33:02 +0000 (15:33 +0200)]
util: Improve comment for workaround

Now that a version of GLib that contains the fix has been
released, it's more useful to record that information. Adding
a TODO annotation makes the whole thing easily greppable.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Fix error message
Andrea Bolognani [Tue, 25 Apr 2023 14:27:13 +0000 (16:27 +0200)]
qemu: Fix error message

The spelling is slightly different from another otherwise
identical error message in the same file.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2 years agocpu_riscv64.c: add update() implementation
Daniel Henrique Barboza [Fri, 28 Apr 2023 19:57:28 +0000 (16:57 -0300)]
cpu_riscv64.c: add update() implementation

At this moment it is not possible to launch a 'riscv64' domain if a CPU
definition is presented in the domain. For example, adding this CPU
definition:

  <cpu mode='custom' match='exact' check='none'>
    <model fallback='forbid'>rv64</model>
  </cpu>

Will trigger the following error:

$ sudo ./run tools/virsh start riscv-virt1
error: Failed to start domain 'riscv-virt1'
error: this function is not supported by the connection driver:
       cannot update guest CPU for riscv64 architecture

The error comes from virCPUUpdate(), via qemuProcessUpdateGuestCPU(),
and it's caused by the absence of the 'update' API in the existing
RISC-V driver.

Add an 'update' API impl to the RISC-V driver to allow for CPU
definitions to be declared in RISC-V domains. This API was copied from
the ARM driver (virCPUarmUpdate()) since it's a good enough
implementation to get us going.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agomeson: Fix qemu_{user,group} defaults for Arch
Andrea Bolognani [Sun, 30 Apr 2023 09:07:49 +0000 (11:07 +0200)]
meson: Fix qemu_{user,group} defaults for Arch

The current values might have been accurate at the time
when the logic was introduced, but these days Arch is
using the same ones as Debian.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat>
2 years agotools: virsh-domain: display progress with enhanced granularity
Shaleen Bathla [Wed, 26 Apr 2023 11:28:33 +0000 (16:58 +0530)]
tools: virsh-domain: display progress with enhanced granularity

Switch from int to double for displaying job progress upto 2 decimal
places.

Signed-off-by: Shaleen Bathla <shaleen.bathla@oracle.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agotools: virsh-domain: refactor variable initialization
Shaleen Bathla [Wed, 26 Apr 2023 11:28:32 +0000 (16:58 +0530)]
tools: virsh-domain: refactor variable initialization

Signed-off-by: Shaleen Bathla <shaleen.bathla@oracle.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: Use configured iothread poll parameters on startup
Peter Krempa [Thu, 23 Feb 2023 13:27:17 +0000 (14:27 +0100)]
qemu: Use configured iothread poll parameters on startup

Implement the support for the persisted poll parameters and remove
restrictions on saving config when modifying them during runtime.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: Store the iothread 'poll' settings in the XML
Peter Krempa [Thu, 23 Feb 2023 12:48:35 +0000 (13:48 +0100)]
conf: Store the iothread 'poll' settings in the XML

Currently we allow configuring the 'poll-max-ns', 'poll-grow', and
'poll-shrink' parameters of qemu iothreads only during runtime and they
are not persisted. Add XML machinery to persist them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirsh: cmdIOThreadSet: Use bigger types for --poll-grow and --poll-shrink
Peter Krempa [Wed, 19 Apr 2023 10:39:00 +0000 (12:39 +0200)]
virsh: cmdIOThreadSet: Use bigger types for --poll-grow and --poll-shrink

The qemu driver now accepts also _ULLONG as type for bigger numbers. Use
the 'virTypedParamListAddUnsigned' helper to use the bigger typed
parameter type if necessary to allow full range of the values while
preserving compatibility.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Store all iothread's 'poll*' attributes as unsigned long long
Peter Krempa [Wed, 19 Apr 2023 10:38:45 +0000 (12:38 +0200)]
qemu: Store all iothread's 'poll*' attributes as unsigned long long

Convert the internal types to unsigned long long. Luckily we can also
covert the external types too:

 - 'qemuDomainSetIOThreadParams' can accept both _UINT and _ULLONG by
   converting to 'virTypedParamsGetUnsigned'

 - querying is handled via the bulk stats API which is flexible:
    - we use virTypedParamListAddUnsigned to use the bigger type only if
      necessary
    - most users don't even notice because the bindings abstract the
      data types

Apart from the code modifications we also improve the documentation
which was missing for the setters.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Remove iothread 'poll-' value validation
Peter Krempa [Wed, 19 Apr 2023 10:37:01 +0000 (12:37 +0200)]
qemu: Remove iothread 'poll-' value validation

QEMU accepts even values bigger than INT_MAX. The reasoning for these
checks was that the QAPI definition declares them as 'int', but in QAPI
terms that's any number as it's JSON.

Remove the validation as well as the comment misinterpreting the QAPI
definiton.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirsh: cmdIOThreadSet: Refactor to use virTypedParamList
Peter Krempa [Tue, 18 Apr 2023 20:51:24 +0000 (22:51 +0200)]
virsh: cmdIOThreadSet: Refactor to use virTypedParamList

Refactor to use the new data type so that we can use the APIs of it in
upcoming patches.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirTypedParamsValidate: Allow typed params to be both _UINT and _ULLONG
Peter Krempa [Wed, 19 Apr 2023 08:29:14 +0000 (10:29 +0200)]
virTypedParamsValidate: Allow typed params to be both _UINT and _ULLONG

For certain typed parameters we want to extend the supproted range by
switching to VIR_TYPED_PARAM_ULLONG. To preserve compatibility we've
added APIs such as 'virTypedParamsGetUnsigned' and
'virTypedParamListAddUnsigned' which automatically select the bigger
type if necessary.

This patch adds a new internal macro VIR_TYPED_PARAM_UNSIGNED which
is used with virTypedParamsValidate to allow both types and adjusts the
code to handle it properly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirTypedParamsValidate: Refactor variable declaration and cleanup
Peter Krempa [Wed, 19 Apr 2023 08:37:09 +0000 (10:37 +0200)]
virTypedParamsValidate: Refactor variable declaration and cleanup

Use automatic memory cleanup for the 'keys' and 'sorted' helpers and
remove the 'cleanup' label. Since this patch is modifying variable
declarations ensure that all declarations conform with our coding style.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: virtypedparam: Introduce virTypedParamsGetUnsigned
Peter Krempa [Tue, 18 Apr 2023 11:43:56 +0000 (13:43 +0200)]
util: virtypedparam: Introduce virTypedParamsGetUnsigned

Add an internal helper for fetching a typed parameter which can be
either of the '_UINT' or '_ULONG' type and store it in a unsigned long
long variable.

Since this is an internal helper it offers less protections against
invalid use compared to those we expose as public API.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: typedparam: Introduce virTypedParamListAddUnsigned
Peter Krempa [Tue, 18 Apr 2023 11:30:02 +0000 (13:30 +0200)]
util: typedparam: Introduce virTypedParamListAddUnsigned

The new helper adds a unsigned value, stored as _UINT if it fits into
the type and stored as _ULLONG otherwise.

This is useful for the statistics code which is quite tolerant to
changes in type in cases when we'll need more range for the value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: virtypedparam: Remove return values from virTypedParamListAdd* APIs
Peter Krempa [Tue, 18 Apr 2023 14:52:30 +0000 (16:52 +0200)]
util: virtypedparam: Remove return values from virTypedParamListAdd* APIs

The function now return always 0. Refactor the code and remove return
values.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: virtypedparam: Store errors inside virTypedParamList
Peter Krempa [Tue, 18 Apr 2023 14:49:17 +0000 (16:49 +0200)]
util: virtypedparam: Store errors inside virTypedParamList

The only non-abort()-ing error which can happen is if the field name is
too long. Store the overly long name in the virTypedParamList container
so that in upcoming patches the helpers adding to the list can be
refactored to not have a return value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: virtypedparam: Refactor return value of virTypedParamListStealParams
Peter Krempa [Tue, 18 Apr 2023 14:19:58 +0000 (16:19 +0200)]
util: virtypedparam: Refactor return value of virTypedParamListStealParams

Return the number of parameters via pointer passed as argument to free
up possibility to report errors. Strangely all callers actually use
'int' as type for storing the count of elements, thus this function will
use the same.

The function is also renamed to virTypedParamListSteal.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: virtypedparam: Privatize definition of struct _virTypedParamList
Peter Krempa [Tue, 18 Apr 2023 13:08:45 +0000 (15:08 +0200)]
util: virtypedparam: Privatize definition of struct _virTypedParamList

Ensure that all callers access it via the APIs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoUse 'virTypedParamListFetch' for extracting identity parameters list
Peter Krempa [Tue, 18 Apr 2023 13:47:42 +0000 (15:47 +0200)]
Use 'virTypedParamListFetch' for extracting identity parameters list

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: virtypedparam: Introduce 'virTypedParamListFetch'
Peter Krempa [Tue, 18 Apr 2023 13:45:31 +0000 (15:45 +0200)]
util: virtypedparam: Introduce 'virTypedParamListFetch'

Introduce a helper that fetches the typed parameters from the list while
still preserving ownership of the pointer by the list.

In the future this will be also able to report errors stored in the
list.

Signed-off-by: Peter Krempa <pkrempa@redhat.com
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuDomainGetStatsBlock: Don't directly access virTypedParamList
Peter Krempa [Tue, 18 Apr 2023 13:33:24 +0000 (15:33 +0200)]
qemuDomainGetStatsBlock: Don't directly access virTypedParamList

The struct will be made private in upcoming patches. Construct the list
of block entries into a separate list and append them rather than
remember the index of the count element.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoutil: typedparam: Introduce 'virTypedParamListConcat'
Peter Krempa [Tue, 18 Apr 2023 13:30:16 +0000 (15:30 +0200)]
util: typedparam: Introduce 'virTypedParamListConcat'

Introduce a helper function to concatenate two virTypedParamLists. This
will allow us to refactor qemuDomainGetStatsBlock to not access the list
directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoutil: virtypedparam: Introduce virTypedParamListNew()
Peter Krempa [Tue, 18 Apr 2023 13:20:09 +0000 (15:20 +0200)]
util: virtypedparam: Introduce virTypedParamListNew()

Add an allocator function and refactor all allocations to use it. In
upcoming patches 'struct _virTypedParamList' will be made private.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovirtypedparam.h: Consistently use contemporary header style
Peter Krempa [Wed, 19 Apr 2023 10:52:20 +0000 (12:52 +0200)]
virtypedparam.h: Consistently use contemporary header style

The header uses both styles randomly, switch it to the contemporary
style.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoutil: virtypedparam: Simplify error handling in virTypedParamListAdd*
Peter Krempa [Tue, 18 Apr 2023 13:06:32 +0000 (15:06 +0200)]
util: virtypedparam: Simplify error handling in virTypedParamListAdd*

Don't check the return value of 'virTypedParamListExtend' which will
always be a valid pointer and 'virTypedParameterAssignValue' always
returns 0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovirTypedParameterAssignValueVArgs: Ensure proper typed param type in caller
Peter Krempa [Tue, 18 Apr 2023 12:51:31 +0000 (14:51 +0200)]
virTypedParameterAssignValueVArgs: Ensure proper typed param type in caller

There are two callers of virTypedParameterAssignValueVArgs.

- 'virTypedParameterAssignValue' always uses the correct type, thus
  doesn't need to be modified. Just use the proper type in the function
  declaration

- 'virTypedParameterAssign' can get improper type, but we can move the
  validation into it decreasing the scope in which failures need to be
  propagated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovirTypedParamsDeserialize: Remove unnecessary line breaks
Peter Krempa [Tue, 18 Apr 2023 12:45:32 +0000 (14:45 +0200)]
virTypedParamsDeserialize: Remove unnecessary line breaks

All changed lines even fit into 80 columns.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoutil: virtypedparam: Use proper enum type for all switch() statements
Peter Krempa [Tue, 18 Apr 2023 12:43:34 +0000 (14:43 +0200)]
util: virtypedparam: Use proper enum type for all switch() statements

Ensure that all switch statements in this module use the proper type in
switch() statements to ensure complier protections.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovirTypedParameterAssignValue: Drop 'copystr' parameter
Peter Krempa [Tue, 18 Apr 2023 12:34:39 +0000 (14:34 +0200)]
virTypedParameterAssignValue: Drop 'copystr' parameter

All callers pass 'true'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoPost-release version bump to 9.4.0
Jiri Denemark [Tue, 2 May 2023 12:18:37 +0000 (14:18 +0200)]
Post-release version bump to 9.4.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2 years agoRelease of libvirt-9.3.0
Jiri Denemark [Tue, 2 May 2023 12:15:48 +0000 (14:15 +0200)]
Release of libvirt-9.3.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2 years agoNEWS: Update news for the 9.3.0 release
Peter Krempa [Tue, 2 May 2023 11:23:15 +0000 (13:23 +0200)]
NEWS: Update news for the 9.3.0 release

Update the news file mentioning important changes such as the change of
translatable strings or the fix of inactive snapshots of VMs using uefi.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirpci: Resolve leak in virPCIVirtualFunctionList cleanup
Tim Shearer [Mon, 1 May 2023 13:15:48 +0000 (13:15 +0000)]
virpci: Resolve leak in virPCIVirtualFunctionList cleanup

Repeatedly querying an SR-IOV PCI device's capabilities exposes a
memory leak caused by a failure to free the virPCIVirtualFunction
array within the parent struct's g_autoptr cleanup.

Valgrind output after getting a single interface's XML description
1000 times:

==325982== 256,000 bytes in 1,000 blocks are definitely lost in loss record 2,634 of 2,635
==325982==    at 0x4C3C096: realloc (vg_replace_malloc.c:1437)
==325982==    by 0x59D952D: g_realloc (in /usr/lib64/libglib-2.0.so.0.5600.4)
==325982==    by 0x4EE1F52: virReallocN (viralloc.c:52)
==325982==    by 0x4EE1FB7: virExpandN (viralloc.c:78)
==325982==    by 0x4EE219A: virInsertElementInternal (viralloc.c:183)
==325982==    by 0x4EE23B2: virAppendElement (viralloc.c:288)
==325982==    by 0x4F65D85: virPCIGetVirtualFunctionsFull (virpci.c:2389)
==325982==    by 0x4F65753: virPCIGetVirtualFunctions (virpci.c:2256)
==325982==    by 0x505CB75: virNodeDeviceGetPCISRIOVCaps (node_device_conf.c:2969)
==325982==    by 0x505D181: virNodeDeviceGetPCIDynamicCaps (node_device_conf.c:3099)
==325982==    by 0x505BC4E: virNodeDeviceUpdateCaps (node_device_conf.c:2677)
==325982==    by 0x260FCBB2: nodeDeviceGetXMLDesc (node_device_driver.c:355)

Signed-off-by: Tim Shearer <tshearer@adva.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Fri, 28 Apr 2023 04:21:01 +0000 (06:21 +0200)]
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10399 of 10399 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>
2 years agoTranslated using Weblate (Korean)
김인수 [Fri, 28 Apr 2023 04:21:01 +0000 (06:21 +0200)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10399 of 10399 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>
2 years agomeson: Check header usability
Andrea Bolognani [Thu, 27 Apr 2023 09:30:59 +0000 (11:30 +0200)]
meson: Check header usability

This fixes cross-building in some scenarios.

Specifically, when building for armv7l on x86_64, has_header()
will see the x86_64 version of the linux/kmv.h header and
consider it to be usable. Later, when an attempt is made to
actually include it, the compiler will quickly realize that
things can't quite work.

The reason why we haven't hit this in our CI is that we only ever
install the foreign version of header files. When building the
Debian package, however, some of the Debian-specific tooling will
bring in the native version of the Linux headers in addition to
the foreign one, causing meson to misreport the header's
availability status.

Checking for actual usability, as opposed to mere presence, of
headers is enough to make things work correctly in all cases.

The meson documentation recommends using has_header() instead of
check_header() whenever possible for performance reasons, but
while testing this change on fairly old and underpowered hardware
I haven't been able to measure any meaningful slowdown.

https://bugs.debian.org/1024504

Suggested-by: Helmut Grohne <helmut@subdivi.de>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoci: Regenerate files
Michal Privoznik [Thu, 27 Apr 2023 06:48:21 +0000 (08:48 +0200)]
ci: Regenerate files

This removes minor version number from OpenSUSE LEAP target names
and on CentOS Stream 9 installs flake8 from repositories, instead
of pip.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agodocs: Drop java.rst
Andrea Bolognani [Thu, 27 Apr 2023 07:42:47 +0000 (09:42 +0200)]
docs: Drop java.rst

We no longer link to it from anywhere, and a server-side
redirect has been created to keep existing external links
working.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agodocs: Link to java.libvirt.org
Andrea Bolognani [Thu, 27 Apr 2023 07:42:03 +0000 (09:42 +0200)]
docs: Link to java.libvirt.org

All the information from java.rst have been transferred
to the subproject's own website.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoUpdate translation files
Weblate [Tue, 25 Apr 2023 11:18:56 +0000 (13:18 +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>
2 years agopo: Refresh potfile for v9.3.0
Jiri Denemark [Tue, 25 Apr 2023 11:15:35 +0000 (13:15 +0200)]
po: Refresh potfile for v9.3.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2 years agoqemu: Stop virQEMUCaps propagation into qemuHostdevPreparePCIDevices()
Michal Privoznik [Mon, 24 Apr 2023 08:20:52 +0000 (10:20 +0200)]
qemu: Stop virQEMUCaps propagation into qemuHostdevPreparePCIDevices()

After previous cleanups, qemuHostdevPreparePCIDevices() no longer
needs virQEMUCaps. Drop its passing from callers.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: Remove empty functions
Michal Privoznik [Fri, 14 Apr 2023 11:12:45 +0000 (13:12 +0200)]
qemu: Remove empty functions

After previous cleanup, there are some functions that do nothing:

  qemuConnectDomainXMLToNativePrepareHostHostdev()
  qemuConnectDomainXMLToNativePrepareHost()
  qemuProcessPrepareHostHostdev()
  qemuProcessPrepareHostHostdevs()

Remove them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: Move <hostdev> SCSI path generation into qemuDomainPrepareHostdev()
Michal Privoznik [Fri, 14 Apr 2023 11:09:53 +0000 (13:09 +0200)]
qemu: Move <hostdev> SCSI path generation into qemuDomainPrepareHostdev()

When preparing a SCSI <hostdev/> with passthrough of a host SCSI
adapter (i.e. no protocol), a virStorageSource structure is
initialized and stored inside virDomainHostdevDef. But the source
structure is filled in many places, with almost the same code.

Firstly, qemuProcessPrepareHostHostdev() and
qemuConnectDomainXMLToNativePrepareHostHostdev() are the same.

Secondly, qemuDomainPrepareHostdev() allocates the src structure,
only to let qemuProcessPrepareHostHostdev() fill src->path later.

Well, src->path can be filled at the same place where the src
structure is allocated (qemuDomainPrepareHostdev()) which renders
the other two functions needless.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu_hotplug: Drop PCI backend check in qemuDomainAttachHostPCIDevice()
Michal Privoznik [Mon, 24 Apr 2023 07:53:33 +0000 (09:53 +0200)]
qemu_hotplug: Drop PCI backend check in qemuDomainAttachHostPCIDevice()

There is no way the qemuDomainAttachHostPCIDevice() function can
be called over a hostdev with PCI backend other than VFIO. And
even if it were, then the check is written so poorly that it lets
some types through (e.g. KVM) only to let
qemuBuildPCIHostdevDevProps() called afterwards fail properly.

Drop this check and rely on qemuDomainPrepareHostdevPCI() (and
worst case scenario even qemuBuildPCIHostdevDevProps()) to report
the proper error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: Deny all but VFIO PCI backends in hostdev prepare phase
Michal Privoznik [Mon, 24 Apr 2023 10:12:57 +0000 (12:12 +0200)]
qemu: Deny all but VFIO PCI backends in hostdev prepare phase

We used to support KVM and VFIO style of PCI assignment. The
former was dropped in v5.7.0-rc1~103 and thus we only support
VFIO. All other backends lead to an error (see
qemuBuildPCIHostdevDevProps(), or qemuBuildPCIHostdevDevStr() as
it used to be called in the era of aforementioned commit).

Might as well report the error in prepare phase and save hassle
of proceeding with device preparation (e.g. in case of hotplug
overriding the device's driver, setting seclabels, etc.).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemuxml2argvtest: Drop needless PCI backend setting
Michal Privoznik [Mon, 24 Apr 2023 07:51:46 +0000 (09:51 +0200)]
qemuxml2argvtest: Drop needless PCI backend setting

The qemuxml2argvtest does a bit of 'fixups' to parsed
virDomainDef just before generating the cmd line. For instance,
it sets PCI backend for hostdevs (to VFIO). The reason for this
is that we want to make the test host independent and thus
letting the code chose backend at runtime might render different
results on different machines. But this is not necessary, as
virpcimock (that the test uses) already creates a fake, but
stable environment (where /dev/vfio/vfio and IOMMU groups exist),
thus qemuHostdevHostSupportsPassthroughVFIO() returns true,
regardless of the actual host support.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: Move <hostdev/> PCI backend setting into qemuDomainPrepareHostdev()
Michal Privoznik [Fri, 21 Apr 2023 14:56:10 +0000 (16:56 +0200)]
qemu: Move <hostdev/> PCI backend setting into qemuDomainPrepareHostdev()

virsh command domxml-to-native failed with below error but start
command succeed for same domain xml.

  "internal error: invalid PCI passthrough type 'default'"

If a <hostdev> PCI backend is not set in the XML, the supported
one is then chosen in qemuHostdevPreparePCIDevicesCheckSupport().
But this function is not called anywhere from
qemuConnectDomainXMLToNative(). But qemuDomainPrepareHostdev()
is. And it is also called from domain startup/hotplug code.
Therefore, move the backend setting to the common path and drop
qemuHostdevPreparePCIDevicesCheckSupport().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu_domain: Move internals of qemuDomainPrepareHostdev() into a separate function
Michal Privoznik [Mon, 24 Apr 2023 08:51:52 +0000 (10:51 +0200)]
qemu_domain: Move internals of qemuDomainPrepareHostdev() into a separate function

So far, qemuDomainPrepareHostdev() is a NOP for anything but a
SCSI hostdev. This will change soon. Therefore, move the SCSI
hostdev preparation into a separate function
(qemuDomainPrepareHostdevSCSI()) and make
qemuDomainPrepareHostdev() call function corresponding to the
hostdev type (or nothing if the type doesn't need any
preparation).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemuDomainAttachHostDevice: Prepare device early and for all types
Michal Privoznik [Fri, 14 Apr 2023 10:43:47 +0000 (12:43 +0200)]
qemuDomainAttachHostDevice: Prepare device early and for all types

When attaching a hostdev of a SCSI subsys,
qemuDomainPrepareHostdev() is called. This makes sense because
the function prepares just SCSI hostdevs ignoring others. But
this will soon change. Thefore, move the function call out of
qemuDomainAttachHostSCSIDevice() and into
qemuDomainAttachHostDevice().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agodocs: Fix missing backtick in formatdomain.rst
Martin Kletzander [Tue, 25 Apr 2023 10:32:12 +0000 (12:32 +0200)]
docs: Fix missing backtick in formatdomain.rst

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: allow forcing emulated maxphysaddr
Ján Tomko [Tue, 25 Apr 2023 09:11:59 +0000 (11:11 +0200)]
qemu: allow forcing emulated maxphysaddr

Treat:
  <maxphysaddr mode="emulate"/>
as a request not to take the maximum address size from the host.
This is useful if QEMU changes the default.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: add support for setting host-phys-bits-limit
Ján Tomko [Wed, 1 Mar 2023 11:31:41 +0000 (12:31 +0100)]
qemu: add support for setting host-phys-bits-limit

Translate <maxphysaddr limit='39'/> to:
host-phys-bits-limit=39

https://gitlab.com/libvirt/libvirt/-/issues/450
https://bugzilla.redhat.com/show_bug.cgi?id=2171860

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoconf: cpu: add limit for maxphysaddr
Ján Tomko [Wed, 1 Mar 2023 10:27:30 +0000 (11:27 +0100)]
conf: cpu: add limit for maxphysaddr

Add a limit attribute to restrict the maximum physical address bits
that would be used for the guest CPU:

   <cpu mode='host-passthrough'>
     <maxphysaddr mode='passthrough' limit='39'/>
   </cpu>

https://gitlab.com/libvirt/libvirt/-/issues/450
https://bugzilla.redhat.com/show_bug.cgi?id=2171860

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agolxc: Fix access to hostdev capabilities
Michal Privoznik [Tue, 25 Apr 2023 08:00:18 +0000 (10:00 +0200)]
lxc: Fix access to hostdev capabilities

In a few places, where a capabilities <hostdev/> is processed, a
wrong union member is access: def->source.subsys.type instead of
def->source.caps.type. Fortunately, both union members have .type
as the very first member so no real harm is done. Nevertheless,
we should access the correct union member.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agolxc: Make lxcCreateHostdevDef() less versatile
Michal Privoznik [Tue, 25 Apr 2023 07:29:53 +0000 (09:29 +0200)]
lxc: Make lxcCreateHostdevDef() less versatile

Usually, we want a function to be as reusable as possible. But in
this specific case, when it's used just once we don't need that.
The lxcCreateHostdevDef() function is meant to create a hostdev.
The first argument selects the hostdev mode (caps/subsys) and the
second argument selects the type of hostdev (NET/STORAGE/MISC).
But because of how the function is written, it's impossible to
create a subsys hostdev as the function sets
hostdev->source.caps.type, regardless of mode. So the @mode
argument can be dropped.

Then, the function is called from one place and one place only.
And in there, VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET is passed for
@type so we can drop that argument too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 25 Apr 2023 08:21:05 +0000 (10:21 +0200)]
Translated using Weblate (Swedish)

Currently translated at 51.4% (5348 of 10400 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>
2 years agoTranslated using Weblate (Korean)
김인수 [Tue, 25 Apr 2023 08:21:05 +0000 (10:21 +0200)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10400 of 10400 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>
2 years agoTranslated using Weblate (Czech)
Pavel Borecki [Tue, 25 Apr 2023 08:21:04 +0000 (10:21 +0200)]
Translated using Weblate (Czech)

Currently translated at 100.0% (10400 of 10400 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>
2 years agoqemuhotplugtest: Verify domain XML on UPDATE
Michal Privoznik [Fri, 21 Apr 2023 07:56:20 +0000 (09:56 +0200)]
qemuhotplugtest: Verify domain XML on UPDATE

Just like we check the resulting domain XML after ATTACH and
DETACH, we should do the same after UPDATE action. This is as
simple as calling testQemuHotplugCheckResult() and providing
missing XMLs. For those test cases where no change is done, we
can just make the expected XML a symlink to the input XML.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoqemuhotplugtest: use g_autoptr(virDomainDeviceDef)
Michal Privoznik [Thu, 20 Apr 2023 15:59:14 +0000 (17:59 +0200)]
qemuhotplugtest: use g_autoptr(virDomainDeviceDef)

This brings us one step closer to the caller of
qemuDomainAttachDeviceLive()
(qemuDomainAttachDeviceLiveAndConfig()).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoqemuhotplugtest: Don't overwrite vm->def->id in testQemuHotplugCheckResult()
Michal Privoznik [Fri, 21 Apr 2023 08:06:10 +0000 (10:06 +0200)]
qemuhotplugtest: Don't overwrite vm->def->id in testQemuHotplugCheckResult()

This is a leftover from v2.0.0-rc1~300. In v1.2.12-rc1~43 we've
introduced a code that explicitly sets vm->def->id to -1 to force
generation of inactive XML. But this was removed in the later
commit, which forgot to remove the restoration of the original
dom ID.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoqemuhotplugtest: Fix misleading comment on monitor unlock
Michal Privoznik [Thu, 20 Apr 2023 15:59:02 +0000 (17:59 +0200)]
qemuhotplugtest: Fix misleading comment on monitor unlock

There's a comment in testQemuHotplug() trying to explain why we
need to unlock the monitor object. Well, while it might have been
correct when being introduced, it's no longer factually correct
as just any function (attach/detach/update) might talk to the
monitor and it expects the monitor to be unlocked (as it calls
qemuDomainObjEnterMonitor() + qemuDomainObjExitMonitor()).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoqemu_hotplug.h: Expose less functions
Michal Privoznik [Thu, 20 Apr 2023 15:17:08 +0000 (17:17 +0200)]
qemu_hotplug.h: Expose less functions

After previous cleanups a lot of functions from qemu_hotplug.c
are called only within the file. Make them static and drop their
declarations from the header file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemuhotplugtest: Call qemuDomainUpdateDeviceLive() directly
Michal Privoznik [Thu, 20 Apr 2023 15:47:04 +0000 (17:47 +0200)]
qemuhotplugtest: Call qemuDomainUpdateDeviceLive() directly

There's no reason for qemuhotplugtest to reimplement which device
update function to call (testQemuHotplugUpdate()) when
qemuDomainUpdateDeviceLive() already does that. Thus, drop
testQemuHotplugUpdate() and call qemuDomainUpdateDeviceLive()
directly.

BTW: this also shows why reimplementing
qemuDomainUpdateDeviceLive() is bad idea: The
"disk-cdrom-nochange" test is succeeding only because
testQemuHotplugUpdate() supports graphics and returns an
(expected) error for every other devtype.

NB, there's still missing check that the resulting XML is the
expected one (just like we do for attach and detach), but that's
pre-existing and will be fixed later.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoqemuhotplugtest: Call qemuDomainAttachDeviceLive() directly
Michal Privoznik [Thu, 20 Apr 2023 15:16:46 +0000 (17:16 +0200)]
qemuhotplugtest: Call qemuDomainAttachDeviceLive() directly

There's no reason for qemuhotplugtest to reimplement which device
attach function to call (testQemuHotplugAttach()) when
qemuDomainAttachDeviceLive() already does that. Thus, drop
testQemuHotplugAttach() and call qemuDomainAttachDeviceLive()
directly.

There's one small catch though, qemuDomainAttachDeviceLive() now
calls one monitor command more (to list all aliases). We don't
care really, because we're not testing that. Therefore, just
provide a dummy reply.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoqemuhotplugtest: Call qemuDomainDetachDeviceLive() directly
Michal Privoznik [Thu, 20 Apr 2023 14:53:02 +0000 (16:53 +0200)]
qemuhotplugtest: Call qemuDomainDetachDeviceLive() directly

The testQemuHotplugDetach() already does call
qemuDomainDetachDeviceLive() but only for some device types. For
the rest it reports an error (but only if running test
verbosely). This makes no sense. Just call
qemuDomainDetachDeviceLive() directly and drop
testQemuHotplugDetach().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>