]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
2 years agoqemu: Validate watchdog action compatibility per-device
Martin Kletzander [Wed, 19 Apr 2023 12:07:26 +0000 (14:07 +0200)]
qemu: Validate watchdog action compatibility per-device

This makes it also work during attach.  Also add a test for attaching a
watchdog with incompatible action.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2187278
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Check all watchdogs for iTCO duplicates
Martin Kletzander [Wed, 19 Apr 2023 12:19:16 +0000 (14:19 +0200)]
qemu: Check all watchdogs for iTCO duplicates

The loop initially skipped the first one because it was mainly checking
the incompatible actions, but was then modified to also check the
duplicity of iTCO watchdogs.

While at it change the type of the iteration variable to the usual size_t.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2187133
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Forbid ib700 watchdogs for non-i440fx machine types
Martin Kletzander [Wed, 19 Apr 2023 11:54:02 +0000 (13:54 +0200)]
qemu: Forbid ib700 watchdogs for non-i440fx machine types

We can launch qemu with it, but it will not work since it's not even
probed by the kernel at the mapped address with different machine types
since they are expected to be connected to ISA and not even its newer
LPC counterpart found on q35.  And it does not exist on non-x86
architectures.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Forbid device attach of existing platform watchdog
Martin Kletzander [Wed, 19 Apr 2023 11:52:01 +0000 (13:52 +0200)]
qemu: Forbid device attach of existing platform watchdog

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Fix grammar and quoting in watchdog error message on hotplug
Martin Kletzander [Wed, 19 Apr 2023 11:59:23 +0000 (13:59 +0200)]
qemu: Fix grammar and quoting in watchdog error message on hotplug

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Add missing empty lines before virDomainWatchdogDefParseXML
Martin Kletzander [Wed, 19 Apr 2023 11:51:13 +0000 (13:51 +0200)]
conf: Add missing empty lines before virDomainWatchdogDefParseXML

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu_domain: Increase memlock limit for NVMe disks
Michal Privoznik [Wed, 12 Apr 2023 15:15:08 +0000 (17:15 +0200)]
qemu_domain: Increase memlock limit for NVMe disks

When starting QEMU, or when hotplugging a PCI device QEMU might
lock some memory. How much? Well, that's an undecidable problem.

But despite that, we try to guess. And it more or less works,
until there's a counter example. This time, it's a guest with
both <hostdev/> and an NVMe <disk/>. I've started a simple guest
with 4GiB of memory:

  # virsh dominfo fedora
  Max memory:     4194304 KiB
  Used memory:    4194304 KiB

And here are the amounts of memory that QEMU tried to lock,
obtained via:

  grep VmLck /proc/$(pgrep qemu-kvm)/status

  1) with just one <hostdev/>
     VmLck:   4194308 kB

  2) with just one NVMe <disk/>
     VmLck:   4328544 kB

  3) with one <hostdev/> and one NVMe <disk/>
     VmLck:   8522852 kB

Now, what's surprising is case 2) where the locked memory exceeds
the VM memory. It almost resembles VDPA. Therefore, treat is as
such.

Unfortunately, I don't have a box with two or more spare NVMe-s
so I can't tell for sure. But setting limit too tight means QEMU
refuses to start.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2014030
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agonetworkRefreshDhcpDaemon: Get dnsmasq's PID once
Michal Privoznik [Mon, 17 Apr 2023 08:10:15 +0000 (10:10 +0200)]
networkRefreshDhcpDaemon: Get dnsmasq's PID once

This is a relic of commit v3.7.0-rc1~132 when getter/setter APIs
for dnsmasq's PID were introduced. Previously, obj->dnsmasqPid
was accessed directly. But the aforementioned commit introduced
two calls to virNetworkObjGetDnsmasqPid() even though the result
of the first call is stored in a variable.

Remove the second call as it's unnecessary.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: Initialize _virNetworkObj::dnsmasqPid to -1 in virNetworkObjNew()
Michal Privoznik [Mon, 17 Apr 2023 08:10:04 +0000 (10:10 +0200)]
conf: Initialize _virNetworkObj::dnsmasqPid to -1 in virNetworkObjNew()

Throughout all of our network driver code we assume that
dnsmasqPid of value -1 means the network has no dnsmasq process
running. There are plenty of calls to:

  virNetworkObjSetDnsmasqPid(obj, -1);

or:

  pid_t dnsmasqPid = virNetworkObjGetDnsmasqPid(obj);
  if (dnsmasqPid > 0) ...;

Now, a virNetworkObj is created via virNetworkObjNew() which
might as well set this de-facto default value.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agonetworkUpdateState: do not assume dnsmasq_caps
Michal Privoznik [Mon, 17 Apr 2023 08:09:51 +0000 (10:09 +0200)]
networkUpdateState: do not assume dnsmasq_caps

Assume there's a dnsmasq running (because there's an active
virtual network that spawned it). Now, shut down the daemon,
remove the dnsmasq binary and start the daemon again. At this
point, networkUpdateState() is called, but dnsmasq_caps is NULL
(because networkStateInitialize() called earlier failed to set
them, rightfully though).

Now, the networkUpdateState() tries to read the dnsmasq's PID
file using virPidFileReadIfAlive() which takes a path to the
corresponding binary as one of its arguments. To provide that
path, dnsmasqCapsGetBinaryPath() is called, but since
dnsmasq_caps is NULL, it dereferences it and thus causes a crash.

It's true that virPidFileReadIfAlive() can deal with a removed
binary (well virPidFileReadPathIfAlive() which it calls can), but
iff the binary path is provided in its absolute form. Otherwise,
virFileResolveAllLinks() fails to canonicalize the path
(expected, the path doesn't exist anyway).

Therefore, reading dnsmasq's PID file didn't work before
v8.1.0-rc1~401 which introduced this crash. It was always set to
-1. But passing NULL as binary path instead, makes
virPidFileReadIfAlive() return early, right after the PID file is
read and it's confirmed the PID exists.

Yes, this may yield wrong results, as the PID might be of a
completely different binary. But this problem is preexistent and
until we start locking PID files, there's nothing we can do about
it. IOW, it would require rework of dnsmasq PID file handling.

Fixes: 4b68c982e283471575bacbf87302495864da46fe
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/456
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoTranslated using Weblate (Czech)
Pavel Borecki [Wed, 19 Apr 2023 05:48:48 +0000 (07:48 +0200)]
Translated using Weblate (Czech)

Currently translated at 97.9% (10191 of 10400 strings)

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

Translated using Weblate (Czech)

Currently translated at 97.9% (10189 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 agoNEWS: Mention change of default machine type for ARM and RISC-V
Jim Fehlig [Fri, 14 Apr 2023 17:07:35 +0000 (11:07 -0600)]
NEWS: Mention change of default machine type for ARM and RISC-V

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemu: Change default machine type for RISC-V
Jim Fehlig [Fri, 14 Apr 2023 17:01:33 +0000 (11:01 -0600)]
qemu: Change default machine type for RISC-V

It's quite difficult, if not impossible, to create a working RISC-V VMs
using the current default machine type of 'spike_v1.10'. Change the
default to the more appropriate and virtualization friendly 'virt'
machine type.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemu: Change default machine type for ARM
Jim Fehlig [Fri, 14 Apr 2023 16:48:49 +0000 (10:48 -0600)]
qemu: Change default machine type for ARM

It's quite difficult, if not impossible, to create a usable ARM VMs
using the current default machine type of 'integratorcp'. Change the
default to the more appropriate and virtualization friendly 'virt'
machine type.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoTranslated using Weblate (Georgian)
Temuri Doghonadze [Tue, 18 Apr 2023 13:54:58 +0000 (15:54 +0200)]
Translated using Weblate (Georgian)

Currently translated at 3.9% (408 of 10400 strings)

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

Translated using Weblate (Georgian)

Currently translated at 3.9% (406 of 10400 strings)

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

Co-authored-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
Signed-off-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
2 years agoTranslated using Weblate (Czech)
Pavel Borecki [Tue, 18 Apr 2023 13:54:57 +0000 (15:54 +0200)]
Translated using Weblate (Czech)

Currently translated at 97.6% (10152 of 10400 strings)

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

Translated using Weblate (Czech)

Currently translated at 97.5% (10150 of 10400 strings)

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

Translated using Weblate (Czech)

Currently translated at 96.7% (10063 of 10400 strings)

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

Translated using Weblate (Czech)

Currently translated at 96.7% (10061 of 10400 strings)

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

Translated using Weblate (Czech)

Currently translated at 93.9% (9767 of 10400 strings)

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

Translated using Weblate (Czech)

Currently translated at 90.7% (9437 of 10400 strings)

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

Translated using Weblate (Czech)

Currently translated at 88.9% (9252 of 10400 strings)

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

Translated using Weblate (Czech)

Currently translated at 88.9% (9251 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 agoqemu_hotplug: Deny live detach of <console/>
Michal Privoznik [Wed, 12 Apr 2023 10:41:53 +0000 (12:41 +0200)]
qemu_hotplug: Deny live detach of <console/>

I've tried, then I've tried even harder, but still wasn't able to
make sense of our console backcompat code in all its fine
details. Since I value my sanity, let's just forbid hotunplug of
<console/>, especially since detaching of corresponding <serial/>
works.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuDomainRemoveChrDevice: Deal with qemuDomainChrRemove() failure
Michal Privoznik [Wed, 12 Apr 2023 08:22:42 +0000 (10:22 +0200)]
qemuDomainRemoveChrDevice: Deal with qemuDomainChrRemove() failure

When cleaning up after removed device, qemuDomainChrRemove() is
called. But this may fail, in which case we successfully ignore
the failure and virDomainChrDefFree() the device anyway. While it
decreases our memory consumption, it's a bit too far, especially
if the next step is 'virsh dumpxml'. Then our memory consumption
decreases all the way down to zero as we crash.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuAssignDeviceChrAlias: Fix a crasher during <console/> hotplug
Michal Privoznik [Wed, 12 Apr 2023 10:20:42 +0000 (12:20 +0200)]
qemuAssignDeviceChrAlias: Fix a crasher during <console/> hotplug

For a running guest, a <serial/> device can be hotunplugged. This
will then remove also aliased <console/>. Trying to hotplug a
<console/> device then, libvirtd crashed because it dereferences
def->consoles while there's none.

Fixes: 42d53ac799a1d7f1414737caa4deb73871876992
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuDomainChrRemove: Don't leak vmdef->consoles[0]
Michal Privoznik [Wed, 12 Apr 2023 12:14:30 +0000 (14:14 +0200)]
qemuDomainChrRemove: Don't leak vmdef->consoles[0]

When removing the compat console from domain defintion, removing
it from the vmdef->consoles array is good, but not sufficient.
The console definition might have been fully allocated (after
daemon restarted and reloaded the status XML). Use
virDomainChrDefFree() to free also the definition.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuDomainChrInsertPreAlloced: Fix adding implicit console
Michal Privoznik [Wed, 12 Apr 2023 10:41:35 +0000 (12:41 +0200)]
qemuDomainChrInsertPreAlloced: Fix adding implicit console

When hotpluging a <serial/> device, we might need to add a
<console/> device with it (because of some crazy backcompat).
Now, hotplugging is done in several phases. In one of them,
qemuDomainChrPreInsert() allocates space for both devices, and
then qemuDomainChrInsertPreAlloced() actually inserts the device
into domain definition and sets up the <console/> device with it.
Except, the condition that checks whether to create the aliased
<console/> is wrong as it compares nconsoles against 0.
Surprisingly, qemuDomainChrInsertPreAllocCleanup() doesn't suffer
from the same error.

Fixes: daf51be5f1b0f7b41c0813d43d6b66edfbe4f6d9
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: Restrict use of <portForward> to the passt backend
Andrea Bolognani [Tue, 18 Apr 2023 09:08:03 +0000 (11:08 +0200)]
conf: Restrict use of <portForward> to the passt backend

That's already the case in practice, but it's a better
experience for the user if we reject this configuration
outright instead of silently ignoring part of it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: viracpitest only works on little endian
Boris Fiuczynski [Tue, 18 Apr 2023 09:53:08 +0000 (11:53 +0200)]
tests: viracpitest only works on little endian

Commit fc216db4fb789cbd309 introduced a mocked test with binary test data
which fails on big endian machines.
Therefore build the viracpitest test only on little endian machines.

Fixes: fc216db4fb789cbd30917be036d0b94d965bdf7f
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirsh: Introduce --xpath and --wrap to domcapabilities
Michal Privoznik [Fri, 14 Apr 2023 14:06:02 +0000 (16:06 +0200)]
virsh: Introduce --xpath and --wrap to domcapabilities

Similarly to dumpxml, let's have --xpath and --wrap to the
'domcapabilities' command since users might be interested only in
a subset of domcapabilities XML.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agovirsh: Introduce --xpath and --wrap to capabilities
Michal Privoznik [Fri, 14 Apr 2023 14:01:56 +0000 (16:01 +0200)]
virsh: Introduce --xpath and --wrap to capabilities

Similarly to dumpxml, let's have --xpath and --wrap to the
'capabilities' command since users might be interested only in a
subset of capabilities XML.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agodocs: formatdomain: Properly indent example XML for setting 'metadata_cache'
Peter Krempa [Tue, 28 Feb 2023 13:46:20 +0000 (14:46 +0100)]
docs: formatdomain: Properly indent example XML for setting 'metadata_cache'

Indent the example XML block so that it belongs to the paragraph talking
about it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agokbase: debuglogs: Add a 'TL;DR' section for enabling logging in most common case
Peter Krempa [Mon, 17 Apr 2023 11:31:25 +0000 (13:31 +0200)]
kbase: debuglogs: Add a 'TL;DR' section for enabling logging in most common case

The document grew a bit too much explaining all the mistakes we've seen
the users do when configuring logging. Add a section distilling the
configuration of the most basic scenario which we can refer to when
upstream issues are reported. The scenario is for a runtime setting of
logging into a file applied to the 'virtqemud' daemon.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoMove src/keycodemapdb -> subprojects/keycodemapdb
Marc-André Lureau [Mon, 17 Apr 2023 11:54:01 +0000 (15:54 +0400)]
Move src/keycodemapdb -> subprojects/keycodemapdb

Follow better meson build system conventions. This allows to find
keymap-gen or CSV without explicitly setting the paths.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agorpc/ssh: ssh_userauth_agent() is not supported on win32
Marc-André Lureau [Mon, 17 Apr 2023 11:54:00 +0000 (15:54 +0400)]
rpc/ssh: ssh_userauth_agent() is not supported on win32

The function does not exist on win32.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agomeson: drop explicit python interpreter
Marc-André Lureau [Mon, 17 Apr 2023 11:53:59 +0000 (15:53 +0400)]
meson: drop explicit python interpreter

meson wraps python scripts already on win32, so we end up with these
failing commands:

[1/359] "C:/msys64/ucrt64/bin/meson" "--internal" "exe" "--capture" "src/util/virkeycodetable_atset1.h" "--" "sh" "C:/msys64/home/marca/src/libvirt/scripts/meson-python.sh" "C:/msys64/ucrt64/bin/python3.EXE" "python" "C:/msys64/home/marca/src/libvirt/src/keycodemapdb/tools/keymap-gen" "code-table" "--lang" "stdc" "--varname" "virKeyCodeTable_atset1" "C:/msys64/home/marca/src/libvirt/src/keycodemapdb/data/keymaps.csv" "atset1"
FAILED: src/util/virkeycodetable_atset1.h
"C:/msys64/ucrt64/bin/meson" "--internal" "exe" "--capture" "src/util/virkeycodetable_atset1.h" "--" "sh" "C:/msys64/home/marca/src/libvirt/scripts/meson-python.sh" "C:/msys64/ucrt64/bin/python3.EXE" "python" "C:/msys64/home/marca/src/libvirt/src/keycodemapdb/tools/keymap-gen" "code-table" "--lang" "stdc" "--varname" "virKeyCodeTable_atset1" "C:/msys64/home/marca/src/libvirt/src/keycodemapdb/data/keymaps.csv" "atset1"

If LC_ALL, LANG and LC_CTYPE need to be set, it would probably be better
to use a meson environment() instead.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agomeson: don't hard code find_program() location
Marc-André Lureau [Mon, 17 Apr 2023 11:53:58 +0000 (15:53 +0400)]
meson: don't hard code find_program() location

Use 'dirs' argument to locate the program.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agokeycodemapdb: update submodule for build fixes
Marc-André Lureau [Mon, 17 Apr 2023 11:53:57 +0000 (15:53 +0400)]
keycodemapdb: update submodule for build fixes

A number of changes, but notably python script shebang fixing build
issues in CI:

Daniel P. Berrangé (1):
      Revert "Add local argparse for compat with python 2.6"

Dawid Dziurla (1):
      Don't hardcode python3 path in shebang

Eli Schwartz (1):
      make the meson.build stub a bit more well-rounded by exporting files

Pierre Ossman (1):
      Fix macOS "ISO" key

Ross Lagerwall (2):
      Use python3 binary rather than unversioned python
      Fix Hangeul/Hanja scancodes

William (1):
      Add Qemu qcode support for F13 to F24

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agomeson: don't look for unix paths on win32
Marc-André Lureau [Mon, 17 Apr 2023 11:53:56 +0000 (15:53 +0400)]
meson: don't look for unix paths on win32

Or meson will complain with:
../meson.build:770:2: ERROR: Search directory /sbin is not an absolute path.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirsh-domain-event: Make 'virshEventIOError(Reason)Print' translation friendly
Peter Krempa [Thu, 13 Apr 2023 06:39:22 +0000 (08:39 +0200)]
virsh-domain-event: Make 'virshEventIOError(Reason)Print' translation friendly

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirsh-domain-event: Make 'virshEventWatchdogPrint' translation friendly
Peter Krempa [Thu, 13 Apr 2023 06:39:22 +0000 (08:39 +0200)]
virsh-domain-event: Make 'virshEventWatchdogPrint' translation friendly

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirsh-domain-event: Make 'virshEventTrayChangePrint' translation friendly
Peter Krempa [Thu, 13 Apr 2023 06:39:22 +0000 (08:39 +0200)]
virsh-domain-event: Make 'virshEventTrayChangePrint' translation friendly

Remove construction of the event string from sub-strings marked as
translatable. Without context it's impossible to translate it correctly.

This slightly increases verbosity of the code but actually makes it more
readable as everything is inline.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirsh: event: Introduce virshEventPrintf
Peter Krempa [Thu, 13 Apr 2023 07:31:34 +0000 (09:31 +0200)]
virsh: event: Introduce virshEventPrintf

Extract internals of virshEventPrint into a function that can take the
format string. The function will be used in upcoming patches which make
the event formatting translatable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovshPrint: Add version using 'va_list'
Peter Krempa [Thu, 13 Apr 2023 07:19:27 +0000 (09:19 +0200)]
vshPrint: Add version using 'va_list'

Add a version for functions which may already need to take a printf
format string.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirshGraphicsAddressToString: Remove pointless translation
Peter Krempa [Thu, 13 Apr 2023 07:44:05 +0000 (09:44 +0200)]
virshGraphicsAddressToString: Remove pointless translation

There's no point in marking the protocol name as translatable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoDon't translate strings used with VIR_DEBUG
Peter Krempa [Thu, 13 Apr 2023 06:30:21 +0000 (08:30 +0200)]
Don't translate strings used with VIR_DEBUG

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirCgroupV1GetBlkioIo(Device)Serviced: Refactor extraction of cgroup data
Peter Krempa [Wed, 12 Apr 2023 12:46:04 +0000 (14:46 +0200)]
virCgroupV1GetBlkioIo(Device)Serviced: Refactor extraction of cgroup data

Rewrite the code to improve maintainability and also re-do construction
of error messages which are assembled from non-translatable parts.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/455
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Fix incorrect command name in error messages
Andrea Bolognani [Fri, 14 Apr 2023 08:37:10 +0000 (10:37 +0200)]
qemu: Fix incorrect command name in error messages

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2 years agosecurity: do not remember/recall labels for VFIO MDEVs
Eric Farman [Sat, 1 Apr 2023 00:42:04 +0000 (02:42 +0200)]
security: do not remember/recall labels for VFIO MDEVs

Commit dbf1f68410 ("security: do not remember/recall labels for VFIO")
rightly changed the DAC and SELinux labeling parameters to fix a problem
with "VFIO hostdevs" but really only addressed the PCI codepaths.
As a result, we can still encounter this with VFIO MDEVs such as
vfio-ccw and vfio-ap, which can fail on a hotplug:

  [test@host ~]# mdevctl stop -u 11f2d2bc-4083-431d-a023-eff72715c4f0
  [test@host ~]# mdevctl start -u 11f2d2bc-4083-431d-a023-eff72715c4f0
  [test@host ~]# cat disk.xml
    <hostdev mode='subsystem' type='mdev' model='vfio-ccw'>
      <source>
        <address uuid='11f2d2bc-4083-431d-a023-eff72715c4f0'/>
      </source>
      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x3c51'/>
    </hostdev>
  [test@host ~]# virsh attach-device guest ~/disk.xml
  error: Failed to attach device from /home/test/disk.xml
  error: Requested operation is not valid: Setting different SELinux label on /dev/vfio/3 which is already in use

Make the same changes as reported in commit dbf1f68410, for the mdev paths.

Reported-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Introduce igb model for <interface>
Akihiko Odaki [Mon, 10 Apr 2023 05:48:07 +0000 (14:48 +0900)]
conf: Introduce igb model for <interface>

igb is a new network device which will be introduced with QEMU 8.0.0.
It is a successor of e1000e so it has PCIe interface and is understands
virtio-net headers as e1000e does.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Fix potential crash during driver cleanup
Jim Fehlig [Tue, 11 Apr 2023 15:15:43 +0000 (09:15 -0600)]
qemu: Fix potential crash during driver cleanup

During qemu driver shutdown, objects are freed in qemuStateCleanup that
could still be used by active worker threads, resulting in crashes. E.g.
a worker thread could be processing a monitor EOF event after the
security manager is already disposed

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fd9a9a1e1fe in virSecurityManagerMoveImageMetadata (mgr=0x7fd948012160, pid=-1, src=src@entry=0x7fd98c072c90, dst=dst@entry=0x0)
    at ../../src/security/security_manager.c:468
#1  0x00007fd9646ff0f0 in qemuSecurityMoveImageMetadata (driver=driver@entry=0x7fd948043830, vm=vm@entry=0x7fd98c066db0, src=src@entry=0x7fd98c072c90,
    dst=dst@entry=0x0) at ../../src/qemu/qemu_security.c:182
#2  0x00007fd96462c7b0 in qemuBlockRemoveImageMetadata (driver=driver@entry=0x7fd948043830, vm=vm@entry=0x7fd98c066db0, diskTarget=0x7fd98c072530 "vda",
    src=<optimized out>) at ../../src/qemu/qemu_block.c:2628
#3  0x00007fd9646929d6 in qemuProcessStop (driver=driver@entry=0x7fd948043830, vm=vm@entry=0x7fd98c066db0, reason=reason@entry=VIR_DOMAIN_SHUTOFF_SHUTDOWN,
    asyncJob=asyncJob@entry=QEMU_ASYNC_JOB_NONE, flags=<optimized out>) at ../../src/qemu/qemu_process.c:7585
#4  0x00007fd9646fc842 in processMonitorEOFEvent (vm=0x7fd98c066db0, driver=0x7fd948043830) at ../../src/qemu/qemu_driver.c:4794
#5  qemuProcessEventHandler (data=0x561a93febb60, opaque=0x7fd948043830) at ../../src/qemu/qemu_driver.c:4900
#6  0x00007fd9a9971a31 in virThreadPoolWorker (opaque=opaque@entry=0x561a93fb58e0) at ../../src/util/virthreadpool.c:163
(gdb) p mgr->drv
$2 = (virSecurityDriverPtr) 0x0

Prior to commit 7cf76d4e3ab, the worker thread pool was freed before
disposing any driver objects. Let's return to that pattern, but leave
the other changes made by 7cf76d4e3ab.

Signed-off-by: Tamara Schmitz <tamara.schmitz@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoconf: Fix migration in some firmware autoselection scenarios
Andrea Bolognani [Tue, 11 Apr 2023 15:56:45 +0000 (17:56 +0200)]
conf: Fix migration in some firmware autoselection scenarios

Introduce a small kludge in the parser to avoid unnecessarily
blocking incoming migration from a range of recent libvirt
releases.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: Tweak input file
Andrea Bolognani [Tue, 11 Apr 2023 16:06:20 +0000 (18:06 +0200)]
tests: Tweak input file

The canonical order for <os> child elements is <firmware>
then <loader>.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: Move validation of virDomainGraphicsListenDef out of parser
K Shiva Kiran [Thu, 6 Apr 2023 16:23:32 +0000 (21:53 +0530)]
conf: Move validation of virDomainGraphicsListenDef out of parser

In an effort to separate the validation steps from the Parse stage,
a few validation checks of virDomainGraphicsListenDef have been moved from
virDomainGraphicsListenDefParseXML() in domain_conf.c to
virDomainGraphicsDefListensValidate() in domain_validate.c

Signed-off-by: K Shiva <shiva_kr@riseup.net>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoTranslated using Weblate (Czech)
Pavel Borecki [Tue, 11 Apr 2023 20:20:51 +0000 (22:20 +0200)]
Translated using Weblate (Czech)

Currently translated at 86.1% (8958 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 agoqemu: snapshot: Allow inactive internal snapshots with uefi
Peter Krempa [Thu, 6 Apr 2023 13:23:46 +0000 (15:23 +0200)]
qemu: snapshot: Allow inactive internal snapshots with uefi

Historically the snapshot code attempted to forbid internal snapshots
with UEFI both in active and inactive case. Unfortunately due to the
intricacies of UEFI probing this didn't really work for inactive VMs
which made users rely on the feature.

Now with the changes to store detected UEFI environment also in the
inactive definition this broke the feature for those users.

Since the varstore doesn't really change that much in the lifecycle of a
VM it usually is okay to simply leave it as is.

Restore the functionality for inactive snapshots by disabling the check.

In the future when uefi snapshotting will be added the rest of the
condition will also be removed.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/460
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotestutilsqemu: Drop fake capability testing infrastructure for 'aarch64'
Peter Krempa [Fri, 24 Mar 2023 09:25:05 +0000 (10:25 +0100)]
testutilsqemu: Drop fake capability testing infrastructure for 'aarch64'

Now that all tests were converted to use real capabilities we don't need
it any more. Remove it so that no new tests are added with it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2xmltest: Convert rest of 'aarch64' cases to real capabilities
Peter Krempa [Fri, 24 Mar 2023 15:48:38 +0000 (16:48 +0100)]
qemuxml2xmltest: Convert rest of 'aarch64' cases to real capabilities

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2xmltest: Modernize 'mach-virt*' cases
Peter Krempa [Fri, 24 Mar 2023 15:40:53 +0000 (16:40 +0100)]
qemuxml2xmltest: Modernize 'mach-virt*' cases

Use real capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2xmloutdata: Don't symlink output data for 'mach-virt*' cases
Peter Krempa [Tue, 28 Mar 2023 13:52:46 +0000 (15:52 +0200)]
qemuxml2xmloutdata: Don't symlink output data for 'mach-virt*' cases

Replace them with full files so that potential fallout from conversion
to real capabilities is more obvious and the test is simpler to add.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2xmltest: Modernize 'aarch64-gic*' test cases
Peter Krempa [Fri, 24 Mar 2023 15:47:03 +0000 (16:47 +0100)]
qemuxml2xmltest: Modernize 'aarch64-gic*' test cases

Use real capabilities for them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2xmlout: Do not symlink output files for 'aarch64-gic' cases
Peter Krempa [Tue, 28 Mar 2023 13:48:09 +0000 (15:48 +0200)]
qemuxml2xmlout: Do not symlink output files for 'aarch64-gic' cases

Upcoming patch will be modifying all of them to use real capabilities.
This way it will be more obvious what will change.

Keeping the symlinks around is tedious for humans to do. Waste some
storage instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Modernize the rest of 'aarch64' cases
Peter Krempa [Fri, 24 Mar 2023 14:42:43 +0000 (15:42 +0100)]
qemuxml2argvtest: Modernize the rest of 'aarch64' cases

Use real capabilities for them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2(argv|xml)test: Modernize testing of USB controllers on aarch64
Peter Krempa [Fri, 24 Mar 2023 15:33:06 +0000 (16:33 +0100)]
qemuxml2(argv|xml)test: Modernize testing of USB controllers on aarch64

All supported qemu versions at this point support both 'qemu-xhci' and
'nec-xhci' controllers. To allow using real capabilities restructure the
tests so that we test both controllers explicitly as well as the
selection of the default model.

Also add a xml2xml test invocation of the unified test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2*test: Drop fake-caps invocation of 'aarch64-virtio-pci-manual-addresses'
Peter Krempa [Tue, 28 Mar 2023 12:49:37 +0000 (14:49 +0200)]
qemuxml2*test: Drop fake-caps invocation of 'aarch64-virtio-pci-manual-addresses'

The fake-caps version was kept as an example that the code behaves the
same with real capabilities. Now it's not needed any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Update 'aarch64-virtio-pci-manual-addresses' case
Peter Krempa [Tue, 28 Mar 2023 12:41:57 +0000 (14:41 +0200)]
qemuxml2argvtest: Update 'aarch64-virtio-pci-manual-addresses' case

With all supported qemu versions we'll pick PCIe to use for the implicit
address busses (those lacking an explicit controller) and thus the
addresses must reflect that.

Update the test to add the new flags, and fix the addresses.
Additionally add a real-caps version of the test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Modernize all 'mach-virt-' aarch64 test cases
Peter Krempa [Fri, 24 Mar 2023 14:41:25 +0000 (15:41 +0100)]
qemuxml2argvtest: Modernize all 'mach-virt-' aarch64 test cases

Use real capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Don't symlink output files for 'mach-virt-' cases
Peter Krempa [Fri, 24 Mar 2023 15:28:24 +0000 (16:28 +0100)]
qemuxml2argvtest: Don't symlink output files for 'mach-virt-' cases

Make the output changes of upcoming modernization more visible.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Modernize 'balloon-mmio-deflate'
Peter Krempa [Fri, 24 Mar 2023 14:49:25 +0000 (15:49 +0100)]
qemuxml2argvtest: Modernize 'balloon-mmio-deflate'

Use real capabilities and mask-out support for PCIe.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argv: Test default aarch64 cofig without PCIe support
Peter Krempa [Fri, 24 Mar 2023 12:08:13 +0000 (13:08 +0100)]
qemuxml2argv: Test default aarch64 cofig without PCIe support

Use real caps and clear out flags for PCIe so that we have a real-ish
example of an aarch64 machine using mmio.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Drop "aarch64-virt-2.6-virtio-pci-default" case
Peter Krempa [Fri, 24 Mar 2023 15:11:56 +0000 (16:11 +0100)]
qemuxml2argvtest: Drop "aarch64-virt-2.6-virtio-pci-default" case

The test data is effectively identical to the
'aarch64-virtio-pci-default' case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Add real-caps versions of 'aarch64-virt-virtio'
Peter Krempa [Fri, 24 Mar 2023 12:03:27 +0000 (13:03 +0100)]
qemuxml2argvtest: Add real-caps versions of 'aarch64-virt-virtio'

Add a version for 'latest' caps as well as '4.2.0'. The test
demonstrates that with a real qemu PCIe will be used instead of MMIO.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Convert the rest of GIC tests to latest capabilities
Peter Krempa [Fri, 24 Mar 2023 10:15:40 +0000 (11:15 +0100)]
qemuxml2argvtest: Convert the rest of GIC tests to latest capabilities

Convert the two negative cases to use real capapbilities as well as the
positive case for situations when KVM is not used by stripping the
QEMU_CAPS_KVM flag.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Convert DO_TEST_GIC to use real latest capabilities
Peter Krempa [Fri, 24 Mar 2023 09:31:13 +0000 (10:31 +0100)]
qemuxml2argvtest: Convert DO_TEST_GIC to use real latest capabilities

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Use real capabilities in tests for picking the aarch64 GIC version
Peter Krempa [Fri, 24 Mar 2023 09:46:42 +0000 (10:46 +0100)]
qemuxml2argvtest: Use real capabilities in tests for picking the aarch64 GIC version

Convert 'aarch64-gic-default' and 'aarch64-gic-none' cases to use real
capabilities both latest and locked to 4.2.0 to show what would happen
with a real qemu.

Note that the qemuTestSetHostArch() calls are needed as real caps
override the setting once used. Once we convert all tests to real data
this can be dropped.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvdata: Do not symlink output files for aarch64 gic tests
Peter Krempa [Fri, 24 Mar 2023 09:55:41 +0000 (10:55 +0100)]
qemuxml2argvdata: Do not symlink output files for aarch64 gic tests

Upcoming patches will be modifying the tests for selecting the GIC
version to use real capabilities. This in certain cases will show that a
different version is picked.

Using symlinks makes it inconvenient to do the modifications and
unobvious what changed.

Remove the symlinks and replace them by real output files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirDomainPCIAddressSetExtensionAlloc: Remove return value
Peter Krempa [Tue, 28 Mar 2023 12:37:40 +0000 (14:37 +0200)]
virDomainPCIAddressSetExtensionAlloc: Remove return value

The function always returns 0. Remove the return value and refactor
caller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoAdded translation using Weblate (Romanian)
Remus-Gabriel Chelu [Sat, 8 Apr 2023 23:47:23 +0000 (01:47 +0200)]
Added translation using Weblate (Romanian)

Co-authored-by: Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>
Signed-off-by: Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>
2 years agoutil: acpi: include unistd.h
Ján Tomko [Thu, 6 Apr 2023 13:39:37 +0000 (15:39 +0200)]
util: acpi: include unistd.h

For lseek.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2 years agoviracpi: Fir error format string in virAcpiParseIORTNodeHeader()
Michal Privoznik [Thu, 6 Apr 2023 12:27:00 +0000 (14:27 +0200)]
viracpi: Fir error format string in virAcpiParseIORTNodeHeader()

Inside of virAcpiParseIORTNodeHeader() there's an
virReportError() which reports size of a structure using sizeof()
operator. Well, it's not well documented but the returned type of
sizeof() is apparently size_t but the format string uses %lu.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirt-host-validate: Detect SMMU presence on ARMs by parsing IORT table
Michal Privoznik [Wed, 5 Apr 2023 08:57:45 +0000 (10:57 +0200)]
virt-host-validate: Detect SMMU presence on ARMs by parsing IORT table

In my previous commit v9.2.0-rc1~3 I've made virt-host-validate
to report host IOMMU check pass if IORT table is present. This is
not sufficient though, because IORT describes much more than just
IOMMU (well, it's called SMMU in ARM world). In fact, this can be
seen in previous commit which adds test cases: there are tables
(IORT_virt_aarch64) which does not contain any SMMU records.

But after previous commits, we can parse the table so switch to
that.

Fixes: 2c13a2a7c9c368ea81eccd4ba12d9cf34bdd331b
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2178885
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agotests: Introduce viracpitest
Michal Privoznik [Tue, 4 Apr 2023 15:07:21 +0000 (17:07 +0200)]
tests: Introduce viracpitest

Introduce a test that checks newly introduced virAcpi module.
There are three IORT tables from a real HW (IORT_ampere,
IORT_gigabyte and IORT_qualcomm), then there's one from a VM
(IORT_virt_aarch64) and one that I handcrafted to be empty
(IORT_empty).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoutil: Introduce virAcpi module
Michal Privoznik [Tue, 4 Apr 2023 13:37:01 +0000 (15:37 +0200)]
util: Introduce virAcpi module

The aim of this new module is to contain code that's parsing ACPI
tables. For now, only parsing of IORT table is implemented (it's
ARM specific table). And since we only need to check whether the
table contains SMMU record, the code is very simplified.
I've followed the specification published here:

  https://developer.arm.com/documentation/den0049/latest/

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoTranslated using Weblate (Chinese (Simplified) (zh_CN))
Yang Yulin [Thu, 6 Apr 2023 08:20:46 +0000 (10:20 +0200)]
Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 99.5% (10358 of 10400 strings)

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

Co-authored-by: Yang Yulin <yylteam@icloud.com>
Signed-off-by: Yang Yulin <yylteam@icloud.com>
2 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Thu, 6 Apr 2023 08:20:46 +0000 (10:20 +0200)]
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10400 of 10400 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)
김인수 [Thu, 6 Apr 2023 08:20:45 +0000 (10:20 +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/

Translated using Weblate (Korean)

Currently translated at 99.8% (10384 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 (French)
Jérémie Tarot [Thu, 6 Apr 2023 08:20:45 +0000 (10:20 +0200)]
Translated using Weblate (French)

Currently translated at 99.9% (10399 of 10400 strings)

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

Co-authored-by: Jérémie Tarot <silopolis@gmail.com>
Signed-off-by: Jérémie Tarot <silopolis@gmail.com>
2 years agoTranslated using Weblate (Czech)
Pavel Borecki [Thu, 6 Apr 2023 08:20:44 +0000 (10:20 +0200)]
Translated using Weblate (Czech)

Currently translated at 84.9% (8830 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 agocoding style: Follow our own rule on comment style
Michal Privoznik [Tue, 4 Apr 2023 09:56:31 +0000 (11:56 +0200)]
coding style: Follow our own rule on comment style

In our coding style document we have examples of good and bad
code, which we mark as:

  // Good
  // Bad

respectively. But in the very same document we advocate for using
C style of comments over C++. Follow our own advice and switch
annotation to:

  /* Good */
  /* Bad */

And while at it, align these annotations within their blocks for
better readability.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agotests: Don't use GIO_COMPILATION
Andrea Bolognani [Thu, 30 Mar 2023 14:08:05 +0000 (16:08 +0200)]
tests: Don't use GIO_COMPILATION

This flag is intended to be used exclusively in the context of
building GLib itself and should not be passed to the compiler
by a third-party project such as libvirt.

Reverts: 77d1fa5 ("tests: Compile virgdbusmock.c with GIO_COMPILATION enabled")
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: Don't build virgdbusmock on Windows
Andrea Bolognani [Thu, 30 Mar 2023 14:07:33 +0000 (16:07 +0200)]
tests: Don't build virgdbusmock on Windows

All of the tests that use this mock (networkxml2firewalltest,
virsystemdtest, virpolkittest) are either no-ops on Windows, or
are not compiled at all on the target.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: Drop dead code
Andrea Bolognani [Thu, 30 Mar 2023 13:25:31 +0000 (15:25 +0200)]
tests: Drop dead code

Left behind by commit 35eb484 ("tests: remove firewalld
backend tests from virfirewalltest.c").

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoci: Regenerate files
Andrea Bolognani [Thu, 30 Mar 2023 09:15:18 +0000 (11:15 +0200)]
ci: Regenerate files

This unbreaks the various $CROSS-$NAME-local-env jobs.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoqemu_snapshot: external: don't error out when updating metadata
Pavel Hrdina [Tue, 21 Mar 2023 16:42:10 +0000 (17:42 +0100)]
qemu_snapshot: external: don't error out when updating metadata

Attaching disk into running VM the offline definition may not be
updated and we will end up with that disk existing only in live
definition. Creating snapshot with this state saves both live and
offline definition into snapshot metadata.

When we are deleting an external snapshot we are updating these
definitions in the snapshot metadata so we should just skip over
non-existing disks instead of reporting error.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs: apps: Add a new section for backup utilities and mention 'virtnbdbackup'
Michael Ablassmeier [Thu, 30 Mar 2023 11:16:55 +0000 (13:16 +0200)]
docs: apps: Add a new section for backup utilities and mention 'virtnbdbackup'

Signed-off-by: Michael Ablassmeier <abi@grinser.de>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agodomaincapstest: Skip unknown variants instead of the default variant
Peter Krempa [Mon, 3 Apr 2023 08:47:36 +0000 (10:47 +0200)]
domaincapstest: Skip unknown variants instead of the default variant

Fix the logic selecting when to run the tests to skip unknown variants
rather than the default variant.

Fixes: 738c5bae888
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2 years agotestutilsqemu: Drop fake capability testing infrastructure for 's390'
Peter Krempa [Fri, 24 Mar 2023 12:24:06 +0000 (13:24 +0100)]
testutilsqemu: Drop fake capability testing infrastructure for 's390'

Now that all tests were converted to use real capabilities we don't need
it any more. Remove it so that no new tests are added with it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2xmltest: Convert all s390 test cases to real capabilities
Peter Krempa [Fri, 24 Mar 2023 14:10:25 +0000 (15:10 +0100)]
qemuxml2xmltest: Convert all s390 test cases to real capabilities

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Convert rest of s390 tests to real caps
Peter Krempa [Fri, 24 Mar 2023 14:28:56 +0000 (15:28 +0100)]
qemuxml2argvtest: Convert rest of s390 tests to real caps

Convert the rest of the outstanding tests to use real capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Modernize s390 cpu tests
Peter Krempa [Fri, 24 Mar 2023 13:53:01 +0000 (14:53 +0100)]
qemuxml2argvtest: Modernize s390 cpu tests

Use real capabilities for the CPU test. The negative test case for QEMUs
without QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION is removed as the feature is
now supported by all supported qemu versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Modernize all s390 'loadparm' tests
Peter Krempa [Fri, 24 Mar 2023 14:26:22 +0000 (15:26 +0100)]
qemuxml2argvtest: Modernize all s390 'loadparm' tests

Use latest caps for the tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Modernize all s390 'keywrap' tests
Peter Krempa [Fri, 24 Mar 2023 13:42:04 +0000 (14:42 +0100)]
qemuxml2argvtest: Modernize all s390 'keywrap' tests

Use latest caps for the tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Remove obsolete negative tests
Peter Krempa [Fri, 24 Mar 2023 12:45:41 +0000 (13:45 +0100)]
qemuxml2argvtest: Remove obsolete negative tests

The 'hostdev-subsys-mdev-vfio-ccw', 'hostdev-vfio-zpci', and
'hostdev-vfio-zpci-autogenerate-fids' test cases have negative versions
which are invoked without capabilities. This does not make sense going
forward as the tests are going to be switched to real capabilities.

Remove them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotestutilsqemu: Drop fake capability testing infrastructure for 'ppc64'
Peter Krempa [Wed, 8 Mar 2023 21:46:27 +0000 (22:46 +0100)]
testutilsqemu: Drop fake capability testing infrastructure for 'ppc64'

Now that all tests were converted to use real capabilities we don't need
it any more. Remove it so that no new tests are added with it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Use real capabilities for negative test cases for ppc64 architecture
Peter Krempa [Fri, 17 Mar 2023 14:52:06 +0000 (15:52 +0100)]
qemuxml2argvtest: Use real capabilities for negative test cases for ppc64 architecture

Convert the last outstanding test cases for ppc64 to use real
capabilities.

In couple cases this actually fixes the test case to test what it was
intending to do.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuValidateDomainDefPSeriesFeature: Simplify feature validation
Peter Krempa [Tue, 21 Mar 2023 15:15:25 +0000 (16:15 +0100)]
qemuValidateDomainDefPSeriesFeature: Simplify feature validation

Unify validation of VIR_DOMAIN_FEATURE_HTM, VIR_DOMAIN_FEATURE_NESTED_HV,
VIR_DOMAIN_FEATURE_CCF_ASSIST and remove temporary string.

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