]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
4 years agoReplace virFileAbsPath() with g_canonicalize_filename()
Luke Yue [Mon, 7 Jun 2021 06:10:47 +0000 (14:10 +0800)] 
Replace virFileAbsPath() with g_canonicalize_filename()

Signed-off-by: Luke Yue <lukedyue@gmail.com>
4 years agodocs: add a link to Gitlab on the contributing page
Simon Chopin [Mon, 14 Jun 2021 08:23:50 +0000 (10:23 +0200)] 
docs: add a link to Gitlab on the contributing page

I expect to find a link to the repositories when clicking on
"Contribute", this patch fixes this. The wording is directly inspired by
the one on the hacking page.

Signed-off-by: Simon Chopin <chopin.simon@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: add launch-security-sev test with latest capabilities
Pavel Hrdina [Thu, 10 Jun 2021 13:58:15 +0000 (15:58 +0200)] 
tests: add launch-security-sev test with latest capabilities

QEMU 6.0.0 introduced `confidential-guest-support` -machine option as
a replacement for `memory-encryption`. In order to test it use 6.0.0
capabilities as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agotests: use newer machine in qemuxml2argv launch-security-sev
Pavel Hrdina [Thu, 10 Jun 2021 13:55:52 +0000 (15:55 +0200)] 
tests: use newer machine in qemuxml2argv launch-security-sev

The pc-1.0 machine type was deprecated in QEMU 6.0.0. In our tests we
use 2.12.0 and 6.0.0 replies so switch to pc type.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agotests: add AMD SEV bits into qemu-6.0.0 replies
Pavel Hrdina [Thu, 10 Jun 2021 13:54:59 +0000 (15:54 +0200)] 
tests: add AMD SEV bits into qemu-6.0.0 replies

Currently we only have AMD SEV bits in qemu-2.12.0 replies which is way
too old to test new features that require AMD SEV as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu_command: use confidential-guest-support if available
Pavel Hrdina [Thu, 10 Jun 2021 13:24:19 +0000 (15:24 +0200)] 
qemu_command: use confidential-guest-support if available

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu_capabilities: detect if confidential-guest-support is available
Pavel Hrdina [Mon, 14 Jun 2021 12:38:58 +0000 (14:38 +0200)] 
qemu_capabilities: detect if confidential-guest-support is available

virQEMUCapsProbeQMPMachineProps currently skips any not supported
machine type which includes `none` as well.

In order to start probing that machine type we need to add an exception
to not skip it when probing QEMU capabilities.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu_capabilities: introduce confidential-guest-support capability
Pavel Hrdina [Mon, 14 Jun 2021 12:36:08 +0000 (14:36 +0200)] 
qemu_capabilities: introduce confidential-guest-support capability

In libvirt we already use `query-command-line-options` QMP command but
that is useless as it doesn't provide correct data for `-machine`
option. So we need a new and better way to get that data.

We already use `qom-list-properties` to get options for specific machine
types so we can reuse it to get options for special `none` machine type
as a generic arch independent machine type.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovircaps2xmltest: Introduce HMAT test case
Michal Privoznik [Fri, 14 May 2021 15:02:25 +0000 (17:02 +0200)] 
vircaps2xmltest: Introduce HMAT test case

This test was generated on a guest with the following NUMA
configuration:

    <numa>
      <cell id='0' cpus='0-23' memory='4194304' unit='KiB' discard='yes'>
        <cache level='1' associativity='direct' policy='writeback'>
          <size value='10' unit='KiB'/>
          <line value='8' unit='B'/>
        </cache>
        <cache level='2' associativity='full' policy='writethrough'>
          <size value='128' unit='KiB'/>
          <line value='16' unit='B'/>
        </cache>
      </cell>
      <cell id='1' memory='2097152' unit='KiB'>
        <cache level='1' associativity='direct' policy='writeback'>
          <size value='10' unit='KiB'/>
          <line value='8' unit='B'/>
        </cache>
      </cell>
      <interconnects>
        <latency initiator='0' target='0' type='access' value='5'/>
        <latency initiator='0' target='0' type='read' value='6'/>
        <latency initiator='0' target='0' type='write' value='7'/>
        <latency initiator='0' target='1' type='access' value='10'/>
        <latency initiator='0' target='1' type='read' value='11'/>
        <latency initiator='0' target='1' type='write' value='12'/>
        <bandwidth initiator='0' target='0' type='access' value='204800' unit='KiB'/>
        <bandwidth initiator='0' target='0' type='read' value='205824' unit='KiB'/>
        <bandwidth initiator='0' target='0' type='write' value='206848' unit='KiB'/>
        <bandwidth initiator='0' target='0' cache='1' type='access' value='208896' unit='KiB'/>
        <bandwidth initiator='0' target='0' cache='1' type='read' value='209920' unit='KiB'/>
        <bandwidth initiator='0' target='0' cache='1' type='write' value='210944' unit='KiB'/>
        <bandwidth initiator='0' target='1' type='access' value='102400' unit='KiB'/>
        <bandwidth initiator='0' target='1' type='read' value='103424' unit='KiB'/>
        <bandwidth initiator='0' target='1' type='write' value='104448' unit='KiB'/>
        <bandwidth initiator='0' target='1' cache='1' type='access' value='105472' unit='KiB'/>
        <bandwidth initiator='0' target='1' cache='1' type='read' value='106496' unit='KiB'/>
        <bandwidth initiator='0' target='1' cache='1' type='write' value='107520' unit='KiB'/>
      </interconnects>
    </numa>

The sysfs content was also copied over from the VM but only those
files which are accessed in the test are stored in the repo.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agocapabilities: Expose NUMA interconnects
Michal Privoznik [Mon, 17 May 2021 11:36:34 +0000 (13:36 +0200)] 
capabilities: Expose NUMA interconnects

Links between NUMA nodes can have different latencies and
bandwidths. This info is newly defined in ACPI 6.2 under
Heterogeneous Memory Attribute Table (HMAT) table. Linux kernel
learned how to report these values under sysfs and thus we can
expose them in our capabilities XML. The sysfs interface is
documented in kernel's Documentation/admin-guide/mm/numaperf.rst.

Long story short, two nodes can be in initiator-target
relationship. A node can be initiator if it has a CPU or a device
that's capable of initiating memory transfer. Therefore a node
that has just memory can only be target. An initiator-target link
can then have any combination of {bandwidth, latency} - {access,
read, write} attribute (6 in total). However, the standard says
access is applicable iff read and write values are the same.
Therefore, we really have just four combinations of attributes:
bandwidth-read, bandwidth-write, latency-read, latency-write.

This is the combination that kernel reports anyway.

Then, under /sys/system/devices/node/nodeX/acccessN/initiators we
find values for those 4 attributes and also symlinks named
"nodeN" which then represent initiators to nodeX. For instance:

  /sys/system/node/node1/access1/initiators/node0 -> ../../node0
  /sys/system/node/node1/access1/initiators/read_bandwidth
  /sys/system/node/node1/access1/initiators/read_latency
  /sys/system/node/node1/access1/initiators/write_bandwidth
  /sys/system/node/node1/access1/initiators/write_latency

This means that node0 is initiator and node1 is target and values
of the interconnect can be read.

In theory, there can be separate links to memory side caches too
(e.g. one link from node X to node Y's main memory, another from
node X to node Y's L1 cache, another one to L2 cache and so on).
But sysfs does not express this relationship just yet.

The "accessN" means either "access0" or "access1". The difference
is that while the former expresses the best interconnect between
two nodes including CPUS and I/O devices (such as GPUs and NICs),
the latter includes only CPUs and thus is what we need.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1786309
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agonuma_conf: Expose virNumaInterconnect formatter
Michal Privoznik [Mon, 3 May 2021 12:45:27 +0000 (14:45 +0200)] 
numa_conf: Expose virNumaInterconnect formatter

Expose virNumaInterconnect XML formatter so that it can be
re-used by other parts of the code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agonuma_conf: Rename virDomainNumaInterconnect* to virNumaInterconnect*
Michal Privoznik [Mon, 17 May 2021 15:14:16 +0000 (17:14 +0200)] 
numa_conf: Rename virDomainNumaInterconnect* to virNumaInterconnect*

There's nothing domain specific about NUMA interconnects. Rename
the virDomainNumaInterconnect* structures and enums to
virNumaInterconnect*.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agocapabilities: Expose NUMA memory side cache
Michal Privoznik [Thu, 29 Apr 2021 16:58:43 +0000 (18:58 +0200)] 
capabilities: Expose NUMA memory side cache

Memory on a NUMA node can have a side caches. Configuring these
for a domain was implemented in v6.6.0-rc1~249 and friends.
However, up until now mgmt applications did not really know what
values to pass because we were not exposing caches of the host.
With recent enough kernel these are exposed under sysfs and with
a bit of parsing we can extend our capabilities XML. The sysfs
structure is documented in kernel's
Documentation/admin-guide/mm/numaperf.rst and basically maps in
1:1 fashion to our virNumaCache structure.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agonuma_conf: Expose virNumaCache formatter
Michal Privoznik [Mon, 3 May 2021 12:11:26 +0000 (14:11 +0200)] 
numa_conf: Expose virNumaCache formatter

Expose virNumaCache XML formatter so that it can be re-used by
other parts of the code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agonuma_conf: Rename virDomainCache* to virNumaCache*
Michal Privoznik [Thu, 20 May 2021 15:00:50 +0000 (17:00 +0200)] 
numa_conf: Rename virDomainCache* to virNumaCache*

There's nothing domain specific about NUMA memory caches. Rename the
virDomainCache* structures and enums to virNumaCache*.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agocapabilities: Separate <cpu/> formatting into a function
Michal Privoznik [Wed, 26 May 2021 13:39:38 +0000 (15:39 +0200)] 
capabilities: Separate <cpu/> formatting into a function

The way we format <cpu/> element for capabilities is not ideal,
because if there are no CPUs, i.e. no child elements, we still
output opening and closing element. To solve this,
virXMLFormatElement() could be used but that would introduce more
variables into the loop. Therefore, move the formatter into a
separate function and use virXMLFormatElement().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agoschemas: Allow zero <cpu/> for capabilities
Michal Privoznik [Wed, 26 May 2021 14:23:29 +0000 (16:23 +0200)] 
schemas: Allow zero <cpu/> for capabilities

It may happen that a NUMA node has no CPUs associated with it. We
allow this for domains since v6.6.0-rc1~250. Let's update our
capabilities schema to match that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agotests: glib-ify vircaps2xmltest
Michal Privoznik [Fri, 28 May 2021 13:59:35 +0000 (15:59 +0200)] 
tests: glib-ify vircaps2xmltest

Ideally, turning pointers into g_auto* would be done in one step
and dropping cleanup label and unused @ret variable in second
step, but since this is a test we don't care that much, do we?

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agovirsh-pool: Add virshPoolTypeCompleter in macro VIRSH_COMMON_OPT_POOL_X_AS
Lin Ma [Tue, 15 Jun 2021 00:38:27 +0000 (08:38 +0800)] 
virsh-pool: Add virshPoolTypeCompleter in macro VIRSH_COMMON_OPT_POOL_X_AS

Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh: Add format completion to blockcopy command
Lin Ma [Tue, 15 Jun 2021 00:38:26 +0000 (08:38 +0800)] 
virsh: Add format completion to blockcopy command

Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh: Add target completion to dompmsuspend command
Lin Ma [Tue, 15 Jun 2021 00:38:25 +0000 (08:38 +0800)] 
virsh: Add target completion to dompmsuspend command

Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh: Use VIR_ENUM_* for --target argument in cmdDomPMSuspend
Lin Ma [Tue, 15 Jun 2021 00:38:24 +0000 (08:38 +0800)] 
virsh: Use VIR_ENUM_* for --target argument in cmdDomPMSuspend

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh: Add target completion to nodesuspend command
Lin Ma [Tue, 15 Jun 2021 00:38:23 +0000 (08:38 +0800)] 
virsh: Add target completion to nodesuspend command

Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh: Use VIR_ENUM_* for --target argument in cmdNodeSuspend
Lin Ma [Tue, 15 Jun 2021 00:38:22 +0000 (08:38 +0800)] 
virsh: Use VIR_ENUM_* for --target argument in cmdNodeSuspend

Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh: Add comp-methods completion to migrate command
Lin Ma [Tue, 15 Jun 2021 00:38:21 +0000 (08:38 +0800)] 
virsh: Add comp-methods completion to migrate command

Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu_firmware: select correct firmware for AMD SEV-ES
Pavel Hrdina [Tue, 25 May 2021 07:56:38 +0000 (09:56 +0200)] 
qemu_firmware: select correct firmware for AMD SEV-ES

When using firmware auto-selection and user enables AMD SEV-ES we need
to pick correct firmware that actually supports it. This can be detected
by having `amd-sev-es` in the firmware JSON description.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agosrc: Use 1U for bit shifting
Michal Privoznik [Mon, 14 Jun 2021 10:46:58 +0000 (12:46 +0200)] 
src: Use 1U for bit shifting

In a few places we take 1 and shift it left repeatedly. So much
that it won't longer fit into signed integer. The problem is that
this is undefined behaviour. Switching to 1U makes us stay within
boundaries.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
4 years agoDon't call qsort() over NULL
Michal Privoznik [Mon, 14 Jun 2021 10:46:02 +0000 (12:46 +0200)] 
Don't call qsort() over NULL

In a few places it may happen that the array we want to sort is
still NULL (e.g. because there were no leases found, no paths for
secdriver to lock or no cache banks). However, passing NULL to
qsort() is undefined and even though glibc plays nicely we
shouldn't rely on undefined behaviour.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
4 years agoci: Enable address and undefined behavior sanitizers
Tim Wiederhake [Thu, 6 May 2021 15:08:38 +0000 (17:08 +0200)] 
ci: Enable address and undefined behavior sanitizers

meson supports the following sanitizers: "address" (e.g. out-of-bounds
memory access, use-after-free, etc.), "thread" (data races), "undefined"
(e.g. signed integer overflow), and "memory" (use of uninitialized
memory). Note that not all sanitizers are supported by all compilers,
and that more sanitizers exist.

Not all sanitizers can be enabled at the same time, but "address" and
"undefined" can. Both thread and memory sanitizers require an instrumented
build of all dependencies, including libc.

gcc and clang use different implementations of these sanitizers and
have proven to find different issues. Create CI jobs for both.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirt-aa-helper: Remove duplicate linking with src/datatypes.o
Tim Wiederhake [Thu, 6 May 2021 15:08:37 +0000 (17:08 +0200)] 
virt-aa-helper: Remove duplicate linking with src/datatypes.o

"virt-aa-helper" links, amongst others, against "datatypes.o" and
"libvirt.so". The latter links against "libvirt_driver.a" which in turn
also links against "datatypes.o", leading to a One-Definition-Rule
violoation for "virConnectClass" et al. in "datatypes.c".

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: openvzutilstest: Remove duplicate linking with libvirt_openvz.a
Tim Wiederhake [Thu, 6 May 2021 15:08:36 +0000 (17:08 +0200)] 
tests: openvzutilstest: Remove duplicate linking with libvirt_openvz.a

"openvzutilstest" links, amongst others, against "libvirt_openvz.a" and
"libvirt.so". The latter also links against "libvirt_openvz.a", leading
to a One-Definition-Rule violation for "openvzLocateConfFile" in
"openvz_conf.c".

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoopenvz: Add missing symbols to libvirt_openvz.syms
Tim Wiederhake [Thu, 6 May 2021 15:08:35 +0000 (17:08 +0200)] 
openvz: Add missing symbols to libvirt_openvz.syms

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: virfilemock: realpath: Allow non-null second parameter
Tim Wiederhake [Thu, 6 May 2021 15:08:34 +0000 (17:08 +0200)] 
tests: virfilemock: realpath: Allow non-null second parameter

When other preloaded libraries wrap and / or make calls to `realpath`
(e.g. LLVM's AddessSanitizer), the second parameter is no longer
guaranteed to be NULL.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agomeson: Allow undefined symbols when sanitizers are enabled
Tim Wiederhake [Thu, 6 May 2021 15:08:33 +0000 (17:08 +0200)] 
meson: Allow undefined symbols when sanitizers are enabled

When enabling sanitizers, clang adds some function symbols when
instrumenting the code. The exact names of those functions are an
implementation detail and should therefore not be added to any
syms file. This patch prevents build failures due to those symbols
not present in the syms file when building with sanitizers enabled.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agomeson: Allow larger stack frames when instrumenting
Tim Wiederhake [Thu, 6 May 2021 15:08:32 +0000 (17:08 +0200)] 
meson: Allow larger stack frames when instrumenting

When enabling sanitizers, gcc adds some instrumentation to the code
that may enlarge stack frames. Some function's stack frames are already
close to the limit of 4096 and are enlarged past that threshold,
e.g. virLXCProcessStart which reaches a frame size of 4624 bytes.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuBuildDeviceVideoStr: Don't overwrite @model
Michal Privoznik [Fri, 11 Jun 2021 12:49:06 +0000 (14:49 +0200)] 
qemuBuildDeviceVideoStr: Don't overwrite @model

Now we have everything prepared so that @model doesn't have to be
rewritten. The correct model can be chosen right from the
beginning.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemuBuildDeviceVideoStr: Move logic wrapping qemuBuildVirtioDevStr() into qemuDeviceV...
Michal Privoznik [Fri, 11 Jun 2021 13:13:24 +0000 (15:13 +0200)] 
qemuBuildDeviceVideoStr: Move logic wrapping qemuBuildVirtioDevStr() into qemuDeviceVideoGetModel()

We want to call qemuBuildVirtioDevStr() from
qemuBuildDeviceVideoStr() but only for some models (currently
"virtio-gpu" and "vhost-user-gpu"), not all of them. Move this
logic into qemuDeviceVideoGetModel() because this logic will be
refined.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu_command: Switch from VIR_ENUM_IMPL(qemuDeviceVideoSecondary) to explicit switch()
Michal Privoznik [Fri, 11 Jun 2021 12:42:22 +0000 (14:42 +0200)] 
qemu_command: Switch from VIR_ENUM_IMPL(qemuDeviceVideoSecondary) to explicit switch()

This may look like a step backwards, but it isn't. The point is
that in near future the chosen model will depend on more than
just video type.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu_command: Switch from VIR_ENUM_IMPL(qemuDeviceVideo) to explicit switch()
Michal Privoznik [Fri, 11 Jun 2021 12:35:56 +0000 (14:35 +0200)] 
qemu_command: Switch from VIR_ENUM_IMPL(qemuDeviceVideo) to explicit switch()

This may look like a step backwards, but it isn't. The point is
that in near future the chosen model will depend on more than
just video type.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemuDeviceVideoGetModel: Deduplicate a check
Michal Privoznik [Fri, 11 Jun 2021 11:31:56 +0000 (13:31 +0200)] 
qemuDeviceVideoGetModel: Deduplicate a check

There is the same check written twice (whether given video card
is primary one and whether it supports VGA mode). Write it just
once and store it in a boolean variable.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemuBuildDeviceVideoStr: Separate out video module selection
Michal Privoznik [Fri, 11 Jun 2021 11:22:34 +0000 (13:22 +0200)] 
qemuBuildDeviceVideoStr: Separate out video module selection

The code that decides video card model is going to be reworked
and expanded. Separate it out into a function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemuDomainSupportsVideoVga: Fix const correctness
Michal Privoznik [Fri, 11 Jun 2021 11:24:14 +0000 (13:24 +0200)] 
qemuDomainSupportsVideoVga: Fix const correctness

This function doesn't modify passed video definition. Make the
argument const.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agotests: Tests for virtio-vga-gl and virtio-gpu-gl-pci device
Han Han [Wed, 9 Jun 2021 08:32:27 +0000 (16:32 +0800)] 
tests: Tests for virtio-vga-gl and virtio-gpu-gl-pci device

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Adapt to virtio-vga-gl device
Han Han [Wed, 9 Jun 2021 08:32:26 +0000 (16:32 +0800)] 
qemu: Adapt to virtio-vga-gl device

QEMU 6.1 will replace the virgl property of virtio-vga device to
virtio-vga-gl device. Adapt to that update.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/167

Signed-off-by: Han Han <hhan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Adapt to virtio-gpu-gl-pci device
Han Han [Wed, 9 Jun 2021 08:32:25 +0000 (16:32 +0800)] 
qemu: Adapt to virtio-gpu-gl-pci device

QEMU 6.1 will add virtio-gpu-gl-pci device to replace the virgl property
of virtio-gpu-pci device. Adapt to that change.

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

Signed-off-by: Han Han <hhan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu_validate: Validate virtio*gl* devices for 3d accerlation
Han Han [Wed, 9 Jun 2021 08:32:24 +0000 (16:32 +0800)] 
qemu_validate: Validate virtio*gl* devices for 3d accerlation

The devices virtio-gpu-gl-pci and virtio-vga-gl, aimed to replace the
virgl property, are valid for 3d accerlation as well.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu_capabilities: Add QEMU_CAPS_VIRTIO_VGA_GL
Han Han [Wed, 9 Jun 2021 08:32:23 +0000 (16:32 +0800)] 
qemu_capabilities: Add QEMU_CAPS_VIRTIO_VGA_GL

It will be used for virtio-vga-gl device later.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu_capabilities: Add QEMU_CAPS_VIRTIO_GPU_GL_PCI
Han Han [Wed, 9 Jun 2021 08:32:22 +0000 (16:32 +0800)] 
qemu_capabilities: Add QEMU_CAPS_VIRTIO_GPU_GL_PCI

This flag will be used for the device virtio-gpu-gl-pci which is introduced
since QEMU 6.1.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu_map: Add cpu feature avx-vnni
Tim Wiederhake [Thu, 10 Jun 2021 07:45:41 +0000 (09:45 +0200)] 
cpu_map: Add cpu feature avx-vnni

"avx-vvni" was introduced to qemu in commit
c1826ea6a052084f2e6a0bae9dd5932a727df039, adding it Cooperlake.

This feature is currently not used by any libvirt CPU models, but its
addition silences a warning from sync_qemu_i386.py:

```
warning: Unknown feature 'CPUID_7_1_EAX_AVX_VNNI'
warning: Feature unknown to libvirt: CPUID_7_1_EAX_AVX_VNNI
```

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoopenvswitch: don't delete existing OVS port prior to recreating same port
Laine Stump [Mon, 7 Jun 2021 20:27:49 +0000 (16:27 -0400)] 
openvswitch: don't delete existing OVS port prior to recreating same port

Connecting a tap device to an Open vSwitch is done by adding a "port"
to the switch with the ovs-vsctl "add-port" command. The port will
have the same name as the tap device, but it is a separate entity, and
can survive beyond the destruction of the tap device (although under
normal circumstances the port will be deleted around the same time the
tap device is deleted).

This makes it possible for a port of a particular name to already
exist at the time libvirt calls ovs-vsctl to add that port. The
original commit of Open vSwitch support (commit df81004632, libvirt
0.9.10, Feb. 2012) used the "--may-exist" option to the add-port
command to indicate that a port of the desired name might already
exist, and that it was okay to simply re-use this port (rather than
failing with an error message).

Then in commit 33445ce8446d9 (libvirt 1.2.7, April 2014) the command
was changed to use "--if-exists del-port blah" instead of
"--may-exist". The reason given was that there was a bug in OVS where
a stale port would be unusable even though it still existed; the
workaround was to forcibly delete any existing port prior to adding
the new port (of the same name). This is the ovs-vsctl command still
in use by libvirt today.

It recently came up in the discussion of a bug concerning guest packet
loss during OpenStack upgrades (https://bugzilla.redhat.com/1963164)
that the bug in OVS that necessitated the del-port workaround was
fixed quite a long time ago (August 2015):

  https://github.com/openvswitch/ovs/commit/e21c6643a02c6b446d2fbdfde366ea303b4c2730

thus rendering the workaround in libvirt unnecessary. The assertion in
that discussion is that this workaround is now the cause of the packet
loss being experienced during OpenStack upgrades. I'm not convinced
this is the case, but it does appear that there is no reason to carry
this workaround in libvirt any longer, so this patch reverts the code
back to the original behavior (using "--may-exist" instead of
"--if-exists del-port").

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodomain_conf: Use virXMLFormatElement() more
Michal Privoznik [Thu, 3 Jun 2021 11:31:22 +0000 (13:31 +0200)] 
domain_conf: Use virXMLFormatElement() more

I've identified some places (mostly by looking for
virBufferUse()) that can use virXMLFormatElement() instead of
open coded version of it. I'm sure there are many more places
that could use the same treatment. Let's cure them some other
time.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agodocs: switch ci status page to use Go -module repos
Daniel P. Berrangé [Mon, 7 Jun 2021 13:49:14 +0000 (14:49 +0100)] 
docs: switch ci status page to use Go -module repos

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agocpu_map: sync_qemu_i386.py: Remove superfluous semicolon
Tim Wiederhake [Wed, 9 Jun 2021 11:04:29 +0000 (13:04 +0200)] 
cpu_map: sync_qemu_i386.py: Remove superfluous semicolon

The semicolon in question makes the pipeline fail over a style checker
complaint.

Introduced-in: 360b8eb2d2cb1b6a8c9a78fa2c5be31dd7c74487
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirt-host-validate: Fix IOMMU output on aarch64
Fabiano Fidêncio [Tue, 8 Jun 2021 20:16:42 +0000 (22:16 +0200)] 
virt-host-validate: Fix IOMMU output on aarch64

virt-host-validate should print "Checking for device assignment IOMMU
support" for all architectures, not only for Intel / AMD.

This is the output without the patch:
```
[fidencio@dentola libvirt]$ virt-host-validate
  QEMU: comprobando if device /dev/kvm exists                                   : PASA
  QEMU: comprobando if device /dev/kvm is accessible                            : PASA
  QEMU: comprobando if device /dev/vhost-net exists                             : PASA
  QEMU: comprobando if device /dev/net/tun exists                               : PASA
  QEMU: comprobando for cgroup 'cpu' controller support                         : PASA
  QEMU: comprobando for cgroup 'cpuacct' controller support                     : PASA
  QEMU: comprobando for cgroup 'cpuset' controller support                      : PASA
  QEMU: comprobando for cgroup 'memory' controller support                      : PASA
  QEMU: comprobando for cgroup 'devices' controller support                     : ADVERTENCIA (Enable 'devices' in kernel Kconfig file or mount/enable cgroup controller in your system)
  QEMU: comprobando for cgroup 'blkio' controller support                       : PASA
ADVERTENCIA (Unknown if this platform has IOMMU support)
  QEMU: comprobando for secure guest support                                    : ADVERTENCIA (Unknown if this platform has Secure Guest support)

```

This is the output with the patch:
```
[fidencio@dentola libvirt]$ ./build/tools/virt-host-validate
  QEMU: Checking if device /dev/kvm exists                                   : PASS
  QEMU: Checking if device /dev/kvm is accessible                            : PASS
  QEMU: Checking if device /dev/vhost-net exists                             : PASS
  QEMU: Checking if device /dev/net/tun exists                               : PASS
  QEMU: Checking for cgroup 'cpu' controller support                         : PASS
  QEMU: Checking for cgroup 'cpuacct' controller support                     : PASS
  QEMU: Checking for cgroup 'cpuset' controller support                      : PASS
  QEMU: Checking for cgroup 'memory' controller support                      : PASS
  QEMU: Checking for cgroup 'devices' controller support                     : WARN (Enable 'devices' in kernel Kconfig file or mount/enable cgroup controller in your system)
  QEMU: Checking for cgroup 'blkio' controller support                       : PASS
  QEMU: Checking for device assignment IOMMU support                         : WARN (Unknown if this platform has IOMMU support)
  QEMU: Checking for secure guest support                                    : WARN (Unknown if this platform has Secure Guest support)
```

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu_map: sync_qemu_i386.py: Allow begin mark to contain `const`
Tim Wiederhake [Mon, 7 Jun 2021 12:01:24 +0000 (14:01 +0200)] 
cpu_map: sync_qemu_i386.py: Allow begin mark to contain `const`

This was introduced in qemu commit
e11fd68996fb27c040552320f01a7d30a15a7cc1.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu_map: sync_qemu_i386.py: Use regex to look for begin mark
Tim Wiederhake [Mon, 7 Jun 2021 12:01:23 +0000 (14:01 +0200)] 
cpu_map: sync_qemu_i386.py: Use regex to look for begin mark

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirCHDriverConfig: Drop @uri member
Michal Privoznik [Mon, 7 Jun 2021 13:32:34 +0000 (15:32 +0200)] 
virCHDriverConfig: Drop @uri member

This member is unused (apart from only being set in
virCHDriverConfigNew()), and never freed really (leading to a
memleak).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoch: set driver to NULL after freeing it
Daniel P. Berrangé [Fri, 4 Jun 2021 14:59:50 +0000 (15:59 +0100)] 
ch: set driver to NULL after freeing it

If the chStateInitialize method fails, we call chStateCleanup
which free's all global state. It fails to set the global
'ch_driver' to NULL, however, so a later attempt to open the
cloud hypervisor driver will succeed and then crash attempting
to access freed memory.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirHostValidateSecureGuests: Drop useless 'return 0' at the end
Michal Privoznik [Tue, 8 Jun 2021 07:39:33 +0000 (09:39 +0200)] 
virHostValidateSecureGuests: Drop useless 'return 0' at the end

Previous patches rendered 'return 0' at the end of the function a
dead code. Therefore, the code can be rearranged a bit and the
line can be dropped.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Fabiano Fidêncio <fabiano@fidencio.org>
4 years agovirt-host-validate: Call VIR_HOST_VALIDATE_FAILURE() more frequently
Michal Privoznik [Tue, 8 Jun 2021 07:20:32 +0000 (09:20 +0200)] 
virt-host-validate: Call VIR_HOST_VALIDATE_FAILURE() more frequently

Ideally, every virHostMsgFail() would be coupled with
VIR_HOST_VALIDATE_FAILURE() so that the failure is correctly
propagated to the caller. However, in
virHostValidateSecureGuests() we are either ignoring @level and
returning 0 directly (no error), or not returning at all, relying
on 'return 0' at the end of the function. Neither of these help
propagate failure correctly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Fabiano Fidêncio <fabiano@fidencio.org>
4 years agovirt-host-validate: Turn failure to read /proc/cmdline into an error
Michal Privoznik [Tue, 8 Jun 2021 07:21:27 +0000 (09:21 +0200)] 
virt-host-validate: Turn failure to read /proc/cmdline into an error

When validating secure guests support on s390(x) we may read
/proc/cmdline and look for "prot_virt" argument. Reading the
kernel command line is done via virFileReadValueString() which
may fail. In such case caller won't see any error message. But we
can produce the same warning/error as if "prot_virt" argument
wasn't found.  Not only this lets users know about the problem,
it also terminates the "Checking for ...." line correctly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Fabiano Fidêncio <fabiano@fidencio.org>
4 years agovirt-host-validate: Report an error if failed to detect CGroups
Michal Privoznik [Tue, 8 Jun 2021 07:17:52 +0000 (09:17 +0200)] 
virt-host-validate: Report an error if failed to detect CGroups

As a part of its checks, virt-host-validate calls virCgroupNew()
to detect CGroup controllers which are then printed out. However,
virCgroupNew() can fail (with appropriate error message set).
Let's print an error onto stderr if that happens.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Fabiano Fidêncio <fabiano@fidencio.org>
4 years agovirt-host-validate: Initialize the error object
Michal Privoznik [Tue, 8 Jun 2021 06:53:14 +0000 (08:53 +0200)] 
virt-host-validate: Initialize the error object

Several libvirt functions are called from virt-host-validate.
Some of these functions do report an error on failure. But
reporting an error is coupled with freeing previous error (by
calling virResetError()). But we've never called
virErrorInitialize() and thus resetting error object frees some
random pointer.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Fabiano Fidêncio <fabiano@fidencio.org>
4 years agostorage: Don't overwrite error in virISCSIDirectDisconnect()
Michal Privoznik [Wed, 2 Jun 2021 08:34:46 +0000 (10:34 +0200)] 
storage: Don't overwrite error in virISCSIDirectDisconnect()

The iscsi-direct storage pool backend works merely like this: a
connection is established to the target (usually done via
virStorageBackendISCSIDirectSetConnection()), intended action is
executed (e.g. reporting LUNs, volume wiping), and at the end the
connection is closed via virISCSIDirectDisconnect().

The problem is that virISCSIDirectDisconnect() reports its own
errors which may overwrite error that occurred during LUN
reporting, or volume wiping or whatever.

To fix this, use virErrorPreserveLast() + virErrorRestore()
combo, which either preserves previously reported error message,
or is NOP if there's no error reported.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1797879
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agolibxl: Support firmware autoselection
Jim Fehlig [Thu, 3 Jun 2021 20:04:30 +0000 (14:04 -0600)] 
libxl: Support firmware autoselection

Xen only supports one firmware, making autoselection easy to implement.
In fact, <os firmware='efi'> is probably preferable in the Xen driver,
where libxl supports a firmware setting with accepted values such as
bios, ovmf, uefi (currently same semantics as ovmf), seabios, etc.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agolibxl: Forbid domain definition with secure boot enabled
Jim Fehlig [Wed, 2 Jun 2021 20:39:43 +0000 (14:39 -0600)] 
libxl: Forbid domain definition with secure boot enabled

Xen+ovmf does not support secure boot. Fail domain def validation
if secure boot is enabled.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agolibxl: Introduce domain def validate callback
Jim Fehlig [Wed, 2 Jun 2021 20:04:35 +0000 (14:04 -0600)] 
libxl: Introduce domain def validate callback

Introduce libxlDomainDefValidate and move the existing validation
check from libxlDomainDefPostParse. Additional validation will be
introduced in subsequent patches.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoapparmor: Permit new capabilities required by libvirtd
Jim Fehlig [Mon, 7 Jun 2021 22:21:28 +0000 (16:21 -0600)] 
apparmor: Permit new capabilities required by libvirtd

The audit log contains the following denials from libvirtd

apparmor="DENIED" operation="capable" profile="libvirtd" pid=6012 comm="daemon-init" capability=17  capname="sys_rawio"
apparmor="DENIED" operation="capable" profile="libvirtd" pid=6012 comm="rpc-worker" capability=39  capname="bpf"
apparmor="DENIED" operation="capable" profile="libvirtd" pid=6012 comm="rpc-worker" capability=38  capname="perfmon"

Squelch the denials and allow the capabilities in the libvirtd
apparmor profile.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agomeson.build: Compile with -Walloca
Thomas Huth [Thu, 27 May 2021 10:45:54 +0000 (12:45 +0200)] 
meson.build: Compile with -Walloca

We are already compiling libvirt with -Wvla - so it does not make
too much sense to still allow people to use alloca() instead. Thus
put it on the list of things we want to warn about. Fortunately,
there is currently no warning with this flag, so the current
sources should be clean.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agomeson.build: Remove the -Wvla-larger-then flag
Thomas Huth [Thu, 27 May 2021 10:37:36 +0000 (12:37 +0200)] 
meson.build: Remove the -Wvla-larger-then flag

The flag has a typo in it, it's "...-than=..." and not "...-then=...",
so this was in fact never used. Since we're also using -Wvla (without
size), we should already get warnings about any variable length arrays
anyway, so the additional "-Wvla-larger-than" does not make much sense
and thus we can simply drop this.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agotools: only fail validations if VIR_HOST_VALIDATE_FAIL is set
Fabiano Fidêncio [Mon, 7 Jun 2021 16:22:18 +0000 (18:22 +0200)] 
tools: only fail validations if VIR_HOST_VALIDATE_FAIL is set

Currently `virt-host-validate` will fail whenever one of its calls fail,
regardless of virHostValidateLevel set.

This behaviour is not optimal and makes it not exactly reliable as a
command line tool as other tools or scripts using it would have to check
its output to figure out whether something really failed or if a warning
was mistakenly treated as failure.

With this change, the behaviour of whether to fail or not, is defined by
the caller of those functions, based on the virHostValidateLevel passed
to them.

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

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: introduce stubs for new libvirt Go packages
Daniel P. Berrangé [Tue, 25 May 2021 10:42:32 +0000 (11:42 +0100)] 
docs: introduce stubs for new libvirt Go packages

Currently we expose libvirt Go packages at

  libvirt.org/libvirt-go
  libvirt.org/libvirt-go-xml

These packages have not supported Go modules historically and when we
tried to introduce modules, we hit the problem that we're not using
semver for versioning.

The only way around this is to introduce new packages under a different
namespace, that will have the exact same code, but be tagged with a
different version numbering scheme.

This change proposes:

  libvirt.org/go/libvirt
  libvirt.org/go/libvirtxml

Note the hyphen is removed so that the import basename matches the
Go package name.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: formatdomain: Document disk serial truncation status quo
Peter Krempa [Fri, 4 Jun 2021 12:08:40 +0000 (14:08 +0200)] 
docs: formatdomain: Document disk serial truncation status quo

Disk serials are truncated arbitrarily and silently by qemu depending on
the device type and how they are configured. Since changing the current
state would lead to more regressions than we have now, document that the
truncation is arbitrary.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: virtiofs: describe memfd memory backend
Stefan Hajnoczi [Mon, 7 Jun 2021 13:50:24 +0000 (14:50 +0100)] 
docs: virtiofs: describe memfd memory backend

Nowadays memfd is the most convenient memory backend for vhost-user
devices. Compared to file-backend memory and hugepages, there is no need
to worry about configuring the location of the shm directory or
allocating hugepages.

Cc: Michal Prívozník <mprivozn@redhat.com>
Cc: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh: Add coredump format completion to dump command
Lin Ma [Mon, 7 Jun 2021 03:14:18 +0000 (11:14 +0800)] 
virsh: Add coredump format completion to dump command

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh: Use VIR_ENUM_* for --format argument in doDump
Lin Ma [Mon, 7 Jun 2021 03:14:17 +0000 (11:14 +0800)] 
virsh: Use VIR_ENUM_* for --format argument in doDump

Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: Small fixes for daemons.rst
Jim Fehlig [Fri, 4 Jun 2021 21:59:44 +0000 (15:59 -0600)] 
docs: Small fixes for daemons.rst

Remove some dupicate text and replace in incorrect occurance of
monolithic with modular.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agoTranslated using Weblate (Korean)
simmon [Mon, 7 Jun 2021 08:46:26 +0000 (10:46 +0200)] 
Translated using Weblate (Korean)

Currently translated at 44.2% (4563 of 10314 strings)

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

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
4 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 7 Jun 2021 08:46:25 +0000 (10:46 +0200)] 
Translated using Weblate (Swedish)

Currently translated at 27.6% (2855 of 10314 strings)

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

Translated using Weblate (Swedish)

Currently translated at 27.1% (2796 of 10314 strings)

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

Translated using Weblate (Swedish)

Currently translated at 26.9% (2777 of 10314 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
4 years agoremoteGetUNIXSocket: Complete variable rename for WIN32
Michal Privoznik [Sat, 5 Jun 2021 04:46:48 +0000 (06:46 +0200)] 
remoteGetUNIXSocket: Complete variable rename for WIN32

In fcdcf8f70cf the remoteGetUNIXSocket() function was changed and
one new variable was introduced (among other things): @env_name.
However, for WIN32 case the variable changed name to @env_path
which builds mingw builds.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirnetsocket: Mark @spawnDaemonPath of virNetSocketNewConnectUNIX() unused
Michal Privoznik [Sat, 5 Jun 2021 04:38:32 +0000 (06:38 +0200)] 
virnetsocket: Mark @spawnDaemonPath of virNetSocketNewConnectUNIX() unused

The virNetSocketNewConnectUNIX() function was changed in
48f66cfe3e. And its WIN32 version (which just reports an error)
was updated too, but this new argument @spawnDaemonPath was not
marked as unused.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodoRemoteOpen: Drop @daemonPath
Michal Privoznik [Sat, 5 Jun 2021 04:05:27 +0000 (06:05 +0200)] 
doRemoteOpen: Drop @daemonPath

The @daemonPath variable in doRemoteOpen() is no longer used
after faf8354674. Remove it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoch: set shared drivers
Wei Liu [Fri, 4 Jun 2021 14:50:52 +0000 (14:50 +0000)] 
ch: set shared drivers

We want to use those shared drivers provided by libvirt to avoid
implementing our own.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Wei Liu <liuwe@microsoft.com>
4 years agochExtractVersion: Drop @ret
Michal Privoznik [Fri, 4 Jun 2021 13:08:32 +0000 (15:08 +0200)] 
chExtractVersion: Drop @ret

After previous patches, the @ret variable and the 'cleanup'
label are redundant. Remove them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agochExtractVersion: use g_auto*
Michal Privoznik [Fri, 4 Jun 2021 13:06:34 +0000 (15:06 +0200)] 
chExtractVersion: use g_auto*

There are two variables that can be freed automatically: @cmd
(which allows us to drop explicit virCommandFree() call at the
end of the function) and @help which was never freed (and thus
leaked).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoch_driver: Don't error out if CH_CMD was not found
Michal Privoznik [Fri, 4 Jun 2021 12:55:04 +0000 (14:55 +0200)] 
ch_driver: Don't error out if CH_CMD was not found

The CH driver needs "cloud-hypervisor" binary. And if none was
found then the initialization of the driver fails as
chStateInitialize() returns VIR_DRV_STATE_INIT_ERROR. This in
turn means that whole daemon fails to initialize. Let's return
VIR_DRV_STATE_INIT_SKIPPED in this particular case, which
disables the CH drvier but lets the daemon run.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoch_conf: Dissolve chExtractVersionInfo() in chExtractVersion()
Michal Privoznik [Fri, 4 Jun 2021 12:21:40 +0000 (14:21 +0200)] 
ch_conf: Dissolve chExtractVersionInfo() in chExtractVersion()

After previous patches, there's not much value in
chExtractVersion(). Rename chExtractVersionInfo() to
chExtractVersion() and have it use virCHDriver directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agochExtractVersionInfo: Don't check for retversion != NULL
Michal Privoznik [Fri, 4 Jun 2021 12:19:15 +0000 (14:19 +0200)] 
chExtractVersionInfo: Don't check for retversion != NULL

The only caller, chExtractVersion() passes not NULL. Therefore,
it's redundant to check for NULL.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoch_conf: Move error reporting into chExtractVersionInfo()
Michal Privoznik [Fri, 4 Jun 2021 12:18:50 +0000 (14:18 +0200)] 
ch_conf: Move error reporting into chExtractVersionInfo()

If chExtractVersionInfo() fails, in some cases it reports error
and in some it doesn't. Fix those places and drop reporting error
from chExtractVersion() which would just overwrite more specific
error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: add missing docs for some sound devices
Daniel P. Berrangé [Thu, 3 Jun 2021 11:43:30 +0000 (12:43 +0100)] 
docs: add missing docs for some sound devices

Closes: https://gitlab.com/libvirt/libvirt/-/issues/173
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: tweak heading name for <audio> element
Daniel P. Berrangé [Thu, 3 Jun 2021 11:36:51 +0000 (12:36 +0100)] 
docs: tweak heading name for <audio> element

The <audio> element is configuring exclusively a backend, not a device.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: wire up support for timer period audio setting
Daniel P. Berrangé [Thu, 3 Jun 2021 08:15:36 +0000 (09:15 +0100)] 
qemu: wire up support for timer period audio setting

Closes: https://gitlab.com/libvirt/libvirt/-/issues/171
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoconf: add support for timer period audio setting
Daniel P. Berrangé [Thu, 3 Jun 2021 08:15:19 +0000 (09:15 +0100)] 
conf: add support for timer period audio setting

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: use virtproxyd if no URI is given
Daniel P. Berrangé [Mon, 24 May 2021 11:23:12 +0000 (12:23 +0100)] 
remote: use virtproxyd if no URI is given

When the default driver mode requests the modular daemons, we still
defaulted to spawning libvirtd if the URI was NULL, because we don't
know which driver specific daemon to spawn. virtproxyd has logic
that can handle this as it is used for compatibility when accepting
incoming TCP connections with a NULL URI.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpc: remove "spawnDaemon" parameter
Daniel P. Berrangé [Mon, 24 May 2021 14:07:19 +0000 (15:07 +0100)] 
rpc: remove "spawnDaemon" parameter

The "spawnDaemon" and "binary" parameters are co-dependant, with the
latter non-NULL, if-and-only-if the former is true. Getting rid of the
"spawnDaemon" parameter simplifies life for the callers and eliminates
an error checking scenario.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: don't populate daemon path if autostart is not required
Daniel P. Berrangé [Mon, 24 May 2021 13:58:12 +0000 (14:58 +0100)] 
remote: don't populate daemon path if autostart is not required

When deciding what socket to connect to, we build the daemon path
that we need to autostart. This path only needs to be populated
if we actually intend to use autostart.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: change socket helper to return full daemon path
Daniel P. Berrangé [Mon, 24 May 2021 13:08:44 +0000 (14:08 +0100)] 
remote: change socket helper to return full daemon path

The remoteGetUNIXSocket method currently just returns the daemon name
and the caller then converts this to a path. Except the SSH helper
didn't do this, so it was relying on later code expanding $PATH, and
this doesn't allow for build root overrides.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: consistently use flags for passing ro/user/autostart props
Daniel P. Berrangé [Mon, 24 May 2021 13:02:07 +0000 (14:02 +0100)] 
remote: consistently use flags for passing ro/user/autostart props

We have helper methods that return boolans for ro/user/autostart
properties. We then pack them into a flags parameter, and later
unpack them again. This makes the code consistently use flags
throughout.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: move open flags enum to sockets header
Daniel P. Berrangé [Mon, 24 May 2021 12:53:26 +0000 (13:53 +0100)] 
remote: move open flags enum to sockets header

This enum will shortly be used by the remote driver sockets helper
methods too.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirfile: Use g_build_filename() when building paths
Luke Yue [Mon, 31 May 2021 01:48:22 +0000 (09:48 +0800)] 
virfile: Use g_build_filename() when building paths

The g_build_filename() would decide which separator
to use instead of hardcoding in g_strdup_printf().

Related issue: https://gitlab.com/libvirt/libvirt/-/issues/12

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>