]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
4 years agotools: use g_auto() for all virBuffers
Laine Stump [Thu, 2 Jul 2020 23:40:16 +0000 (19:40 -0400)]
tools: use g_auto() for all virBuffers

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: use g_auto for all virBuffers
Laine Stump [Thu, 2 Jul 2020 23:35:41 +0000 (19:35 -0400)]
tests: use g_auto for all virBuffers

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: use g_auto() for all virBuffers
Laine Stump [Thu, 2 Jul 2020 22:26:41 +0000 (18:26 -0400)]
qemu: use g_auto() for all virBuffers

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agolxc: use g_auto() for all virBuffers
Laine Stump [Thu, 2 Jul 2020 22:23:25 +0000 (18:23 -0400)]
lxc: use g_auto() for all virBuffers

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agolibxl: use g_auto() for all virBuffers
Laine Stump [Thu, 2 Jul 2020 22:21:30 +0000 (18:21 -0400)]
libxl: use g_auto() for all virBuffers

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agohyperv: use g_auto() for all virBuffers
Laine Stump [Thu, 2 Jul 2020 22:16:08 +0000 (18:16 -0400)]
hyperv: use g_auto() for all virBuffers

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoesx: use g_auto() for all virBuffers
Laine Stump [Thu, 2 Jul 2020 22:14:00 +0000 (18:14 -0400)]
esx: use g_auto() for all virBuffers

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agobhyve: use g_auto() for all virBuffers
Laine Stump [Thu, 2 Jul 2020 22:03:45 +0000 (18:03 -0400)]
bhyve: use g_auto() for all virBuffers

In most cases this eliminates one or more calls to
virBufferClearAndReset(), but even when it doesn't it's better because:

1) it makes the code more consistent, making it more likely that new
   contributors who are "learning by example" will to the right thing.

2) it protects against future modifications that might have otherwise
   needed to add a virBufferClearAndReset()

3) Currently some functions don't call virBufferClearAndReset() only
   because they're relying on some subordinate function to call it for
   them (e.g. bhyveConnectGetSysinfo() in this patch relies on
   virSysinfoFormat() to clear out the buffer when there is an
   error). I think this is sloppy behavior, and that the toplevel
   function that defines and initializes the buffer should be the
   function clearing it at the end.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoconf, qemu: consider available CPUs in vcpupin/emulatorpin output
Daniel Henrique Barboza [Fri, 26 Jun 2020 22:10:44 +0000 (19:10 -0300)]
conf, qemu: consider available CPUs in vcpupin/emulatorpin output

The output of vcpupin and emulatorpin for a domain with vcpu
placement='static' is based on a default bitmap that contains
all possible CPUs in the host, regardless of the CPUs being offline
or not. E.g. for a Linux host with this CPU setup (from lscpu):

On-line CPU(s) list:   0,8,16,24,32,40,(...),184
Off-line CPU(s) list: 1-7,9-15,17-23,25-31,(...),185-191

And a domain with this configuration:

  <vcpu placement='static'>1</vcpu>

'virsh vcpupin' will return the following:

$ sudo ./run tools/virsh vcpupin vcpupin_test
 VCPU   CPU Affinity
----------------------
 0      0-191

This is benign by its own, but can make the user believe that all
CPUs from the 0-191 range are eligible for pinning. Which can lead
to situations like this:

$ sudo ./run tools/virsh vcpupin vcpupin_test 0 1
error: Invalid value '1' for 'cpuset.cpus': Invalid argument

This is exarcebated by the fact that 'virsh vcpuinfo' considers only
available host CPUs in the 'CPU Affinity' field:

$ sudo ./run tools/virsh vcpuinfo vcpupin_test
(...)
CPU Affinity:   y-------y-------y-------(...)

This patch changes the default bitmap of vcpupin and emulatorpin, in
the case of domains with static vcpu placement, to all available CPUs
instead of all possible CPUs. Aside from making it consistent with
the behavior of 'vcpuinfo', users will now have one less incentive to
try to pin a vcpu in an offline CPU.

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

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirhostcpu.c: introduce virHostCPUGetAvailableCPUsBitmap()
Daniel Henrique Barboza [Fri, 26 Jun 2020 22:10:43 +0000 (19:10 -0300)]
virhostcpu.c: introduce virHostCPUGetAvailableCPUsBitmap()

The idea is to have a function that calls virHostCPUGetOnlineBitmap()
but, instead of returning NULL if the host does not have CPU
offlining capabilities,  fall back to a bitmap containing all
present CPUs.

Next patch will use this helper in two other places.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirhostcpu.c: refactor virHostCPUParseCountLinux()
Daniel Henrique Barboza [Fri, 26 Jun 2020 22:10:42 +0000 (19:10 -0300)]
virhostcpu.c: refactor virHostCPUParseCountLinux()

This function reads the string in sysfspath/cpu/present and
parses it manually to retrieve the number of present CPUs.

virHostCPUGetPresentBitmap() reads and parses the same file,
using a more robust parser via virBitmapParseUnlimited(),
but returns a bitmap. Let's drop all the manual parsing done
here and simply return the size of the resulting bitmap
from virHostCPUGetPresentBitmap().

Given that no more parsing is being done manually in the function,
rename it to virHostCPUCountLinux().

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh-domain.c: modernize cmdVcpuinfo()
Daniel Henrique Barboza [Fri, 26 Jun 2020 22:10:41 +0000 (19:10 -0300)]
virsh-domain.c: modernize cmdVcpuinfo()

Use g_auto* pointers to avoid the need for the cleanup label. The
type of the pointer 'virDomainPtr dom' was changed to its alias
'virshDomainPtr' to allow the use of g_autoptr().

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh-domain.c: modernize virshVcpuinfoInactive()
Daniel Henrique Barboza [Fri, 26 Jun 2020 22:10:40 +0000 (19:10 -0300)]
virsh-domain.c: modernize virshVcpuinfoInactive()

Use g_auto* in the string and in the bitmap. Remove the
cleanup label since it's now unneeded.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirhostcpu.c: use g_autoptr in virHostCPUGetMap()
Daniel Henrique Barboza [Fri, 26 Jun 2020 22:10:39 +0000 (19:10 -0300)]
virhostcpu.c: use g_autoptr in virHostCPUGetMap()

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu_driver.c: use g_autoptr in qemuDomainGetEmulatorPinInfo()
Daniel Henrique Barboza [Fri, 26 Jun 2020 22:10:38 +0000 (19:10 -0300)]
qemu_driver.c: use g_autoptr in qemuDomainGetEmulatorPinInfo()

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoChange the virtual NICs limit for the ESX driver
Bastien Orivel [Tue, 7 Jul 2020 14:04:33 +0000 (16:04 +0200)]
Change the virtual NICs limit for the ESX driver

Since the ESX virtual hardware version 4.0, virtual machines support up
to 10 virtual NICs instead of 4 previously. This changes the limit
accordingly based on the provided `virtualHW.version`.

Signed-off-by: Bastien Orivel <bastien.orivel@diateam.net>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodomain_conf: Replace the name string with 'vcpu' if it is 'vcpus'
Liao Pingfang [Wed, 1 Jul 2020 23:39:40 +0000 (07:39 +0800)]
domain_conf: Replace the name string with 'vcpu' if it is 'vcpus'

If the name is 'vcpus', we will get 'vcpussched' instead of 'vcpusched'
in the error message as following:

... 19155 : vcpussched attributes 'vcpus' must not overlap

So we use 'vcpu' to replace 'vcpus'.

Signed-off-by: Liao Pingfang <liao.pingfang@zte.com.cn>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuBuildNumaCommandLine: Fix @masterInitiator check
Michal Privoznik [Wed, 8 Jul 2020 13:35:08 +0000 (15:35 +0200)]
qemuBuildNumaCommandLine: Fix @masterInitiator check

A few commits ago, in aeecbc87b73, I've implemented command line
generation for ACPI HMAT. For this, we need to know if at least
one guest NUMA node has vCPUs. This is tracked in
@masterInitiator variable, which is initialized to -1, then we
iterate through guest NUMA nodes and break the loop if we find a
node with a vCPU. After the loop, if masterInitiator is still
negative then no NUMA node has a vCPU and we error out. But this
exact check was missing comparison for negativeness.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: kbase: Fix the libvirt-host-validate typo
Erik Skultety [Wed, 8 Jul 2020 10:57:39 +0000 (12:57 +0200)]
docs: kbase: Fix the libvirt-host-validate typo

I overlooked this typo during review of 2c3ffa37.

Reported-by: Yalan Zhang <yalzhang@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
4 years agonews: Document HMAT addition
Michal Privoznik [Wed, 24 Jun 2020 13:44:48 +0000 (15:44 +0200)]
news: Document HMAT addition

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu: Build HMAT command line
Michal Privoznik [Wed, 8 Jul 2020 09:28:37 +0000 (11:28 +0200)]
qemu: Build HMAT command line

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

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu: Introduce QEMU_CAPS_NUMA_HMAT capability
Michal Privoznik [Wed, 27 May 2020 09:00:07 +0000 (11:00 +0200)]
qemu: Introduce QEMU_CAPS_NUMA_HMAT capability

This capability tracks whether QEMU is capable of defining HMAT
ACPI table for the guest.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agonuma: expose HMAT APIs
Michal Privoznik [Fri, 29 May 2020 12:55:57 +0000 (14:55 +0200)]
numa: expose HMAT APIs

These APIs will be used by QEMU driver when building the command
line.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoconf: Validate NUMA HMAT configuration
Michal Privoznik [Thu, 28 May 2020 15:23:00 +0000 (17:23 +0200)]
conf: Validate NUMA HMAT configuration

There are several restrictions, for instance @initiator and
@target have to refer to existing NUMA nodes (daa), @cache has to
refer to a defined cache level and so on.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoconf: Parse and format HMAT
Michal Privoznik [Wed, 27 May 2020 09:46:33 +0000 (11:46 +0200)]
conf: Parse and format HMAT

To cite ACPI specification:

  Heterogeneous Memory Attribute Table describes the memory
  attributes, such as memory side cache attributes and bandwidth
  and latency details, related to the System Physical Address
  (SPA) Memory Ranges. The software is expected to use this
  information as hint for optimization.

According to our upstream discussion [1] this is exposed under
<numa/> as <cache/> under NUMA <cell/> and <latency> or
<bandwidth/> under numa/latencies.

1: https://www.redhat.com/archives/libvir-list/2020-January/msg00422.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoAllow NUMA nodes without vCPUs
Michal Privoznik [Wed, 27 May 2020 11:42:22 +0000 (13:42 +0200)]
Allow NUMA nodes without vCPUs

QEMU allows creating NUMA nodes that have memory only.
These are somehow important for HMAT.

With check done in qemuValidateDomainDef() for QEMU 2.7 or newer
(checked via QEMU_CAPS_NUMA), we can be sure that the vCPUs are
fully assigned to NUMA nodes in domain XML.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agonuma_conf: Make virDomainNumaSetNodeCpumask() return void
Michal Privoznik [Wed, 27 May 2020 09:49:51 +0000 (11:49 +0200)]
numa_conf: Make virDomainNumaSetNodeCpumask() return void

There is only one caller of virDomainNumaSetNodeCpumask() which
checks for the return value but because the function will return
NULL iff the @cpumask was NULL in the first place. But in that
place @cpumask can't be NULL because it was just allocated by
virBitmapParse().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemuBuildMachineCommandLine: Drop needless check
Michal Privoznik [Fri, 29 May 2020 12:56:16 +0000 (14:56 +0200)]
qemuBuildMachineCommandLine: Drop needless check

The machine can not be NULL at this point -
qemuDomainDefPostParse() makes sure it isn't.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu_command: Rename qemuBuildNumaArgStr()
Michal Privoznik [Fri, 29 May 2020 12:57:20 +0000 (14:57 +0200)]
qemu_command: Rename qemuBuildNumaArgStr()

The function doesn't just build the argument for -numa. Since the
-numa can be repeated multiple times, it also puts -numa onto the
cmd line. Also, the rest of the functions has 'Command' infix.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agonuma_conf: Drop CPU from name of two functions
Michal Privoznik [Thu, 28 May 2020 14:52:22 +0000 (16:52 +0200)]
numa_conf: Drop CPU from name of two functions

There are two functions virDomainNumaDefCPUFormatXML() and
virDomainNumaDefCPUParseXML() which format and parse domain's
<numa/>. There is nothing CPU specific about them. Drop the
infix.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoconf: Move and rename virDomainParseScaledValue()
Michal Privoznik [Thu, 28 May 2020 10:38:43 +0000 (12:38 +0200)]
conf: Move and rename virDomainParseScaledValue()

There is nothing domain specific about the function, thus it
should not have virDomain prefix. Also, the fact that it is a
static function makes it impossible to use from other files.
Move the function to virxml.c and drop the 'Domain' infix.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemuxml2xmltest: Add "numatune-distance" test case
Michal Privoznik [Wed, 27 May 2020 12:24:56 +0000 (14:24 +0200)]
qemuxml2xmltest: Add "numatune-distance" test case

This test case checks that expanding NUMA distance works. On
input we accept if only distance from A to B is specified. On the
output we format the B to A distance too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemuBuildMemoryBackendProps: Use boolean type for 'pmem' property
Peter Krempa [Wed, 8 Jul 2020 07:13:42 +0000 (09:13 +0200)]
qemuBuildMemoryBackendProps: Use boolean type for 'pmem' property

Commit 82576d8f35e used a string "on" to enable the 'pmem' property.
This is okay for the command line visitor, but the property is declared
as boolean in qemu and thus it will not work when using QMP.

Modify the type to boolean. This changes the command line, but
fortunately the command line visitor in qemu parses both 'yes' and 'on'
as true for the property.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: capabilities: Drop the virQEMUCapsCacheLookupByArch function
Erik Skultety [Wed, 8 Jul 2020 07:58:51 +0000 (09:58 +0200)]
qemu: capabilities: Drop the virQEMUCapsCacheLookupByArch function

Previous commit removed the last usage of the function. Drop
virQEMUCapsCompareArch as well since virQEMUCapsCacheLookupByArch was
its only caller.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: Use virQEMUCapsCacheLookupDefault instead of lookup by arch
Erik Skultety [Fri, 3 Jul 2020 12:26:13 +0000 (14:26 +0200)]
qemu: Use virQEMUCapsCacheLookupDefault instead of lookup by arch

Firstly, SEV is present only on AMD, so we can safely assume x86.
Secondly, the problem with looking up capabilities in the cache by arch
is that it's using virHashSearch with a callback to find the right
capabilities and get the binary name from it as well, but since the
cache is empty, it will return NULL and we won't get the corresponding
binary name out of the lookup either. Then, during the cache validation
we try to create a new cache entry for the emulator, but since we don't
have the binary name, nothing gets created.
Therefore, virQEMUCapsCacheLookupDefault is used to fix this issue,
because it doesn't rely on the capabilities cache to construct the
emulator binary name.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: index: Add knowledge base link and description to the index page
Jianan Gao [Wed, 8 Jul 2020 01:58:30 +0000 (09:58 +0800)]
docs: index: Add knowledge base link and description to the index page

Add link and description of libvirt knowledge base to make it easier for
users and testers to understand libvirt.

Signed-off-by: Jianan Gao <jgao@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agobackup: Allow configuring incremental backup per-disk individually
Peter Krempa [Thu, 25 Jun 2020 14:16:14 +0000 (16:16 +0200)]
backup: Allow configuring incremental backup per-disk individually

The semantics of the backup operation don't strictly require that all
disks being backed up are part of the same incremental part (when a disk
was checkpointed/backed up separately or in a different VM), or even
they may not have a previous checkpoint at all (e.g. when the disk
was freshly hotplugged to the vm).

In such cases we can still create a common checkpoint for all of them
and backup differences according to configuration.

This patch adds a per-disk configuration of the checkpoint to do the
incremental backup from via the 'incremental' attribute and allows
perform full backups via the 'backupmode' attribute.

Note that no changes to the qemu driver are necessary to take advantage
of this as we already obey the per-disk 'incremental' field.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agobackupxml2xmltest: Call 'virDomainBackupAlignDisks' before formatting output
Peter Krempa [Tue, 7 Jul 2020 14:38:00 +0000 (16:38 +0200)]
backupxml2xmltest: Call 'virDomainBackupAlignDisks' before formatting output

Call the post-processing function so that we can validate that it does
the correct thing.

virDomainBackupAlignDisks requires disk definitions to be present so
let's fake them by copying disks from the backup definition and add one
extra disk 'vdextradisk'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agovirDomainBackupDiskDefFormat: Format internal disk state only when valid
Peter Krempa [Tue, 7 Jul 2020 14:52:50 +0000 (16:52 +0200)]
virDomainBackupDiskDefFormat: Format internal disk state only when valid

Format the disk state only when it isn't _NONE.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agobackupxml2xmltest: Remove output symlink of 'backup-pull-internal-invalid'
Peter Krempa [Tue, 7 Jul 2020 14:56:16 +0000 (16:56 +0200)]
backupxml2xmltest: Remove output symlink of 'backup-pull-internal-invalid'

Replace the output by a copy of the input file for further changes once
we start testing virDomainBackupAlignDisks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agodocs: Point to pkg.go.dev instead of godoc.org
Andrea Bolognani [Tue, 7 Jul 2020 10:37:37 +0000 (12:37 +0200)]
docs: Point to pkg.go.dev instead of godoc.org

The former is the new recommended frontend for browsing Go API
documentation online.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: Use libvirt.org namespace for Go bindings
Andrea Bolognani [Tue, 7 Jul 2020 10:42:01 +0000 (12:42 +0200)]
docs: Use libvirt.org namespace for Go bindings

Fixes: 193ad364062407c3fcd3267f0f135d8960b53020
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: backup: Setup TLS environment for pull-mode backup jobs
Peter Krempa [Wed, 1 Jul 2020 10:38:42 +0000 (12:38 +0200)]
qemu: backup: Setup TLS environment for pull-mode backup jobs

Use the configured TLS env to setup encryption of the TLS transport.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoconf: backup: Add 'tls' attribute for 'server' element
Peter Krempa [Wed, 1 Jul 2020 10:25:42 +0000 (12:25 +0200)]
conf: backup: Add 'tls' attribute for 'server' element

Allow enabling TLS for the NBD server used to do pull-mode backups. Note
that documentation already mentions 'tls', so this just implements the
schema and XML bits.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemu: conf: Add configuration of TLS environment for NBD transport of pull-backups
Peter Krempa [Fri, 26 Jun 2020 14:37:16 +0000 (16:37 +0200)]
qemu: conf: Add configuration of TLS environment for NBD transport of pull-backups

TLS is required to transport backed-up data securely when using
pull-mode backups.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoconf: backup: Store 'tlsAlias' and 'tlsSecretAlias' as internals of a backup
Peter Krempa [Wed, 1 Jul 2020 07:48:27 +0000 (09:48 +0200)]
conf: backup: Store 'tlsAlias' and 'tlsSecretAlias' as internals of a backup

Add fields for storing the aliases necessary to clean up the TLS env for
a backup job after it finishes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agotestCompareBackupXML: Add infrastructure for testing internal fields
Peter Krempa [Wed, 1 Jul 2020 07:56:46 +0000 (09:56 +0200)]
testCompareBackupXML: Add infrastructure for testing internal fields

There are few internal fields of the backup XML. Propagate the
'internal' flag so that the test can verify the XML infrastructure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agocheckpoint: Mention that VIR_DOMAIN_CHECKPOINT_XML_SIZE is expensive and stale
Peter Krempa [Thu, 2 Jul 2020 14:06:26 +0000 (16:06 +0200)]
checkpoint: Mention that VIR_DOMAIN_CHECKPOINT_XML_SIZE is expensive and stale

Data is valid only when queried as guest writes may increase the backup
size.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemu: checkpoint: Implement VIR_DOMAIN_CHECKPOINT_XML_SIZE
Peter Krempa [Wed, 1 Jul 2020 14:58:37 +0000 (16:58 +0200)]
qemu: checkpoint: Implement VIR_DOMAIN_CHECKPOINT_XML_SIZE

Introduce code which merges the appropriate bitmaps and queries the
final size of the backup, so that we can print the XML with size
information.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoconf: checkpoint: Add a flag storing whether disk 'size' is valid
Peter Krempa [Wed, 1 Jul 2020 14:58:29 +0000 (16:58 +0200)]
conf: checkpoint: Add a flag storing whether disk 'size' is valid

Avoid printing '0' size in case when we weren't able to determine the
backup size by adding a flag whether the size is valid and interlock
printing of the field according to the flag.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agodocs: checkpoint: Convert XML documentation to RST
Peter Krempa [Thu, 25 Jun 2020 12:47:25 +0000 (14:47 +0200)]
docs: checkpoint: Convert XML documentation to RST

Switch to the new format for easier extension.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemu: backup: integrate with blockpull
Peter Krempa [Fri, 26 Jun 2020 13:29:34 +0000 (15:29 +0200)]
qemu: backup: integrate with blockpull

Merge the bitmaps when finalizing a block pull job so that backups work
properly afterwards.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agodocs: backup: Convert XML documentation to RST
Peter Krempa [Thu, 25 Jun 2020 12:47:25 +0000 (14:47 +0200)]
docs: backup: Convert XML documentation to RST

Switch to the new format for easier extension.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoconf: backup: Don't explicitly forbid backup of read-only disk
Peter Krempa [Thu, 25 Jun 2020 10:49:45 +0000 (12:49 +0200)]
conf: backup: Don't explicitly forbid backup of read-only disk

Users may want to use this to create a full backup or even incremental
if the checkpoints are pre-existing. We still will not allow to create a
checkpoint on a read-only disk as that makes no sense.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agotests: qemuxml2argv: Test encrypted TLS key for nbd/vxhs disks
Peter Krempa [Tue, 30 Jun 2020 15:08:44 +0000 (17:08 +0200)]
tests: qemuxml2argv: Test encrypted TLS key for nbd/vxhs disks

Add a dummy secret so that we see what command line is generated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemu: domain: Setup secret for TLS key for nbd/vxhs disks
Peter Krempa [Tue, 30 Jun 2020 13:39:41 +0000 (15:39 +0200)]
qemu: domain: Setup secret for TLS key for nbd/vxhs disks

Setup the TLS secret when preparing a virStorageSource for use.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemu: conf: Add configuration of TLS key encryption for 'vxhs' and 'nbd' disks
Peter Krempa [Mon, 29 Jun 2020 15:12:03 +0000 (17:12 +0200)]
qemu: conf: Add configuration of TLS key encryption for 'vxhs' and 'nbd' disks

Until now libvirt didn't allow using encrypted TLS key for disk clients.

Add fields for configuring the secret and propagate defaults.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemu block: Add internals for handling 'secret' corresponding to TLS key
Peter Krempa [Mon, 29 Jun 2020 13:11:00 +0000 (15:11 +0200)]
qemu block: Add internals for handling 'secret' corresponding to TLS key

Add infrastructure for hot- and cold-plug of the secret object holding
decryption key for the TLS key.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemu: domain: Add infrastructure passing in TLS key's decryption key via 'secret'
Peter Krempa [Mon, 29 Jun 2020 13:10:42 +0000 (15:10 +0200)]
qemu: domain: Add infrastructure passing in TLS key's decryption key via 'secret'

Store the required data in the private data of a storage source and
ensure that the 'alias' of the secret is formatted in the status XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agovirQEMUDriverConfigLoadSpecificTLSEntry: Split up fetching of server-only config...
Peter Krempa [Tue, 30 Jun 2020 15:56:08 +0000 (17:56 +0200)]
virQEMUDriverConfigLoadSpecificTLSEntry: Split up fetching of server-only config options

The '*_tls_x509_verify' options are relevant only when we are going to
expose a server socket as client sockets always enable verification.

Split up the macro to separate the common bits from the server bits so
that when we'll later extend support of 'nbd' and 'vxhs' disks which are
client only we can reuse the existing macros.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agovirQEMUDriverConfigLoadSpecificTLSEntry: Move fetching of 'chardev_tls' above macro
Peter Krempa [Tue, 30 Jun 2020 15:51:50 +0000 (17:51 +0200)]
virQEMUDriverConfigLoadSpecificTLSEntry: Move fetching of 'chardev_tls' above macro

Move the extraction of the config value so that it makes more sense
after upcoming refactors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemu: conf: Move 'nbd' and 'vxhs' tls config variables together with rest of tls...
Peter Krempa [Mon, 29 Jun 2020 15:05:35 +0000 (17:05 +0200)]
qemu: conf: Move 'nbd' and 'vxhs' tls config variables together with rest of tls setup

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemu.conf: Remove misleading mention of 'migrate_tls'
Peter Krempa [Mon, 29 Jun 2020 10:05:03 +0000 (12:05 +0200)]
qemu.conf: Remove misleading mention of 'migrate_tls'

There's no such parameter. Reword the sentence to account for enabling
TLS-encrypted migration using API flags.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemuDomainDiskHasEncryptionSecret: unexport
Peter Krempa [Mon, 29 Jun 2020 14:00:03 +0000 (16:00 +0200)]
qemuDomainDiskHasEncryptionSecret: unexport

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemu: domain: Introduce helper for always fetching virStorageSource private data
Peter Krempa [Fri, 22 May 2020 10:29:10 +0000 (12:29 +0200)]
qemu: domain: Introduce helper for always fetching virStorageSource private data

Add a helper which will always return the storage source private data
even if it was not allocated before.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoutil: remove OOM error log from virGetHostnameImpl()
Laine Stump [Fri, 19 Jun 2020 02:33:28 +0000 (22:33 -0400)]
util: remove OOM error log from virGetHostnameImpl()

The strings allocated in virGetHostnameImpl() are all allocated via
g_strdup(), which will exit on OOM anyway, so the call to
virReportOOMError() is redundant, and removing it allows slight
modification to the code, in particular the cleanup label can be
eliminated.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoconf: eliminate useless error label in virDomainFeaturesDefParse()
Laine Stump [Fri, 19 Jun 2020 03:00:47 +0000 (23:00 -0400)]
conf: eliminate useless error label in virDomainFeaturesDefParse()

The error: label in this function just does "return -1", so replace
all the "goto error" in the function with "return -1".

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agonetwork: use proper arg type when calling virNetDevSetOnline()
Laine Stump [Wed, 24 Jun 2020 17:12:56 +0000 (13:12 -0400)]
network: use proper arg type when calling virNetDevSetOnline()

The 2nd arg to this function is a bool, not an int.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agonetwork: make networkDnsmasqXmlNsDef private to bridge_driver.c
Laine Stump [Wed, 24 Jun 2020 02:52:58 +0000 (22:52 -0400)]
network: make networkDnsmasqXmlNsDef private to bridge_driver.c

This struct isn't used anywhere else.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agonetwork: fix memory leak in networkBuildDhcpDaemonCommandLine()
Laine Stump [Fri, 19 Jun 2020 21:40:17 +0000 (17:40 -0400)]
network: fix memory leak in networkBuildDhcpDaemonCommandLine()

hostsfilestr was not being freed. This will be turned into g_autofree
in an upcoming patch converting a lot more of the same file to using
g_auto*, but I wanted to make a separate patch for this first so the
other patch is simpler to review (and to make backporting easier).

The leak was introduced in commit 97a0aa246799c97d0a9ca9ecd6b4fd932ae4756c

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agouse g_autoptr for all xmlBuffers
Laine Stump [Thu, 18 Jun 2020 23:16:33 +0000 (19:16 -0400)]
use g_autoptr for all xmlBuffers

AUTOPTR_CLEANUP_FUNC is set to xmlBufferFree() in util/virxml.h (This
is actually new - added accidentally (but fortunately harmlessly!) in
commit 257aba2dafe. I had added it along with the hunks in this patch,
then decided to remove it and submit separately, but missed taking out
the hunk in virxml.h)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoconf, vmx: check for OOM after calling xmlBufferCreate()
Laine Stump [Thu, 18 Jun 2020 16:49:09 +0000 (12:49 -0400)]
conf, vmx: check for OOM after calling xmlBufferCreate()

Although libvirt itself uses g_malloc0() and friends, which exit when
there isn't enouogh memory, libxml2 uses standard malloc(), which just
returns NULL on OOM - this means we must check for NULL on return from
any libxml2 functions that allocate memory.

xmlBufferCreate(), for example, might return NULL, and we don't always
check for it. This patch adds checks where it isn't already done.

(NB: Although libxml2 has a provision for changing behavior on OOM (by
calling xmlMemSetup() to change what functions are used to
allocating/freeing memory), we can't use that, since parts of libvirt
code end up in libvirt.so, which is linked and called directly by
applications that may themselves use libxml2 (and may have already set
their own alternate malloc()), e.g. drivers like esx which live totally
in the library rather than a separate process.)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agonews.html: Add 3 new features
Yanqiu Zhang [Thu, 2 Jul 2020 09:06:46 +0000 (09:06 +0000)]
news.html: Add 3 new features

Add 'virtio packed' in 6.3.0, 'virDomainGetHostnameFlags' and
'Panic Crashloaded event' for 6.1.0.

Signed-off-by: Yanqiu Zhang <yanqzhan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agovirConnectGetAllDomainStats: Document two vcpu stats
Michal Privoznik [Mon, 29 Jun 2020 12:55:54 +0000 (14:55 +0200)]
virConnectGetAllDomainStats: Document two vcpu stats

When introducing vcpu.<num>.wait (v1.3.2-rc1~301) and
vcpu.<num>.halted (v2.4.0-rc1~36) the documentation was
not written.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agodocs: Update CI documentation
Andrea Bolognani [Thu, 2 Jul 2020 13:02:38 +0000 (15:02 +0200)]
docs: Update CI documentation

We're no longer using either Travis CI or the Jenkins-based
CentOS CI, but we have started using Cirrus CI.

Mention the libvirt-ci subproject as well, as a pointer for those
who might want to learn more about our CI infrastructure.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agocirrus: Generate jobs dynamically
Andrea Bolognani [Mon, 29 Jun 2020 17:00:36 +0000 (19:00 +0200)]
cirrus: Generate jobs dynamically

Instead of having static job definitions for FreeBSD and macOS,
use a generic template for both and fill in the details that are
actually different, such as the list of packages to install, in
the GitLab CI job, right before calling cirrus-run.

The target-specific information are provided by lcitool, so that
keeping them up to date is just a matter of running the refresh
script when necessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agomaint: Post-release version bump to 6.6.0
Michal Privoznik [Fri, 3 Jul 2020 07:32:30 +0000 (09:32 +0200)]
maint: Post-release version bump to 6.6.0

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoRelease of libvirt-6.5.0
Daniel Veillard [Fri, 3 Jul 2020 06:49:25 +0000 (08:49 +0200)]
Release of libvirt-6.5.0

* NEWS.rst: updated with date of release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
4 years agoNEWS: Update for libvirt 6.5.0
Andrea Bolognani [Thu, 2 Jul 2020 12:41:18 +0000 (14:41 +0200)]
NEWS: Update for libvirt 6.5.0

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoutil: add access check for hooks to fix running as non-root
Daniel P. Berrangé [Wed, 1 Jul 2020 16:36:51 +0000 (17:36 +0100)]
util: add access check for hooks to fix running as non-root

Since feb83c1e710b9ea8044a89346f4868d03b31b0f1 libvirtd will abort on
startup if run as non-root

  2020-07-01 16:30:30.738+0000: 1647444: error : virDirOpenInternal:2869 : cannot open directory '/etc/libvirt/hooks/daemon.d': Permission denied

The root cause flaw is that non-root libvirtd is using /etc/libvirt for
its hooks. Traditionally that has been harmless though since we checked
whether we could access the hook file and degraded gracefully. We need
the same access check for iterating over the hook directory.

Long term we should make it possible to have an unprivileged hook dir
under $HOME.

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirnettlshelpers: Update private key
Michal Privoznik [Wed, 1 Jul 2020 07:47:48 +0000 (09:47 +0200)]
virnettlshelpers: Update private key

With the recent update of Fedora rawhide I've noticed
virnettlssessiontest and virnettlscontexttest failing with:

  Our own certificate servercertreq-ctx.pem failed validation
  against cacertreq-ctx.pem: The certificate uses an insecure
  algorithm

This is result of Fedora changes to support strong crypto [1]. RSA
with 1024 bit key is viewed as legacy and thus insecure. Generate
a new private key then. Moreover, switch to EC which is not only
shorter but also not deprecated that often as RSA. Generated
using the following command:

  openssl genpkey --outform PEM --out privkey.pem \
  --algorithm EC --pkeyopt ec_paramgen_curve:P-384 \
  --pkeyopt ec_param_enc:named_curve

1: https://fedoraproject.org/wiki/Changes/StrongCryptoSettings2

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: Fix 'Offline migration' description
Daniel Henrique Barboza [Tue, 30 Jun 2020 19:43:43 +0000 (16:43 -0300)]
docs: Fix 'Offline migration' description

'transfers inactive the definition of a domain' seems odd.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoUpdate translation files
Weblate [Mon, 29 Jun 2020 15:46:43 +0000 (17:46 +0200)]
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
4 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Mon, 29 Jun 2020 15:46:21 +0000 (17:46 +0200)]
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10318 of 10318 strings)

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

Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
4 years agotools: fix misleading comments about command names
Daniel P. Berrangé [Wed, 13 May 2020 15:31:28 +0000 (16:31 +0100)]
tools: fix misleading comments about command names

The srv-XXX commands were renamed to server-XXX, with the old
name being a undocumented back compat alias only.

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoci: Run all jobs, for all branches, all the time
Andrea Bolognani [Fri, 26 Jun 2020 18:11:58 +0000 (20:11 +0200)]
ci: Run all jobs, for all branches, all the time

After recent changes (increasing the parallelism of the pipeline
by reducing the number of stages, introducing FreeBSD builds that
take longer than any other job), the difference between running
the full pipeline or a reduced one has basically disappeared: in
both cases, the completion time is around 25-35 minutes depending
on whether containers need to be rebuilt and how many shared
runners are available.

Reduce the complexity of our .gitlab-ci.yml and make things
simpler for contributors by simply always running all jobs.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoTranslated using Weblate (French)
Daniel P. Berrangé [Mon, 29 Jun 2020 13:57:51 +0000 (15:57 +0200)]
Translated using Weblate (French)

Currently translated at 11.8% (1221 of 10318 strings)

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

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoTranslated using Weblate (Bengali (India))
Akarshan Biswas [Mon, 29 Jun 2020 13:57:48 +0000 (15:57 +0200)]
Translated using Weblate (Bengali (India))

Currently translated at 21.6% (2223 of 10291 strings)

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

Signed-off-by: Akarshan Biswas <akarshan.biswas@gmail.com>
4 years agoUpdate translation files
Weblate [Mon, 29 Jun 2020 13:57:44 +0000 (15:57 +0200)]
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
4 years agoTranslated using Weblate (French)
Julien Humbert [Mon, 29 Jun 2020 13:57:37 +0000 (15:57 +0200)]
Translated using Weblate (French)

Currently translated at 11.8% (1223 of 10291 strings)

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

Signed-off-by: Julien Humbert <julroy67@gmail.com>
Translated using Weblate (French)

Currently translated at 11.6% (1201 of 10291 strings)

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

Signed-off-by: Julien Humbert <julroy67@gmail.com>
4 years agopo: refresh pot file in prep for new release
Daniel P. Berrangé [Mon, 29 Jun 2020 13:17:28 +0000 (14:17 +0100)]
po: refresh pot file in prep for new release

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodomain_conf: Remove zPCI validation from formatter
Michal Privoznik [Sat, 27 Jun 2020 07:09:39 +0000 (09:09 +0200)]
domain_conf: Remove zPCI validation from formatter

In 076591009ad a validation code was added to
virDomainDeviceInfoFormat() which reports an error if zPCI
address entered in was incomplete. But, there are two problems
with this approach.

The first problem is the placement of the code - it doesn't
belong into XML formatter rather than XML validator.

The second one is that at the point of formatting XML the post
parse callback has run and thus filled in required info.
Therefore this check can never do something useful and instead of
moving it into validator, it's removed completely.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoqemu_validate: Fix how qemuValidateDomainDeviceDefZPCIAddress() is called
Michal Privoznik [Sat, 27 Jun 2020 08:49:37 +0000 (10:49 +0200)]
qemu_validate: Fix how qemuValidateDomainDeviceDefZPCIAddress() is called

To make the code future proof, the rest of the
qemuValidateDomainDeviceDefAddress() has to be executed (even
though there is nothing there yet) instead of returning directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoqemuhotplugtest: Free monitor iff successfully initialized
Michal Privoznik [Sat, 27 Jun 2020 07:20:21 +0000 (09:20 +0200)]
qemuhotplugtest: Free monitor iff successfully initialized

If initializing test monitor in testQemuHotplugCpuPrepare()
fails, the control jumps to error label where
testQemuHotplugCpuDataFree() is called. But since the data->mon
is NULL due to aforementioned failure,
qemuMonitorTestGetMonitor() dereferences a NULL pointer leading
to a SIGSEGV.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agodomain_conf.c: skip checking ZPCI address is incomplete if not present
Daniel Henrique Barboza [Fri, 26 Jun 2020 21:49:00 +0000 (18:49 -0300)]
domain_conf.c: skip checking ZPCI address is incomplete if not present

Commit 076591009ad1 ("conf: fix zPCI address auto-generation on
s390") is doing a check for virZPCIDeviceAddressIsIncomplete()
prior to checking if the device has a ZPCI address at all. This
results in errors like these when starting libvirt:

  error : virDomainDeviceInfoFormat:7527 : internal error:
  Missing uid or fid attribute of zPCI address

Fix it by moving virZPCIDeviceAddressIsIncomplete() after the
check done by virZPCIDeviceAddressIsPresent().

Fixes: 076591009ad11ec108521b52a4945d0f895fa160
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agonews: document zPCI addressing changes
Shalini Chellathurai Saroja [Fri, 26 Jun 2020 08:59:41 +0000 (10:59 +0200)]
news: document zPCI addressing changes

Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agotests: add test with PCI and CCW device
Shalini Chellathurai Saroja [Thu, 18 Jun 2020 08:25:18 +0000 (10:25 +0200)]
tests: add test with PCI and CCW device

Add test with a ZPCI host device and a CCW memballoon device to ensure
that CCW address remains the default address assigned.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agotests: qemu: add more tests for ZPCI on S390
Shalini Chellathurai Saroja [Thu, 18 Jun 2020 08:25:17 +0000 (10:25 +0200)]
tests: qemu: add more tests for ZPCI on S390

1. Test for auto-generating uids while specifying valid fids
2. Test for auto-generating fids while specifying valid uids
3. Test for parse error while specifying a valid fid and an invalid
   uid
4. Test for parse error while specifying two ZPCI devices with same
   uid and fid addresses
5. Test for parse error when both uid and fid are set to zero
6. Test for error while specifying uid and not providing ZPCI
   capability.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoqemu: move ZPCI uid validation into device validation
Shalini Chellathurai Saroja [Thu, 18 Jun 2020 08:25:16 +0000 (10:25 +0200)]
qemu: move ZPCI uid validation into device validation

The ZPCI device validation is specific to qemu. So, let us move the
ZPCI uid validation out of domain xml parsing into qemu domain device
validation.

Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoconf: fix zPCI address auto-generation on s390
Shalini Chellathurai Saroja [Thu, 18 Jun 2020 08:25:15 +0000 (10:25 +0200)]
conf: fix zPCI address auto-generation on s390

Let us fix the issues with zPCI address validation and auto-generation
on s390.

Currently, there are two issues with handling the ZPCI address
extension. Firstly, when the uid is to be auto-generated with a
specified fid, .i.e.:

    ...
    <address type='pci'>
        <zpci fid='0x0000001f'/>
    </address>
    ...

we expect uid='0x0001' (or the next available uid for the domain).
However, we get a parsing error:

    $ virsh define zpci.xml
    error: XML error: Invalid PCI address uid='0x0000', must be > 0x0000
    and <= 0xffff

Secondly, when the uid is specified explicitly with the invalid
numerical value '0x0000', we actually expect the parsing error above.
However, the domain is being defined and the uid value is silently
changed to a valid value.

The first issue is a bug and the second one is undesired behaviour, and
both issues are related to how we (in-band) signal invalid values for
uid and fid. So let's fix the XML parsing to do validation based on what
is actually specified in the XML.

The first issue is also related to the current code behaviour, which
is, if either uid or fid is specified by the user, it is incorrectly
assumed that both uid and fid are specified. This bug is fixed by
identifying when the user specified ZPCI address is incomplete and
auto-generating the missing ZPCI address.

Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>