]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
2 years agoTranslated using Weblate (Chinese (Simplified) (zh_CN))
Jiri Denemark [Thu, 16 Mar 2023 14:26:17 +0000 (15:26 +0100)] 
Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 99.5% (10373 of 10416 strings)

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

Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 99.5% (10373 of 10416 strings)

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

Translated using Weblate (Japanese)

Currently translated at 99.5% (10368 of 10416 strings)

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

Translated using Weblate (Japanese)

Currently translated at 99.5% (10369 of 10416 strings)

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

Co-authored-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2 years agoTranslated using Weblate (Czech)
Daniel P. Berrangé [Thu, 16 Mar 2023 14:26:16 +0000 (15:26 +0100)] 
Translated using Weblate (Czech)

Currently translated at 83.5% (8706 of 10416 strings)

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

Co-authored-by: Daniel P. Berrange <berrange@redhat.com>
Co-authored-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2 years agomeson: stop CLang doing inter-procedural analysis
Daniel P. Berrangé [Thu, 16 Mar 2023 12:50:56 +0000 (12:50 +0000)] 
meson: stop CLang doing inter-procedural analysis

The virNumaNodeIsAvailable function is stubbed out when building
without libnuma, such that it just returns a constant value. When
CLang is optimizing, it does inter-procedural analysis across
function calls. When it sees that the call to virNumaNodeIsAvailable
returns a fixed constant, it elides the conditional check for errors
in the callers such as virNumaNodesetIsAvailable.

This is a valid optimization as the C standard declares that there
must only be one implementation of each function in a binary. This
is normally the case, but ELF allows for function overrides when
linking or at runtime with LD_PRELOAD, which is technically outside
the mandated C language behaviour.

So while CLang's optimization works fine at runtime, it breaks in our
test suite which aims to mock the virNumaNodeIsAvailable function so
that it has specific semantics regardless of whether libnuma is built
or not. The return value check optimization though means our mock
override won't have the right effect. The mock will be invoked, but
its return value is not used.

Potentially the same problem could be exhibited with GCC if certain
combinations of optimizations are enabled, though thus far we've
not seen it.

To be robust on both CLang and GCC we need to make it more explicit
that we want to be able to replace functions and thus optimization
of calls must be limited. Currently we rely on 'noinline' which
does successfully prevent inlining of the function, but it cannot
stop the eliding of checks based on the constant return value.
Thus we need a bigger hammer.

There are a couple of options to disable this optimization:

 * Annotate a symbol as 'weak'. This is tells the compiler
   that the symbol is intended to be overridable at linktime
   or runtime, and thus it will avoid doing inter-procedural
   analysis for optimizations. This was tried previously but
   have to be reverted as it had unintended consequences
   when linking .a files into our final .so, resulting in all
   the weak symbol impls being lost. See commit
   407a281a8e2b6c5078ba1148535663ea64fd9314

 * Annotate a symbol with 'noipa'. This tells the compiler
   to avoid inter-procedural analysis for calls to just this
   function. This would be ideal match for our scenario, but
   unfortunately it is only implemented for GCC currently:

     https://reviews.llvm.org/D101011

 * The '-fsemantic-interposition' argument tells the optimizer
   that any functions may be replaced with alternative
   implementations that have different semantics. It thus
   blocks any optimizations across function calls. This is
   quite a harsh block on the optimizer, but it appears to be
   the only one that is viable with CLang.

Out of those choices option (3) is the only viable option for
CLang. We don't want todo it for GCC though as it is such a
big hammer. Probably we should apply (2) for GCC, should we
experiance a problem in future.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoqemu: use correct formatting string for size_t
Ján Tomko [Fri, 17 Mar 2023 13:58:23 +0000 (14:58 +0100)] 
qemu: use correct formatting string for size_t

Otherwise the build on armv7l breaks:
error: format ‘%lu’ expects argument of type
‘long unsigned int’, but argument 4 has type
‘size_t’ {aka ‘unsigned int’} [-Werror=format=]

Fixes: 1992ae40fac90c315d0d8d1a9c6f880bd0a39b57
Fixes: e239f7d0a86ebddf9aab3f8c8e6b6e66351485b2
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: qemublocktest: fix memory leak
Ján Tomko [Fri, 17 Mar 2023 14:34:02 +0000 (15:34 +0100)] 
tests: qemublocktest: fix memory leak

Set enccount to 1, so the cleanup function knows
there is something to be cleaned up.

Fixes: 1992ae40fac90c315d0d8d1a9c6f880bd0a39b57
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: add luks-any encryption support for RBD images
Or Ozeri [Mon, 13 Mar 2023 09:50:23 +0000 (04:50 -0500)] 
qemu: add luks-any encryption support for RBD images

The newly added luks-any rbd encryption format in qemu
allows for opening both LUKS and LUKS2 encryption formats.
This commit enables libvirt uses to use this wildcard format.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: capabilities: Introduce QEMU_CAPS_RBD_ENCRYPTION_LUKS_ANY capability
Or Ozeri [Mon, 13 Mar 2023 09:50:22 +0000 (04:50 -0500)] 
qemu: capabilities: Introduce QEMU_CAPS_RBD_ENCRYPTION_LUKS_ANY capability

This capability represents that qemu supports the "luks-any" encryption
format for RBD images.
Both LUKS and LUKS2 formats can be parsed using this wildcard format.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: add support for librbd layered encryption
Or Ozeri [Mon, 13 Mar 2023 09:50:21 +0000 (04:50 -0500)] 
qemu: add support for librbd layered encryption

This commit enables libvirt users to use layered encryption
of RBD images, using the librbd encryption engine.
This allows opening of an encrypted cloned image
whose parent is encrypted with a possibly different encryption key.
To open such images, multiple encryption secrets are expected
to be defined under the encryption XML tag.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: add multi-secret support in _qemuDomainStorageSourcePrivate
Or Ozeri [Mon, 13 Mar 2023 09:50:20 +0000 (04:50 -0500)] 
qemu: add multi-secret support in _qemuDomainStorageSourcePrivate

This commit changes the _qemuDomainStorageSourcePrivate struct
to support multiple secrets (instead of a single one before this commit).
This will useful for storage encryption requiring more than a single secret.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: add multi-secret support in qemuBlockStorageSourceAttachData
Or Ozeri [Mon, 13 Mar 2023 09:50:19 +0000 (04:50 -0500)] 
qemu: add multi-secret support in qemuBlockStorageSourceAttachData

This commit changes the qemuBlockStorageSourceAttachData struct
to support multiple secrets (instead of a single one before this commit).
This will useful for storage encryption requiring more than a single secret.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: add support for multiple secret aliases
Or Ozeri [Mon, 13 Mar 2023 09:50:18 +0000 (04:50 -0500)] 
qemu: add support for multiple secret aliases

Change secret aliases from %s-%s-secret0 to %s-%s-secret%lu,
which will later be used for storage encryption requiring more
than a single secret.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: capabilities: Introduce QEMU_CAPS_RBD_ENCRYPTION_LAYERING capability
Or Ozeri [Mon, 13 Mar 2023 09:50:17 +0000 (04:50 -0500)] 
qemu: capabilities: Introduce QEMU_CAPS_RBD_ENCRYPTION_LAYERING capability

This capability represents that qemu supports the layered encryption
of RBD images, where a cloned image is encrypted with a possible
different encryption than its parent image.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agodocs: clarify --timeout description for virtsecretd
Ján Tomko [Wed, 15 Mar 2023 10:15:01 +0000 (11:15 +0100)] 
docs: clarify --timeout description for virtsecretd

As of commit 9e3cc0ff5 the virtsecretd daemon does not timeout
while it keeps any ephemeral secrets.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agodocs: clarify --timeout description for split daemons
Ján Tomko [Wed, 15 Mar 2023 10:08:29 +0000 (11:08 +0100)] 
docs: clarify --timeout description for split daemons

Remove the reference to "running domains" for daemons that happily
exit while domains are running.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoutil: virXMLValidatorInit: improve translatable errors
Ján Tomko [Wed, 8 Mar 2023 13:00:18 +0000 (14:00 +0100)] 
util: virXMLValidatorInit: improve translatable errors

In some translations, the RNG initials were mistranslated
as a random number generator.

Spell it out as RelaxNG to make it clearer.
Include the word 'schema' and quotes around the filename.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agocpu_map: Add missing feature "fsrc"
Tim Wiederhake [Thu, 9 Mar 2023 13:18:18 +0000 (14:18 +0100)] 
cpu_map: Add missing feature "fsrc"

Introduced in qemu 58794f644e.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agocpu_map: Add missing feature "fsrs"
Tim Wiederhake [Thu, 9 Mar 2023 13:18:18 +0000 (14:18 +0100)] 
cpu_map: Add missing feature "fsrs"

Introduced in qemu 58794f644e.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agocpu_map: Add missing feature "fzrm"
Tim Wiederhake [Thu, 9 Mar 2023 13:18:18 +0000 (14:18 +0100)] 
cpu_map: Add missing feature "fzrm"

Introduced in qemu 58794f644e.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agocpu_map: Add missing feature "sgx-aex-notify"
Tim Wiederhake [Thu, 9 Mar 2023 13:18:18 +0000 (14:18 +0100)] 
cpu_map: Add missing feature "sgx-aex-notify"

Introduced in qemu d45f24fe75.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agocpu_map: Add missing feature "sgx-edeccssa"
Tim Wiederhake [Thu, 9 Mar 2023 13:18:18 +0000 (14:18 +0100)] 
cpu_map: Add missing feature "sgx-edeccssa"

Introduced in qemu d45f24fe75.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agosync_qemu_features_i386: Ignore xen-vapic
Tim Wiederhake [Thu, 9 Mar 2023 13:18:18 +0000 (14:18 +0100)] 
sync_qemu_features_i386: Ignore xen-vapic

Not a cpu-feature.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agosync_qemu_models_i386.py: Add missing features
Tim Wiederhake [Thu, 9 Mar 2023 13:18:18 +0000 (14:18 +0100)] 
sync_qemu_models_i386.py: Add missing features

This brings the tool's list of features in sync with qemu
commit 9832009d9dd2386664c15cc70f6e6bfe062be8bd.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agosync_qemu_models_i386.py: Sort features
Tim Wiederhake [Thu, 9 Mar 2023 13:18:17 +0000 (14:18 +0100)] 
sync_qemu_models_i386.py: Sort features

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoNEWS: Document recent thread-context bug fix
Michal Privoznik [Wed, 8 Mar 2023 10:59:39 +0000 (11:59 +0100)] 
NEWS: Document recent thread-context bug fix

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agodocs: Document memory allocation and emulator pinning limitation
Michal Privoznik [Wed, 8 Mar 2023 10:53:37 +0000 (11:53 +0100)] 
docs: Document memory allocation and emulator pinning limitation

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemuBuildThreadContextProps: Prune .node-affinity wrt <emulatorpin/>
Michal Privoznik [Tue, 7 Mar 2023 13:05:54 +0000 (14:05 +0100)] 
qemuBuildThreadContextProps: Prune .node-affinity wrt <emulatorpin/>

When a thread-context object is specified on the cmd line, then
QEMU spawns a thread and sets its affinity to the list of NUMA
nodes specified in .node-affinity attribute. And this works just
fine, until the main QEMU thread itself is not restricted.

Because of v5.3.0-rc1~18 we restrict the main emulator thread
even before QEMU is executed and thus then it tries to set
affinity of a thread-context thread, it inevitably fails with:

  Setting CPU affinity failed: Invalid argument

Now, we could lift the pinning temporarily, let QEMU spawn all
thread-context threads, and enforce pinning again, but that would
require some form of communication with QEMU (maybe -preconfig?).
But that would still be wrong, because it would circumvent
<emulatorpin/>.

Technically speaking, thread-context is an internal
implementation detail of QEMU, and if it weren't for it, the main
emulator thread would be doing the allocation. Therefore, we
should honor the pinning and prune the list of node so that
inaccessible ones are dropped.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2154750
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemu: Add @nodemask argument to qemuBuildThreadContextProps()
Michal Privoznik [Tue, 7 Mar 2023 11:39:47 +0000 (12:39 +0100)] 
qemu: Add @nodemask argument to qemuBuildThreadContextProps()

When building a thread-context object (inside of
qemuBuildThreadContextProps()) we look at given memory-backend-*
object and look for .host-nodes attribute. This works, as long as
we need to just copy the attribute value into another
thread-context attribute. But soon we will need to adjust it.
That's the point where having the value in virBitmap comes handy.
Utilize the previous commit, which made
qemuBuildMemoryBackendProps() set the argument and pass it into
qemuBuildThreadContextProps().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemu: Add @nodemaskRet argument to qemuBuildMemoryBackendProps()
Michal Privoznik [Tue, 7 Mar 2023 11:02:11 +0000 (12:02 +0100)] 
qemu: Add @nodemaskRet argument to qemuBuildMemoryBackendProps()

While it's true that anybody who's interested in getting
.host-nodes attribute value can just use
virJSONValueObjectGetArray() (and that's exactly what
qemuBuildThreadContextProps() is doing, btw), if somebody is
interested in getting the actual virBitmap, they would have to
parse the JSON array.

Instead, introduce an argument to qemuBuildMemoryBackendProps()
which is set to corresponding value used when formatting the
attribute.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemuBuildMemoryBackendProps: Join two conditions
Michal Privoznik [Tue, 14 Mar 2023 16:19:27 +0000 (17:19 +0100)] 
qemuBuildMemoryBackendProps: Join two conditions

There are two compound conditions in
qemuBuildMemoryBackendProps() and each one checks for nodemask
for NULL first. Join them into one bigger block.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemu: Fix qemuDomainGetEmulatorPinInfo()
Michal Privoznik [Tue, 7 Mar 2023 11:31:08 +0000 (12:31 +0100)] 
qemu: Fix qemuDomainGetEmulatorPinInfo()

The order of pinning priority (at least for emulator thread) was
set by v1.2.15-rc1~58 (for cgroup code). But later, when
automatic placement was implemented into
qemuDomainGetEmulatorPinInfo(), the priority was not honored.

Now that we have this priority code in a separate function, we
can just call that and avoid this type of error.

Fixes: 776924e37649f2d47acd805746d5fd9325212ea5
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemu: Move cpuset preference evaluation into a separate function
Michal Privoznik [Tue, 7 Mar 2023 11:27:05 +0000 (12:27 +0100)] 
qemu: Move cpuset preference evaluation into a separate function

The set of if()-s that determines the preference in cpumask used
for setting things like emulatorpin, vcpupin, etc. is going to be
re-used. Separate it out into a function.

You may think that this changes behaviour, but
qemuProcessPrepareDomainNUMAPlacement() ensures that
priv->autoCpuset is set for VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemuxml2argvmock: Drop virNuma* mocks
Michal Privoznik [Tue, 7 Mar 2023 15:06:14 +0000 (16:06 +0100)] 
qemuxml2argvmock: Drop virNuma* mocks

Since qemuxml2argvtest is now using virnumamock, there's no need
for qemuxml2argvmock to offer reimplementation of virNuma*()
functions. Also, the comment about CLang and FreeBSD (introduced
in v4.3.0-40-g77ac204d14) is no longer true. Looks like noinline
attribute was the missing culprit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemuxml2argvdata: Extend vCPUs placement in memory-hotplug-dimm-addr.xml
Michal Privoznik [Tue, 7 Mar 2023 14:36:47 +0000 (15:36 +0100)] 
qemuxml2argvdata: Extend vCPUs placement in memory-hotplug-dimm-addr.xml

So far, the memory-hotplug-dimm-addr.xml test case pins its vCPUs
onto CPUs 0-1 which correspond to NUMA node #0 (per
tests/vircaps2xmldata/linux-basic/system/node/node0). Place vCPUs
onto nodes #1 and #2 too so that DIMM <memory/> device can
continue using thread-context after future patches. This
configuration, as-is currently, would make QEMU error out anyway.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemuxml2argvdata: Adjust maximum NUMA node used
Michal Privoznik [Tue, 7 Mar 2023 15:06:03 +0000 (16:06 +0100)] 
qemuxml2argvdata: Adjust maximum NUMA node used

We have couple of qemuxml2argvtest cases where up to 8 NUMA nodes
are assumed. These are used to check whether disjoint ranges of
host-nodes= is generated properly. Without prejudice to the
generality, we can rewrite corresponding XML files to use up to 4
NUMA nodes and still have disjoint ranges.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemuxml2argvtest: Use virnuma mock
Michal Privoznik [Tue, 7 Mar 2023 14:36:35 +0000 (15:36 +0100)] 
qemuxml2argvtest: Use virnuma mock

While no part of cmd line building process currently depends on a
host NUMA configuration, this will change soon. Use freshly
changed virnumamock from qemuxml2argvtest and make the mock read
NUMA data from vircaps2xmldata which seems to have the most rich
NUMA configuration.

This also means, we have to start building virnumamock
unconditionally. But this is not a problem, since nothing inside
of the mock relies on Linux specificity. The whole mock is merely
just reading files and parsing them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agovirnumamock: Introduce virNumaGetNodeOfCPU() mock
Michal Privoznik [Tue, 7 Mar 2023 14:44:41 +0000 (15:44 +0100)] 
virnumamock: Introduce virNumaGetNodeOfCPU() mock

Introduce a mock of virNumaGetNodeOfCPU() because soon we will
need virNumaCPUSetToNodeset() to return predictable results.
Also, fill in missing symlinks in vircaps2xmldata/.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agovirnuma: Introduce virNumaCPUSetToNodeset()
Michal Privoznik [Tue, 7 Mar 2023 13:05:27 +0000 (14:05 +0100)] 
virnuma: Introduce virNumaCPUSetToNodeset()

So far, we have a function that expands given list of NUMA nodes
into list of CPUs. But soon, we are going to need the inverse -
expand list of CPUs into list of NUMA nodes. Introduce
virNumaCPUSetToNodeset() for that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agovirnuma: Move virNumaNodesetToCPUset() out of WITH_NUMACTL
Michal Privoznik [Wed, 8 Mar 2023 09:10:00 +0000 (10:10 +0100)] 
virnuma: Move virNumaNodesetToCPUset() out of WITH_NUMACTL

Technically, there's nothing libnuma specific about
virNumaNodesetToCPUset(). It just implements a generic algorithm
over virNumaGetNodeCPUs() (which is then libnuma dependant).
Nevertheless, there's no need to have this function living inside
WITH_NUMACTL block. Any error returned from virNumaGetNodeCPUs()
(including the one that !WITH_NUMACTL stub returns) is propagated
properly.

Move the function out of the block into a generic one and drop
the !WITH_NUMACTL stub.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemu_alias: Fix backcompat console alias generation
Michal Privoznik [Tue, 14 Mar 2023 10:03:50 +0000 (11:03 +0100)] 
qemu_alias: Fix backcompat console alias generation

We have this crazy backwards compatibility when it comes to
serial and console devices. Basically, in same cases the very
first <console/> is just an alias to the very first <serial/>
device. This is to be seen at various places:

1) virDomainDefFormatInternalSetRootName() - when generating
   domain XML, the <console/> configuration is basically ignored
   and corresponding <serial/> config is formatted,

2) virDomainDefAddConsoleCompat() - which adds a copy of
   <serial/> or <console/> into virDomainDef in post parse.

And when talking to QEMU we need a special handling too, because
while <serial/> is generated on the cmd line, the <console/> is
not. And in a lot of place we get it right. Except for generating
device aliases. On domain startup the 'expected' happens and
devices get "serial0" and "console0" aliases, correspondingly.
This ends up in the status XML too. But due to aforementioned
trick when formatting domain XML, "serial0" ends up in both
'virsh dumpxml' and the status XML. But internally, both devices
have different alias. Therefore, detaching the device using
<console/> fails as qemuDomainDetachDeviceChr() tries to detach
"console0".

After the daemon is restarted and status XML is parsed, then
everything works suddenly. This is because in the status XML both
devices have the same alias.

Let's generate correct alias from the beginning.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2156300
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemu_migration: Use VIR_DOMAIN_PAUSED_API_ERROR
Jiri Denemark [Wed, 1 Mar 2023 11:55:18 +0000 (12:55 +0100)] 
qemu_migration: Use VIR_DOMAIN_PAUSED_API_ERROR

Other APIs that internally use QEMU migration and need to temporarily
suspend a domain already report failure to resume vCPUs by setting
VIR_DOMAIN_PAUSED_API_ERROR state reason and emitting
VIR_DOMAIN_EVENT_SUSPENDED event with
VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR.

Let's do the same in qemuMigrationSrcRestoreDomainState for consistent
behavior.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoIntroduce VIR_DOMAIN_PAUSED_API_ERROR
Jiri Denemark [Tue, 28 Feb 2023 15:53:29 +0000 (16:53 +0100)] 
Introduce VIR_DOMAIN_PAUSED_API_ERROR

Some APIs (migration, save/restore, snapshot, ...) require a domain to
be suspended temporarily. In case resuming the domain fails, the domain
will be unexpectedly left paused when the API finishes. This situation
is reported via VIR_DOMAIN_EVENT_SUSPENDED event with
VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR detail. But we do not have a
corresponding reason for VIR_DOMAIN_PAUSED state and the reason would
remain set to the value used when the domain was paused. So the state
reason would suggest the operation is still running.

This patch changes the state reason to a new VIR_DOMAIN_PAUSED_API_ERROR
to make it clear the API that paused the domain already finished, but
failed to resume the domain.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoClarify VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR semantics
Jiri Denemark [Tue, 28 Feb 2023 14:49:29 +0000 (15:49 +0100)] 
Clarify VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR semantics

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoNEWS: Mention support for custom UEFI firmwar paths in Xen
Jim Fehlig [Mon, 13 Mar 2023 20:37:49 +0000 (14:37 -0600)] 
NEWS: Mention support for custom UEFI firmwar paths in Xen

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: remove unused argument
Ján Tomko [Mon, 13 Mar 2023 13:42:58 +0000 (14:42 +0100)] 
qemu: remove unused argument

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: relax shared memory check for vhostuser daemons
Ján Tomko [Mon, 13 Mar 2023 12:56:47 +0000 (13:56 +0100)] 
qemu: relax shared memory check for vhostuser daemons

For some vhostuser daemons, we validate that the guest memory is shared
with the host.

With earlier versions of QEMU, it was only possible to mark memory
as shared by defining an explicit NUMA topology.  Later, QEMU exposed
the name of the default memory backend (defaultRAMid) so we can mark
that memory as shared.

Since libvirt commit:
  commit bff2ad5d6b1f25da02802273934d2a519159fec7
    qemu: Relax validation for mem->access if guest has no NUMA
we already check for the case when user requests shared memory,
but QEMU did not expose defaultRAMid.

Drop the duplicit check from vhostuser device validation, to make
it pass on hotplug even after libvirtd restart.

This avoids the need to store the defaultRAMid, since we don't really
need it for anything after the VM has been already started.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agonews: Update for passt on SELinux/AppArmor support
Andrea Bolognani [Tue, 14 Mar 2023 09:44:38 +0000 (10:44 +0100)] 
news: Update for passt on SELinux/AppArmor support

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agorpm: Recommend passt-selinux
Andrea Bolognani [Tue, 14 Mar 2023 09:41:46 +0000 (10:41 +0100)] 
rpm: Recommend passt-selinux

Now that we have SELinux support for passt, we want things to
work out of the box and that requires having the passt-specific
SELinux bits installed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agodocs: downloads: Point to pkg.go.dev for go module releases
Peter Krempa [Tue, 14 Mar 2023 09:11:33 +0000 (10:11 +0100)] 
docs: downloads: Point to pkg.go.dev for go module releases

Currently the 'Releases' column pointed to the generic page about the
specific go module. Change the link to point to the respective
pkg.go.dev page for the module.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agodocs: downloads: Don't mention releases directory of libvirt-csharp
Peter Krempa [Tue, 14 Mar 2023 12:01:59 +0000 (13:01 +0100)] 
docs: downloads: Don't mention releases directory of libvirt-csharp

The releases directory is empty. Don't advertise it on our downloads
page.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agodocs: downloads: Drop link to sources of 'consoleproxy'
Peter Krempa [Tue, 14 Mar 2023 08:47:35 +0000 (09:47 +0100)] 
docs: downloads: Drop link to sources of 'consoleproxy'

The directory doesn't exist. The project also doesn't have any releases
on gitlab so there's nothing to replace it with.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agospec: Use 'download.libvirt.org' as source server
Peter Krempa [Tue, 14 Mar 2023 08:32:30 +0000 (09:32 +0100)] 
spec: Use 'download.libvirt.org' as source server

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agodocs: downloads: Replace 'libvirt.org/sources' by 'download.libvirt.org'
Peter Krempa [Tue, 14 Mar 2023 08:30:25 +0000 (09:30 +0100)] 
docs: downloads: Replace 'libvirt.org/sources' by 'download.libvirt.org'

We split off the downloads into a new subdomain. Link directly to it
instead of relying on redirects.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agodocs: java: Clean up links to source code
Peter Krempa [Tue, 14 Mar 2023 08:26:11 +0000 (09:26 +0100)] 
docs: java: Clean up links to source code

 - drop the link to the FTP server which doesn't exist any more
 - change links to libvirt.org/source to download.libvirt.org
 - change link to the maven repository to point to download.libvirt.org
 - change link to javadoc to the documentation generated via gitlab job
   in the libvirt-java project

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agodocs: Fix searching in the wiki
Peter Krempa [Mon, 13 Mar 2023 12:10:17 +0000 (13:10 +0100)] 
docs: Fix searching in the wiki

Conversion of the wiki to static pages means that the integrated search
no longer functions. Use the same approach we have for other search to
simply defer to google.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agorpc: genprotocol: Always apply fixups to rpcgen's output
Peter Krempa [Wed, 8 Mar 2023 08:51:05 +0000 (09:51 +0100)] 
rpc: genprotocol: Always apply fixups to rpcgen's output

The platform check which determines when to apply the fixups mentions
all officially supported build targets (per docs/platforms.rst) thus
it's not really necessary.

Additionally while not explicitly written as supported the check does
not work properly when building with the MinGW toolchain on Windows as
it does not apply the needed transformations. They are necessary
there the same way as with MinGW on Linux.

https://gitlab.com/libvirt/libvirt/-/issues/453

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoUse G_N_ELEMENTS() more
Michal Privoznik [Mon, 13 Mar 2023 09:43:50 +0000 (10:43 +0100)] 
Use G_N_ELEMENTS() more

In a few places we still use the good old:

  sizeof(var) / sizeof(var[0])
  sizeof(var) / sizeof(int)

The G_N_ELEMENTS() macro is preferred though. In a few places we
don't link with glib, so provide the macro definition.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoremote: fix typo in error message string
Daniel P. Berrangé [Mon, 13 Mar 2023 12:21:32 +0000 (12:21 +0000)] 
remote: fix typo in error message string

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoqemu: set SELinux label of passt process to its own binary's label
Laine Stump [Wed, 1 Mar 2023 20:58:24 +0000 (15:58 -0500)] 
qemu: set SELinux label of passt process to its own binary's label

set useBinarySpecificLabel = true when calling qemuSecurityCommandRun
for the passt process, so that the new process context will include
the binary-specific label that should be used for passt (passt_t)
rather than svirt_t (as would happen if useBinarySpecificLabel was
false). (The MCS part of the label, which is common to all child
processes related to a particular qemu domain instance, is also set).

Resolves: https://bugzilla.redhat.com/2172267
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agosecurity: make it possible to set SELinux label of child process from its binary
Laine Stump [Wed, 1 Mar 2023 20:34:32 +0000 (15:34 -0500)] 
security: make it possible to set SELinux label of child process from its binary

Normally when a child process is started by libvirt, the SELinux label
of that process is set to virtd_t (plus an MCS range). In at least one
case (passt) we need for the SELinux label of a child process label to
match the label that the binary would have transitioned to
automatically if it had been run standalone (in the case of passt,
that label is passt_t).

This patch modifies virSecuritySELinuxSetChildProcessLabel() (and all
the functions above it in the call chain) so that the toplevel
function can set a new argument "useBinarySpecificLabel" to true. If
it is true, then virSecuritySELinuxSetChildProcessLabel() will call
the new function virSecuritySELinuxContextSetFromFile(), which uses
the selinux library function security_compute_create() to determine
what would be the label of the new process if it had been run
standalone (rather than being run by libvirt) - the MCS range from the
normally-used label is added to this newly derived label, and that is
what is used for the new process rather than whatever is in the
domain's security label (which will usually be virtd_t).

In order to easily verify that nothing was broken by these changes to
the call chain, all callers currently set useBinarySpecificPath =
false, so all behavior should be completely unchanged. (The next
patch will set it to true only for the case of running passt.)

https://bugzilla.redhat.com/2172267
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agosecurity: make args to virSecuritySELinuxContextAddRange() const
Laine Stump [Wed, 8 Mar 2023 17:50:38 +0000 (12:50 -0500)] 
security: make args to virSecuritySELinuxContextAddRange() const

Neither of these are modified anywhere in the function, and the
function will soon be called with an arg that actually is a const.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoutil: add an API to retrieve the resolved path to a virCommand's binary
Laine Stump [Wed, 1 Mar 2023 16:34:24 +0000 (11:34 -0500)] 
util: add an API to retrieve the resolved path to a virCommand's binary

The binary to be exec'ed by virExec() is stored in
virCommand::args[0], and is resolved to a full absolute path (stored
in a local of virExec() just prior to execve().

Since we will have another use for the full absolute path, lets make
an API to resolve/retrieve the absolute path, and cache it in
virCommand::binaryPath so we only have to do the resolution once.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agolibxl: Add support for custom firmware path in config converter
Jim Fehlig [Mon, 13 Feb 2023 21:30:31 +0000 (14:30 -0700)] 
libxl: Add support for custom firmware path in config converter

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agolibxl: Support specifying a custom firmware path
Jim Fehlig [Fri, 10 Feb 2023 21:22:19 +0000 (14:22 -0700)] 
libxl: Support specifying a custom firmware path

libxl added support for specifying custom firmware paths long ago. The
functionality exists in all Xen version supported by libvirt. This patch
adds support for user-specified efi firmware paths in the libxl driver.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoapparmor: Enable passt support
Andrea Bolognani [Tue, 7 Mar 2023 18:20:09 +0000 (19:20 +0100)] 
apparmor: Enable passt support

passt provides an AppArmor abstraction that covers all the
inner details of its operation, so we can simply import that
and add the libvirt-specific parts on top: namely, passt
needs to be able to create a socket and pid file, while
the libvirt daemon needs to be able to kill passt.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoTranslated using Weblate (Russian)
Ján Tomko [Wed, 8 Mar 2023 19:06:16 +0000 (20:06 +0100)] 
Translated using Weblate (Russian)

Currently translated at 89.6% (9338 of 10416 strings)

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

Co-authored-by: Jan Tomko <jtomko@redhat.com>
Signed-off-by: Jan Tomko <jtomko@redhat.com>
2 years agoTranslated using Weblate (Chinese (Simplified) (zh_CN))
Ludek Janda [Wed, 8 Mar 2023 19:06:16 +0000 (20:06 +0100)] 
Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 99.5% (10373 of 10416 strings)

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

Translated using Weblate (Japanese)

Currently translated at 99.5% (10369 of 10416 strings)

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

Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 99.5% (10373 of 10416 strings)

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

Co-authored-by: Ludek Janda <ljanda@redhat.com>
Signed-off-by: Ludek Janda <ljanda@redhat.com>
2 years agoqemu: implement QEMU NBD source reconnect delay attribute
Christian Nautze [Mon, 27 Feb 2023 11:15:33 +0000 (12:15 +0100)] 
qemu: implement QEMU NBD source reconnect delay attribute

Currently it's only possible to set this parameter during domain
creation via QEMU commandline passthrough feature.
With the new delay attribute it's also possible to set this
parameter if you want to attach a new NBD disk
using "virsh attach-device domain device.xml" e.g.:

  <disk type='network' device='disk'>
    <driver name='qemu' type='raw'/>
    <source protocol='nbd' name='foo'>
      <host name='example.org' port='6000'/>
      <reconnect delay='10'/>
    </source>
    <target dev='vdb' bus='virtio'/>
  </disk>

Signed-off-by: Christian Nautze <christian.nautze@exoscale.ch>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemuAppendLoadparmMachineParm: add loadparm from hostdev
Eric Farman [Fri, 10 Mar 2023 02:38:09 +0000 (03:38 +0100)] 
qemuAppendLoadparmMachineParm: add loadparm from hostdev

Commit 54fa1b44afc ("conf: Add loadparm boot option for a boot device")
added the ability to specify a loadparm parameter on a <boot/> tag, while
commit 29ba41c2d40 ("qemu: Add loadparm to qemu command line string")
added that value to the QEMU "-machine" command line parameters.

Unfortunately, the latter commit only looked at disks and network
devices for boot information, even though anything with
VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT could potentially have this tag.
In practice, a <hostdev> tag pointing to a passthrough (SCSI or DASD)
disk device can be used in this way, which means the loadparm is
accepted, but not given to QEMU.

Correct this, and add some XML/argv tests.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: tpm: Pass --logfile to swtpm_setup for incoming migration
Eiichi Tsukata [Fri, 10 Mar 2023 04:59:18 +0000 (04:59 +0000)] 
qemu: tpm: Pass --logfile to swtpm_setup for incoming migration

Good to have for debugging in case something wrong happens during
incoming migration.

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodomainsnapshot: add snapshotDeleteInProgress to RNG schema
Pavel Hrdina [Wed, 8 Mar 2023 12:02:37 +0000 (13:02 +0100)] 
domainsnapshot: add snapshotDeleteInProgress to RNG schema

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

Fixes: 565bcb5d79dddaf1d0d14cffe1f3ae78d76b10a0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu_snapshot: fix external snapshot deletion for non-active snapshots
Pavel Hrdina [Thu, 2 Mar 2023 22:48:08 +0000 (23:48 +0100)] 
qemu_snapshot: fix external snapshot deletion for non-active snapshots

For shutoff VMs we don't have the storage source backing chain
populated so it will fail this check and error out. Move it to
part that is done only when VM is running.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu_snapshot: properly ignore disks with manual snapshot
Pavel Hrdina [Wed, 1 Mar 2023 11:51:21 +0000 (12:51 +0100)] 
qemu_snapshot: properly ignore disks with manual snapshot

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoFix some typos
Tim Wiederhake [Thu, 9 Mar 2023 13:09:16 +0000 (14:09 +0100)] 
Fix some typos

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
2 years agotest: regenerate virtio-blob expected outputs
Jonathon Jongsma [Wed, 8 Mar 2023 23:04:29 +0000 (17:04 -0600)] 
test: regenerate virtio-blob expected outputs

Somehow the tests didn't get regenerated after rebasing, which broke the
build.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agoqemu: Implement 'blob' support for virtio gpu
Jonathon Jongsma [Wed, 23 Feb 2022 21:06:55 +0000 (15:06 -0600)] 
qemu: Implement 'blob' support for virtio gpu

This can improve performance for some guests since it reduces copying of
display data between host and guest. Requires udmabuf on the host.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Add capability for virtio-gpu.blob
Jonathon Jongsma [Fri, 11 Feb 2022 22:56:41 +0000 (16:56 -0600)] 
qemu: Add capability for virtio-gpu.blob

Capability to determine whether this qemu supports the 'blob' option for
virtio-gpu.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: add support for 'blob' in virtio video device
Jonathon Jongsma [Wed, 9 Feb 2022 21:13:09 +0000 (15:13 -0600)] 
conf: add support for 'blob' in virtio video device

Add the ability to enable blob resources for the virtio video device.
This will accelerate the display path due to less or no copying of pixel
data.

Blob resource support can be enabled with e.g.:

    <video>
      <model type='virtio' blob='on'/>
    </video>

Some additional background information about blob resources:
https://lists.freedesktop.org/archives/dri-devel/2020-August/275972.html
https://www.kraxel.org/blog/2021/05/virtio-gpu-qemu-graphics-update/

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

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: use enum variable for video type
Jonathon Jongsma [Thu, 10 Feb 2022 16:51:00 +0000 (10:51 -0600)] 
conf: use enum variable for video type

Rather than storing the video type as an integer, use the proper enum
type within the struct.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: switch to virXMLProp* functions for parsing video
Jonathon Jongsma [Tue, 8 Feb 2022 22:42:05 +0000 (16:42 -0600)] 
conf: switch to virXMLProp* functions for parsing video

In virDomainVideoModelDefParseXML(), use the virXMLProp* functions
rather than reimplementing them with virXPath* functions.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: add virXMLPropUIntDefault() function
Jonathon Jongsma [Tue, 8 Nov 2022 20:12:32 +0000 (14:12 -0600)] 
util: add virXMLPropUIntDefault() function

This function allows you to specify a default value to return if the
property is not found rather than always setting *result to 0.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: Refactor video model parsing
Jonathon Jongsma [Tue, 8 Feb 2022 19:19:58 +0000 (13:19 -0600)] 
conf: Refactor video model parsing

Factor out a separate function to parse out the <model> element for
video devices.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: explicitly set VIR_DOMAIN_VIDEO_TYPE_DEFAULT to 0
Jonathon Jongsma [Mon, 7 Nov 2022 15:34:55 +0000 (09:34 -0600)] 
conf: explicitly set VIR_DOMAIN_VIDEO_TYPE_DEFAULT to 0

Ensure that new virDomainVideoDef objects have their 'type' set to
VIR_DOMAIN_VIDEO_TYPE_DEFAULT and remove places that this value is set
after construction. Since virDomainVideoDefNew() uses g_new0() allocate
the instance, all fields are initialized to 0.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: do not report errors in virPidFileForceCleanupPathFull
Ján Tomko [Tue, 7 Mar 2023 14:50:18 +0000 (15:50 +0100)] 
util: do not report errors in virPidFileForceCleanupPathFull

Use the quiet version of virPidFileAcquirePath and remove the error
reset, since there's nothing to reset anymore.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoutil: add quiet parameter to virPidFileAcquirePathFull
Ján Tomko [Tue, 7 Mar 2023 14:43:40 +0000 (15:43 +0100)] 
util: add quiet parameter to virPidFileAcquirePathFull

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoutil: virPidFileAcquirePath: remove waitForLock argument
Ján Tomko [Tue, 7 Mar 2023 13:49:33 +0000 (14:49 +0100)] 
util: virPidFileAcquirePath: remove waitForLock argument

None of the callers need it anymore.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoleaseshelper: use virPidFileAcquirePathFull
Ján Tomko [Tue, 7 Mar 2023 13:40:47 +0000 (14:40 +0100)] 
leaseshelper: use virPidFileAcquirePathFull

The only caller that actually wants to wait for the lock.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoutil: introduce virPidFileAcquirePathFull
Ján Tomko [Tue, 7 Mar 2023 13:38:20 +0000 (14:38 +0100)] 
util: introduce virPidFileAcquirePathFull

For now, add the 'Full' suffix to virPidFileAcquirePath and make
virPidFileAcquirePath a 'wrapper' around it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoutil: remove waitForLock from virPidFileAcquire
Ján Tomko [Tue, 7 Mar 2023 15:07:20 +0000 (16:07 +0100)] 
util: remove waitForLock from virPidFileAcquire

The parameter was added for consistency with virPidFileAcquirePath.
However, all callers of virPidFileAcquire pass false.

Remove the argument.

Partially-reverts: 2250a2b5d21c3b3529727f38a99cba22f84024f7
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovirSCSIHostFindByPCI: Fix link detection
Michal Privoznik [Wed, 8 Mar 2023 07:42:19 +0000 (08:42 +0100)] 
virSCSIHostFindByPCI: Fix link detection

Inside of virSCSIHostFindByPCI() there's a loop which iterates of
entries of "/sys/class/scsi_host" directory trying to identify
all symlinks (which then point to a SCSI device, but that's not
important right now). But the way virFileIsLink() is called can
never return a truthful reply - because it's called over
dent->d_name instead of full path. Fix this by moving the
virFileIsLink() call and passing constructed path into it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirscsihost: Drop needless labels
Michal Privoznik [Wed, 8 Mar 2023 07:57:35 +0000 (08:57 +0100)] 
virscsihost: Drop needless labels

After previous cleanups, we're left with a couple of needless
labels, that contain nothing but a return statement. Drop those.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirSCSIHostFindByPCI: Decrease scope of some variables
Michal Privoznik [Wed, 8 Mar 2023 07:52:32 +0000 (08:52 +0100)] 
virSCSIHostFindByPCI: Decrease scope of some variables

Inside of virSCSIHostFindByPCI() there're some variables that are
used from a while() loop exclusively. Bring their declaration
into the loop.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirscsihost: use g_autofree more
Michal Privoznik [Wed, 8 Mar 2023 07:48:36 +0000 (08:48 +0100)] 
virscsihost: use g_autofree more

Remove some obvious uses of VIR_FREE() in favor of automatic
cleanup. This also means, that some variables affected are
brought into the inner most block, so that automatic cleanup is
effective.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoremote: add mutex when freeing private callbacks
Mike Pontillo [Tue, 7 Mar 2023 17:57:56 +0000 (17:57 +0000)] 
remote: add mutex when freeing private callbacks

This commit resolves illegal memory accesses observed via:

  remoteClientFreePrivateCallbacks()
  remoteClientCloseFunc()
  virNetServerClientCloseLocked()
  virNetServerProcessClients()
  daemonServerProcessClients()
  virHashForEach()
  virNetDaemonRun()
  main()

Signed-off-by: Mike Pontillo <mpontillo@digitalocean.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: capabilities: Remove unused virQEMUCapsInitQMPBasicArch
Peter Krempa [Mon, 6 Mar 2023 20:27:33 +0000 (21:27 +0100)] 
qemu: capabilities: Remove unused virQEMUCapsInitQMPBasicArch

The function doesn't set any capability and we don't want to add
arch-dependent always-peresent capabilities in the future.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire QEMU_CAPS_LOADPARM
Peter Krempa [Mon, 6 Mar 2023 20:25:15 +0000 (21:25 +0100)] 
qemu: capabilities: Retire QEMU_CAPS_LOADPARM

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuAppendLoadparmMachineParm: Format 'loadparm' based on architecture
Peter Krempa [Mon, 6 Mar 2023 20:22:42 +0000 (21:22 +0100)] 
qemuAppendLoadparmMachineParm: Format 'loadparm' based on architecture

Check the architecture of the guest rather than relying on
QEMU_CAPS_LOADPARM which is set based on architecture.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire QEMU_CAPS_AES_KEY_WRAP and QEMU_CAPS_DEA_KEY_WRAP
Peter Krempa [Mon, 6 Mar 2023 20:19:51 +0000 (21:19 +0100)] 
qemu: capabilities: Retire QEMU_CAPS_AES_KEY_WRAP and QEMU_CAPS_DEA_KEY_WRAP

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuAppendKeyWrapMachineParms: Format "keywrap" arguments based on architecture
Peter Krempa [Mon, 6 Mar 2023 19:55:25 +0000 (20:55 +0100)] 
qemuAppendKeyWrapMachineParms: Format "keywrap" arguments based on architecture

Use the guest architecture to decide whether to format
'aes-key-wrap'/'dea-key-wrap' rather than
QEMU_CAPS_AES_KEY_WRAP/QEMU_CAPS_DEA_KEY_WRAP which were set based on
architecture.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Remove always asserted s390 capabilities
Peter Krempa [Mon, 6 Mar 2023 15:29:06 +0000 (16:29 +0100)] 
qemuxml2argvtest: Remove always asserted s390 capabilities

QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP and QEMU_CAPS_LOADPARM
are always asserted via virQEMUCapsInitQMPBasicArch thus don't need to
be explicitly enabled by tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire QEMU_CAPS_MACH_VIRT_GIC_VERSION
Peter Krempa [Mon, 6 Mar 2023 15:25:53 +0000 (16:25 +0100)] 
qemu: capabilities: Retire QEMU_CAPS_MACH_VIRT_GIC_VERSION

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