]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
4 years agotests: Fix lstat() mock initialization on macOS
Roman Bolshakov [Sun, 18 Oct 2020 15:30:56 +0000 (18:30 +0300)]
tests: Fix lstat() mock initialization on macOS

There is a typo that prevents initialization of real_lstat.

Fixes: d6b17edd5163 ("tests: Lookup extended stat/lstat in mocks")
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: implement memory failure event
zhenwei pi [Wed, 14 Oct 2020 10:37:51 +0000 (18:37 +0800)]
qemu: implement memory failure event

Since QEMU 5.2 (commit-77b285f7f6), QEMU supports 'memory failure'
event, posts event to monitor if hitting a hardware memory error.
Fully support this feature for QEMU.

Test with commit 'libvirt: support memory failure event', build a
little complex environment(nested KVM):
1, install newly built libvirt in L1, and start a L2 vm. run command
in L1:
 ~# virsh event l2 --event memory-failure

2, run command in L0 to inject MCE to L1:
 ~# virsh qemu-monitor-command l1 --hmp mce 0 9 0xbd000000000000c0 0xd 0x62000000 0x8c

Test result in l1(recipient hypervisor case):
event 'memory-failure' for domain l2:
recipient: hypervisor
action: ignore
flags:
        action required: 0
        recursive: 0

Test result in l1(recipient guest case):
event 'memory-failure' for domain l2:
recipient: guest
action: inject
flags:
        action required: 0
        recursive: 0

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agolibvirt: support memory failure event
zhenwei pi [Wed, 14 Oct 2020 10:37:50 +0000 (18:37 +0800)]
libvirt: support memory failure event

Introduce memory failure event. Libvirt should monitor domain's
event, then posts it to uplayer. According to the hardware memory
corrupted message, a cloud scheduler could migrate domain to another
health physical server.

Several changes in this patch:
public API:
    include/*
    src/conf/*
    src/remote/*
    src/remote_protocol-structs

client:
    examples/c/misc/event-test.c
    tools/virsh-domain.c

With this patch, each driver could implement its own method to run
this new event.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: Reformat
Michal Privoznik [Wed, 21 Oct 2020 12:53:12 +0000 (14:53 +0200)]
hyperv: Reformat

This is mostly opening hyperv driver sources in vim, selecting
everything, hitting reformat and then fixing a very few places.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Matt Coleman <matt@datto.com>
4 years agohyperv: Use two empty lines between functions
Michal Privoznik [Wed, 21 Oct 2020 12:29:47 +0000 (14:29 +0200)]
hyperv: Use two empty lines between functions

In some places we separate functions with only one line, in
others with three lines and the rest uses two lines.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Matt Coleman <matt@datto.com>
4 years agohyperv: Use hypervRequestStateChange() in hypervDomainSuspend()
Michal Privoznik [Wed, 21 Oct 2020 12:36:16 +0000 (14:36 +0200)]
hyperv: Use hypervRequestStateChange() in hypervDomainSuspend()

A few commits ago, hypervRequestStateChange() helper was
introduced which has exactly the same code as a part of
hypervDomainSuspend(). Deduplicate by calling the helper.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Matt Coleman <matt@datto.com>
4 years agohyperv: Don't overwrite errors from hypervCreateInvokeParamsList()
Michal Privoznik [Wed, 21 Oct 2020 12:25:37 +0000 (14:25 +0200)]
hyperv: Don't overwrite errors from hypervCreateInvokeParamsList()

The hypervCreateInvokeParamsList() function sets an error on a
failure, therefore there is no need to report another error in
callers.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Matt Coleman <matt@datto.com>
4 years agovirHashRemoveAll: Don't return number of removed items
Peter Krempa [Wed, 21 Oct 2020 12:57:36 +0000 (14:57 +0200)]
virHashRemoveAll: Don't return number of removed items

Nobody uses the return value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoutil: virhash: Remove key handling callbacks
Peter Krempa [Wed, 21 Oct 2020 11:52:01 +0000 (13:52 +0200)]
util: virhash: Remove key handling callbacks

Since we use virHashTable for string-keyed values only, we can remove
all the callbacks which allowed universal keys.

Code which wishes to use non-string keys should use glib's GHashTable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoutil: hash: Change type of hash table name/key to 'char'
Peter Krempa [Wed, 21 Oct 2020 11:31:16 +0000 (13:31 +0200)]
util: hash: Change type of hash table name/key to 'char'

All users of virHashTable pass strings as the name/key of the entry.
Make this an official requirement by turning the variables to 'const
char *'.

For any other case it's better to use glib's GHashTable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoutil: hash: Remove virHashCreateFull
Peter Krempa [Tue, 20 Oct 2020 16:17:16 +0000 (18:17 +0200)]
util: hash: Remove virHashCreateFull

The only place we call it is in virHashNew. Move the code to virHashNew
and remove virHashCreateFull.

Code wishing to use non-strings as hash table keys will be better off
using glib's GHashTable directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoutil: hash: Remove virHashValueFree
Peter Krempa [Wed, 21 Oct 2020 10:08:22 +0000 (12:08 +0200)]
util: hash: Remove virHashValueFree

Use 'g_free' directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoReplace all instances of 'virHashCreate' with 'virHashNew'
Peter Krempa [Tue, 20 Oct 2020 16:43:20 +0000 (18:43 +0200)]
Replace all instances of 'virHashCreate' with 'virHashNew'

It doesn't make much sense to configure the bucket count in the hash
table for each case specifically. Replace all calls of virHashCreate
with virHashNew which has a pre-set size and remove virHashCreate
completely.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainObjPrivateAlloc: Use virHashNew instead of virHashCreate
Peter Krempa [Wed, 21 Oct 2020 11:12:08 +0000 (13:12 +0200)]
qemuDomainObjPrivateAlloc: Use virHashNew instead of virHashCreate

virHashCreate will be removed in upcoming patches. This change has an
impact on ordering of the blockjob entries in one of the status XML->XML
tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agotests: hash: Prepare for replacement of virHashCreate
Peter Krempa [Wed, 21 Oct 2020 07:41:50 +0000 (09:41 +0200)]
tests: hash: Prepare for replacement of virHashCreate

Most callers pass a random number. We have virHashNew which doesn't give
the callers the option to configure the table. Since we are going to
switch to virHashNew replace it in tests and remove multiple instances
of the 'testHashGrow' case as it doesn't make sense with the new
semantics.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoconf: nwfilter: Replace 'virNWFilterHashTableCreate' with 'virHashNew'
Peter Krempa [Tue, 20 Oct 2020 16:41:27 +0000 (18:41 +0200)]
conf: nwfilter: Replace 'virNWFilterHashTableCreate' with 'virHashNew'

Export the freeing function rather than having a wrapper for the hash
creation function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirHashAtomicNew: Remove 'size' argument
Peter Krempa [Tue, 20 Oct 2020 16:28:21 +0000 (18:28 +0200)]
virHashAtomicNew: Remove 'size' argument

Use 'virHashNew' internally which uses a default size.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoconf: domain_addr: Refactor hash usage in zpci reservation code
Peter Krempa [Tue, 20 Oct 2020 15:31:23 +0000 (17:31 +0200)]
conf: domain_addr: Refactor hash usage in zpci reservation code

Rewrite using GHashTable which already has interfaces for using a number
as hash key.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirCgroupKillRecursive: Refactor cleanup
Peter Krempa [Thu, 22 Oct 2020 07:59:52 +0000 (09:59 +0200)]
virCgroupKillRecursive: Refactor cleanup

Remove 'cleanup' label and simplify remembering of the returned value
from the callback.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoutil: cgroup: Use GHashTable instead of virHashTable
Peter Krempa [Tue, 20 Oct 2020 15:01:51 +0000 (17:01 +0200)]
util: cgroup: Use GHashTable instead of virHashTable

Rewrite using GHashTable which already has interfaces for using a number
as hash key. Glib's implementation doesn't copy the key by default, so
we need to allocate it, but overal the interface is more suited for this
case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoutil: virhash: Remove virHashTableSize
Peter Krempa [Tue, 20 Oct 2020 14:32:54 +0000 (16:32 +0200)]
util: virhash: Remove virHashTableSize

It's used only in one place in tests which isn't even automatically
evaluated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirCgroupKillRecursive: Return -1 on failure condition
Peter Krempa [Thu, 22 Oct 2020 07:56:46 +0000 (09:56 +0200)]
virCgroupKillRecursive: Return -1 on failure condition

virCgroupKillRecursive sneakily initializes 'ret' to 0 rather than the
usual -1. 401030499bf moved an error condition but didn't actually
modify 'ret' return the proper error code.

Fixes: 401030499bf
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoparthelper: Don't leak @canonical_path
Michal Privoznik [Thu, 22 Oct 2020 10:55:40 +0000 (12:55 +0200)]
parthelper: Don't leak @canonical_path

The @canonical_path variable holds canonicalized path passed as
argv[1]. The canonicalized path is obtained either via
virFileResolveLink() or plain g_strdup(). Nevertheless, in both
cases it must be freed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoparthelper: Initialize error object
Michal Privoznik [Thu, 22 Oct 2020 10:49:44 +0000 (12:49 +0200)]
parthelper: Initialize error object

Some functions called from parthelper can report an error. But
that means that the error object must be initialized otherwise
virResetError() (which happens as a part of virReportError())
will free random pointers.

Reported-by: Katerina Koukiou <kkoukiou@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: stop passing -enable-fips to QEMU >= 5.2.0
Daniel P. Berrangé [Tue, 20 Oct 2020 16:48:59 +0000 (17:48 +0100)]
qemu: stop passing -enable-fips to QEMU >= 5.2.0

Use of the -enable-fips option is being deprecated in QEMU >= 5.2.0. If
FIPS compliance is required, QEMU must be built with libcrypt which will
unconditionally enforce it.

Thus there is no need for libvirt to pass -enable-fips to modern QEMU.
Unfortunately there was never any way to probe for -enable-fips in the
first instance, it was enabled by libvirt based on version number
originally, and then later unconditionally enabled when libvirt dropped
support for older QEMU. Similarly we now use a version number check to
decide when to stop passing -enable-fips.

Note that the qemu-5.2 capabilities are currently from the pre-release
version and will be updated once qemu-5.2 is released.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemuxml2argvtest: Sanitize testing of '-enable-fips'
Peter Krempa [Wed, 21 Oct 2020 08:08:11 +0000 (10:08 +0200)]
qemuxml2argvtest: Sanitize testing of '-enable-fips'

Rename 'FLAG_FIPS' to 'FLAG_FIPS_HOST' to signify that we are simulating
a host supporting fips mode and use the flag to assert 'enabeFips'
argument of 'qemuProcessCreatePretendCmdBuild' rather than passing it
via QEMU_CAPS_ENABLE_FIPS.

This prepares the testsuite for testing of -enable-fips deprecation in
qemu-5.2.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoutil: remove unused function virPCIGetSysfsFile()
Laine Stump [Mon, 12 Oct 2020 19:07:31 +0000 (15:07 -0400)]
util: remove unused function virPCIGetSysfsFile()

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: don't use virPCIGetSysfsFile()
Laine Stump [Mon, 12 Oct 2020 18:58:26 +0000 (14:58 -0400)]
util: don't use virPCIGetSysfsFile()

virPCIDeviceAddressGetSysfsFile() is simpler to call.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: remove unneeded cleanup:/ret in virpci.c
Laine Stump [Mon, 12 Oct 2020 21:25:56 +0000 (17:25 -0400)]
util: remove unneeded cleanup:/ret in virpci.c

These were nops once enough cleanup was g_auto'd.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: use more g_autofree in virpci.c
Laine Stump [Sun, 11 Oct 2020 03:05:49 +0000 (23:05 -0400)]
util: use more g_autofree in virpci.c

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: avoid manual VIR_FREE of a g_autofree pointer in virPCIGetName()
Laine Stump [Sun, 11 Oct 2020 02:56:23 +0000 (22:56 -0400)]
util: avoid manual VIR_FREE of a g_autofree pointer in virPCIGetName()

thisPhysPortID is only used inside a conditional, so reduce its scope
to just the body of that conditional, which will eliminate the need
for the undesirable manual VIR_FREE().

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: simplify virPCIProbeStubDriver()
Laine Stump [Sun, 11 Oct 2020 01:47:16 +0000 (21:47 -0400)]
util: simplify virPCIProbeStubDriver()

This function had a loop that was only executed twice; it was
artificially constructed with a label, a goto, and a boolean to tell
that it had already been executed once. Aside from that, the body of
the loop contained only two lines that needed to be repeated (the
second time through, everything beyond those two lines would be
skipped).

One side effect of this strange loop was that a g_autofree string was
manually freed and re-initialized; I've been told that manually
freeing a g_auto_free object is highly discouraged.

This patch refactors the function to simply repeat the 2 lines that
might possibly be executed twice, thus eliminating the ugly use of
goto to construct a loop, and also takes advantage of the fact that
virPCIDriverDir() was previously returning *exactly* the same string
both times it was called to eliminate the manual VIR_FREE of drvpath.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: simplify virPCIDriverDir() and its callers
Laine Stump [Sat, 10 Oct 2020 21:50:11 +0000 (17:50 -0400)]
util: simplify virPCIDriverDir() and its callers

There is no need for a temporary variable in this function, and since
it can't return NULL, no need for callers to check for it.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: simplify virPCIFile() and its callers
Laine Stump [Sat, 10 Oct 2020 21:46:20 +0000 (17:46 -0400)]
util: simplify virPCIFile() and its callers

There is no need for a temporary variable in this function, and ever
since we switched to glib for memory allocation, there is no possibility
it can return NULL, so callers don't need to check for it.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: simplify virHostdevPCISysfsPath()
Laine Stump [Thu, 1 Oct 2020 18:33:17 +0000 (14:33 -0400)]
util: simplify virHostdevPCISysfsPath()

Apparently at some point in the past, when there were multiple types
to represent PCI addresses, the function
virPCIDeviceAddressGetSysfsFile() used one of those types, while
virDomainHostDevDef used another. It's been quite awhile since we
reduced the number of different representations of PCI address, but
this function was still creating a temporary virPCIDeviceAddress, then
copying the individual elements into this temporary object from the
same type of object in the virDomainHostDevDef.

This patch just eliminates that pointless copy.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: fix very old bug/typo in virNetDevParseVfInfo()
Laine Stump [Wed, 21 Oct 2020 02:31:27 +0000 (22:31 -0400)]
util: fix very old bug/typo in virNetDevParseVfInfo()

When this function was recently changed to add in parsing of
IFLA_VF_STATS, I noticed that the checks for existence of IFLA_VF_MAC
and IFLA_VF_VLAN were looking in the *wrong array*. The array that
contains the results of parsing each IFLA_VFINFO in
tb[IFLA_VFINFO_LIST] is tb_vf, but we were checking for these in tb
(which is the array containing the results of the toplevel parsing of
the netlink message, *not* the results of parsing one of the nested
IFLA_VFINFO's.

This incorrect code has been here since the function was originally
written in 2012. It has only worked all these years due to coincidence
- the items at those indexes in tb are IFLA_ADDRESS and IFLA_BROADCAST
(of the *PF*, not of any of its VFs), and those happen to always be
present in the toplevel netlink message; since we are only looking in
the incorrect place to check for mere existence of the attribute (but
are doing the actual retrieval of the attribute from the correct
place), this bug has no real consequences other than confusing anyone
trying to understand the code.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoTranslated using Weblate (Spanish)
Adolfo Jayme Barrientos [Fri, 16 Oct 2020 20:30:27 +0000 (22:30 +0200)]
Translated using Weblate (Spanish)

Currently translated at 51.9% (5377 of 10354 strings)

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

Translated using Weblate (Portuguese (Brazil))

Currently translated at 52.3% (5418 of 10354 strings)

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

Translated using Weblate (Spanish)

Currently translated at 51.6% (5353 of 10354 strings)

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

Co-authored-by: Adolfo Jayme Barrientos <fitoschido@gmail.com>
Signed-off-by: Adolfo Jayme Barrientos <fitoschido@gmail.com>
4 years agorpm: disable LTO in Fedora 34
Daniel P. Berrangé [Wed, 21 Oct 2020 11:45:29 +0000 (12:45 +0100)]
rpm: disable LTO in Fedora 34

A binutils change has caused breakage when linking the tests

/usr/bin/ld: tests/libtest_qemu_driver.so: undefined reference to `__open_missing_mode'

This is probably a regression in binutils, so disable LTO until we get
more clarity on the root cause and whether binutils or libvirt will need
changing.

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

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agonews: more Hyper-V APIs
Matt Coleman [Wed, 21 Oct 2020 08:46:13 +0000 (04:46 -0400)]
news: more Hyper-V APIs

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: fix domainManagedSave on Hyper-V V2
Matt Coleman [Wed, 21 Oct 2020 08:46:12 +0000 (04:46 -0400)]
hyperv: fix domainManagedSave on Hyper-V V2

Signed-off-by: Matt Coleman <matt@datto.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: fix domainSuspend and domainResume on Hyper-V V2
Matt Coleman [Wed, 21 Oct 2020 08:46:11 +0000 (04:46 -0400)]
hyperv: fix domainSuspend and domainResume on Hyper-V V2

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: implement domainShutdown and domainShutdownFlags
Matt Coleman [Wed, 21 Oct 2020 08:46:10 +0000 (04:46 -0400)]
hyperv: implement domainShutdown and domainShutdownFlags

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: implement domainReboot and domainReset
Matt Coleman [Wed, 21 Oct 2020 08:46:09 +0000 (04:46 -0400)]
hyperv: implement domainReboot and domainReset

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: implement nodeGetFreeMemory
Matt Coleman [Wed, 21 Oct 2020 08:46:08 +0000 (04:46 -0400)]
hyperv: implement nodeGetFreeMemory

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: implement domainSetAutostart
Matt Coleman [Wed, 21 Oct 2020 08:46:07 +0000 (04:46 -0400)]
hyperv: implement domainSetAutostart

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: avoid overwriting errors from hypervGetWmiClass()
Matt Coleman [Wed, 21 Oct 2020 08:46:06 +0000 (04:46 -0400)]
hyperv: avoid overwriting errors from hypervGetWmiClass()

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: enable usage of g_autoptr for hypervInvokeParamsList
Matt Coleman [Wed, 21 Oct 2020 08:46:05 +0000 (04:46 -0400)]
hyperv: enable usage of g_autoptr for hypervInvokeParamsList

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: rename virNetDevParseVfConfig to virNetDevParseVfInfo
zhenwei pi [Thu, 15 Oct 2020 11:21:15 +0000 (19:21 +0800)]
util: rename virNetDevParseVfConfig to virNetDevParseVfInfo

virNetDevParseVfConfig has became a multifunctional helper function,
rename it to virNetDevParseVfInfo.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoutil: support device stats collection for <interface type='hostdev'>
zhenwei pi [Thu, 15 Oct 2020 11:21:14 +0000 (19:21 +0800)]
util: support device stats collection for <interface type='hostdev'>

libvirt can retrieve traffic stats for emulated interfaces that are
backed by tap or macvtap devices, but this information wasn't
available for hostdev interfaces (those that are implemented by
assigning an SR-IOV VF device to a guest using vfio):

  #virsh domifstat instance --interface=52:54:00:2d:b2:35
  error: Failed to get interface stats instance 52:54:00:2d:b2:35
  error: internal error: Interface name not provided

For some SR-IOV VF devices this information is available via the
netlink VFINFO_LIST request/response, and that is what this patch uses
to implement stats retrieval for VF. Not that this is dependent on
support in the PF driver - for example, the Mellanox ConnectX-4 Lx
(mlx5) driver reports usable stats, while Intel 82599 (ixgbe) and
82576 (igb) just report all stats as 0.  (this is the same result as
"ip -s link show").

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoqemu: support hotplug of vdpa devices
Jonathon Jongsma [Wed, 14 Oct 2020 17:08:29 +0000 (12:08 -0500)]
qemu: support hotplug of vdpa devices

By using the new qemu monitor functions to handle passing and removing
file descriptors, we can support hotplug of vdpa devices.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agoqemu: add monitor functions for handling file descriptors
Jonathon Jongsma [Wed, 14 Oct 2020 17:08:28 +0000 (12:08 -0500)]
qemu: add monitor functions for handling file descriptors

add-fd, remove-fd, and query-fdsets provide functionality that can be
used for passing fds to qemu and closing fdsets that are no longer
necessary.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoqemu: add vdpa support
Jonathon Jongsma [Wed, 14 Oct 2020 17:08:27 +0000 (12:08 -0500)]
qemu: add vdpa support

Enable <interface type='vdpa'> for qemu domains. This provides basic
support and does not support hotplug or migration.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoqemu: add vhost-vdpa capability
Jonathon Jongsma [Wed, 14 Oct 2020 17:08:26 +0000 (12:08 -0500)]
qemu: add vhost-vdpa capability

Recent versions of qemu added the -netdev vhost-vdpa device. This
capability allows libvirt to know whether this is supported.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoconf: Add support for vDPA network devices
Jonathon Jongsma [Wed, 14 Oct 2020 17:08:25 +0000 (12:08 -0500)]
conf: Add support for vDPA network devices

This patch adds new schema and adds support for parsing and formatting
domain configurations that include vdpa devices.

vDPA network devices allow high-performance networking in a virtual
machine by providing a wire-speed data path. These devices require a
vendor-specific host driver but the data path follows the virtio
specification.

When a device on the host is bound to an appropriate vendor-specific
driver, it will create a chardev on the host at e.g.  /dev/vhost-vdpa-0.
That chardev path can then be used to define a new interface with
type='vdpa'.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agomeson: remove non-pkg-config fallback for devmapper
Daniel P. Berrangé [Tue, 20 Oct 2020 10:18:19 +0000 (11:18 +0100)]
meson: remove non-pkg-config fallback for devmapper

The fallback for distros which lack pkg-config support for devmapper
references an undefined variable "tmp". It appears non of our supported
build platforms are triggering this bug and so the fallback code can be
removed entirely rather than fixed.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: agent: fix array access
Ján Tomko [Thu, 15 Oct 2020 12:54:39 +0000 (14:54 +0200)]
qemu: agent: fix array access

My code movement changed the type of ifaces_ret from
virDomainInterfacePtr * to virDomainInterfacePtr **,
but failed to adjust the condition or dereference the
array correctly.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 6ddb1f803ea38d8d709b984fa9539e34318a9dc0
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuxml2argvmock: Remove mocking of 'virSCSIDeviceGetSgName'
Peter Krempa [Thu, 15 Oct 2020 14:51:47 +0000 (16:51 +0200)]
qemuxml2argvmock: Remove mocking of 'virSCSIDeviceGetSgName'

Hostdev setup code no longer resolves hostdev name in the commandline
formatter but we mock it directly in the monitor code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Prepare hostdev data which depends on the host state separately
Peter Krempa [Thu, 15 Oct 2020 13:06:01 +0000 (15:06 +0200)]
qemu: Prepare hostdev data which depends on the host state separately

SCSI hostdev setup requires querying the host os for the actual path of
the configured hostdev. This was historically done in the command line
formatter. Our new approach is to split out this part into
'qemuProcessPrepareHost' which is designed to be skipped in tests.

Refactor the hostdev code to use this new semantics, and add appropriate
handlers filling in the data for tests and the qemuConnectDomainXMLToNative
users.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: hostdev: Prepare definition bits in qemuDomainPrepareHostdev
Peter Krempa [Thu, 15 Oct 2020 13:27:30 +0000 (15:27 +0200)]
qemu: hostdev: Prepare definition bits in qemuDomainPrepareHostdev

qemuBuildHostdevSCSIAttachPrepare is supposed to prepare the data
structure used for attaching the hostdev not preparing the hostdev
definition itself. Move the corresponding bits to qemuDomainPrepareHostdev

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuProcessCreatePretendCmd: Split up preparation and command building
Peter Krempa [Thu, 15 Oct 2020 12:39:16 +0000 (14:39 +0200)]
qemuProcessCreatePretendCmd: Split up preparation and command building

Host preparation steps which are deliberately skipped when
pretend-creating a commandline are normally executed after VM object
preparation. In the test code we are faking some of the host
preparation steps, but we were doing that prior to the call to
qemuProcessPrepareDomain embedded in qemuProcessCreatePretendCmd.

By splitting up qemuProcessCreatePretendCmd into two functions we can
ensure that the ordering of the prepare steps stays consistent.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyverv: hypervCreateEmbeddedParam: Rework items counting
Michal Privoznik [Mon, 19 Oct 2020 10:08:46 +0000 (12:08 +0200)]
hyverv: hypervCreateEmbeddedParam: Rework items counting

It's not necessarily clear, why we need to create the hash table
as big as number of fields we want to store, but nevertheless,
the code can be written a bit better. The @count should be type
of size_t and could be used directly in the loop that counts the
fields.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Matt Coleman <matt@datto.com>
4 years agohyperv: Drop needless error label in hypervCreateEmbeddedParam()
Michal Privoznik [Mon, 19 Oct 2020 09:56:11 +0000 (11:56 +0200)]
hyperv: Drop needless error label in hypervCreateEmbeddedParam()

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Matt Coleman <matt@datto.com>
4 years agohyperv: Use g_auto() for virHashTable in hypervCreateEmbeddedParam
Michal Privoznik [Mon, 19 Oct 2020 09:55:30 +0000 (11:55 +0200)]
hyperv: Use g_auto() for virHashTable in hypervCreateEmbeddedParam

This will allow us to drop 'error' label later.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: Accept const @value in hypervSetEmbeddedProperty()
Michal Privoznik [Mon, 19 Oct 2020 09:55:10 +0000 (11:55 +0200)]
hyperv: Accept const @value in hypervSetEmbeddedProperty()

The hypervSetEmbeddedProperty() function is used to update a
value for given property in a list of properties created by
hypervCreateEmbeddedParam(). The list is nothing fancy - it's a
virHashTable that has NULL as dataFree callback => the table does
not own the value. This is not that obvious since
hypervSetEmbeddedProperty() accepts a non-const pointer. This
fact makes it unnecessary hard to consume, e.g. if we wanted to
pass a stack allocated string.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Matt Coleman <matt@datto.com>
4 years agovirschematest: Validate schema in tests/cputestdata
Peter Krempa [Wed, 7 Oct 2020 14:52:14 +0000 (16:52 +0200)]
virschematest: Validate schema in tests/cputestdata

We now have a schema file for the 'cpu' elements. Use it to validate
files in 'tests/cputestdata'

Unfortunately the files in the directory are too disorganised and not
easy to split up to do something more straightforward.

The -baseline- input files are tested by the test internally and the
rest of the files are internal data feeding the tests so they don't
need validation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirschematest: Validate more XMLs
Peter Krempa [Wed, 7 Oct 2020 11:58:24 +0000 (13:58 +0200)]
virschematest: Validate more XMLs

We weren't validating certain directories containing nwfilter, network
and capability XML test files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirschematest: Add directories containing domain XMLs
Peter Krempa [Wed, 7 Oct 2020 09:40:39 +0000 (11:40 +0200)]
virschematest: Add directories containing domain XMLs

Validate additional XML documents we use for internal testing.
Specifically there's a lot of them belonging to the vmx and bhyve test
suite which were not validated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: vmx: Add <name> element for all domain XMLs
Peter Krempa [Wed, 7 Oct 2020 17:00:04 +0000 (19:00 +0200)]
tests: vmx: Add <name> element for all domain XMLs

<name> is mandatory for a domain XML. Add 'displayName' for all the test
cases which were missing them so that <name> is parsed correctly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoschema: domain: Allow space in XML schema for bridge source
Peter Krempa [Wed, 7 Oct 2020 16:59:50 +0000 (18:59 +0200)]
schema: domain: Allow space in XML schema for bridge source

vmware's network names can contain space and they are used as bridge
source. Modify the schema to allow it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoschema: domain: Add definition for the 'vmware' private namespace
Peter Krempa [Thu, 8 Oct 2020 06:46:55 +0000 (08:46 +0200)]
schema: domain: Add definition for the 'vmware' private namespace

The 'vmware' private namespace wasn't present in our schema definition
making all XMLs having the <datacenterpath> element invalid.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonwfilterxml2xmltest: Rename cases with XMLs not conforming to schema
Peter Krempa [Wed, 7 Oct 2020 12:45:55 +0000 (14:45 +0200)]
nwfilterxml2xmltest: Rename cases with XMLs not conforming to schema

There's quite a few negative tests. In anticipation of schema testing of
the 'nwfilterxml2xmlin' directory rename all negative/non-conformant
XMLs with the -invalid suffix.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonwfilterxml2firewall: Fix schema compilance of 'tcp' test case
Peter Krempa [Wed, 7 Oct 2020 14:32:16 +0000 (16:32 +0200)]
nwfilterxml2firewall: Fix schema compilance of 'tcp' test case

Fix the 'flags' of the last rule to conform to the RNG schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoschema: nwfiter: Allow leading/trailing whitespace in 'variable-name-type'
Peter Krempa [Wed, 7 Oct 2020 14:19:42 +0000 (16:19 +0200)]
schema: nwfiter: Allow leading/trailing whitespace in 'variable-name-type'

The reference string parser tolerates some leading/trailing whitespace
for the reference strings as witnessed by
tests/nwfilterxml2xmlin/iter-test3.xml

Allow them in the schema so that the test passes schema validation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoschema: nwfilter: Allow all accepted values for 'ipsetflags'
Peter Krempa [Wed, 7 Oct 2020 13:37:40 +0000 (15:37 +0200)]
schema: nwfilter: Allow all accepted values for 'ipsetflags'

The parser for the 'ipsetflags' accepts the 'src' and 'dst' values
stripping case. Express the same in the schema to pass validation of any
accepted string.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodomainconfdata/getfilesystem.xml: Remove <init> element
Peter Krempa [Wed, 7 Oct 2020 10:16:24 +0000 (12:16 +0200)]
domainconfdata/getfilesystem.xml: Remove <init> element

The element is not needed for the test and doesn't conform to the domain
XML schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirschematest: Fix testing of 'nwfilter' xmls
Peter Krempa [Wed, 7 Oct 2020 09:33:30 +0000 (11:33 +0200)]
virschematest: Fix testing of 'nwfilter' xmls

The files are under 'src/nwfilter/xml'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirschematest: Add coverage for 'examples/xml/test'
Peter Krempa [Tue, 6 Oct 2020 15:28:44 +0000 (17:28 +0200)]
virschematest: Add coverage for 'examples/xml/test'

Add all appropriate file from our test driver example XML directory.

Note that the two 'node.*' files are actually custom for the test driver
to load full state. We don't have a schema for them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirschematest: Add coverage for 'examples/xml/storage'
Peter Krempa [Tue, 6 Oct 2020 15:28:44 +0000 (17:28 +0200)]
virschematest: Add coverage for 'examples/xml/storage'

Match the correct subsets of the files via the 'dirRegex' property.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoexamples: xml: Fix 'vol-raw.xml' and 'vol-sparse.xml'
Peter Krempa [Tue, 6 Oct 2020 15:35:01 +0000 (17:35 +0200)]
examples: xml: Fix 'vol-raw.xml' and 'vol-sparse.xml'

Our schema forces a <target/> element which was not present in the
files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoexamples: xml: Fix 'pool-netfs.xml' example
Peter Krempa [Tue, 6 Oct 2020 15:29:58 +0000 (17:29 +0200)]
examples: xml: Fix 'pool-netfs.xml' example

Schema mandates a '<dir>' element, not '<directory>'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirschematest: Add regex filtering for directory contents
Peter Krempa [Tue, 6 Oct 2020 15:25:52 +0000 (17:25 +0200)]
virschematest: Add regex filtering for directory contents

In some cases we have directories with mixed XML files in the test
suite. Adding regex filtering will allow testing subsets of the XML
files against schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirschematest: Rewrite internals to allow increasing XML test coverage
Peter Krempa [Wed, 7 Oct 2020 08:26:56 +0000 (10:26 +0200)]
virschematest: Rewrite internals to allow increasing XML test coverage

To allow greater variablitity of XML schema validation tests without
needlessly reparsing the schema we need to refactor the internals to
pass in structs rather than just paths to directory.

This allows to directly implement testing of single files and will
simplify further additions such as filtering of the list of XML files in
a directory.

The list of tested paths is directly ported for now and will be improved
in follow-up patches.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agospec: Fix numad check
Boris Fiuczynski [Mon, 19 Oct 2020 12:23:00 +0000 (14:23 +0200)]
spec: Fix numad check

This caused

DEBUG: meson.build:2149:2: ERROR: Problem encountered: You must have numactl enabled for numad support.

on s390x.

Fixes: 974dc0a4c678af8ccb9224abecc834bb593e81fa
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoutil: xml: Add autoptr cleanup for virXMLValidator
Peter Krempa [Wed, 7 Oct 2020 08:26:30 +0000 (10:26 +0200)]
util: xml: Add autoptr cleanup for virXMLValidator

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuBlockExportAddNBD: Use 'block-export-add' when available
Peter Krempa [Wed, 14 Oct 2020 09:49:50 +0000 (11:49 +0200)]
qemuBlockExportAddNBD: Use 'block-export-add' when available

Switch to the new QMP command once it becomes available. Since the code
was refactored to have just one central location to do this we can
contain the ugly bits to just this one function.

Since we now use the replacement for 'nbd-server-add' mark the test case
as being OK with removal of the command.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Add infrastructure for 'block-export-add' to export NBD
Peter Krempa [Wed, 14 Oct 2020 09:33:06 +0000 (11:33 +0200)]
qemu: Add infrastructure for 'block-export-add' to export NBD

Add the monitor code, corresponding generator of properties for NBD and
tests validating it against the schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: capabilities: Add QEMU_CAPS_BLOCK_EXPORT_ADD
Peter Krempa [Wed, 14 Oct 2020 09:42:58 +0000 (11:42 +0200)]
qemu: capabilities: Add QEMU_CAPS_BLOCK_EXPORT_ADD

The 'block-export-add' QMP command is a replacement for 'nbd-server-add'
and will allow greater flexibility. Add a capability so that we can
switch to it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: qemucapabilities: Update capabilities for qemu-5.2 dev cycle
Peter Krempa [Wed, 14 Oct 2020 08:05:29 +0000 (10:05 +0200)]
tests: qemucapabilities: Update capabilities for qemu-5.2 dev cycle

Update to commit v5.1.0-2207-g96292515c0

Recent changes include deprecation of 'nbd-server-add' and addition of
'block-export-add'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemumonitorjsontest: Allow deprecation of 'nbd-server-add' QMP command
Peter Krempa [Wed, 14 Oct 2020 09:36:02 +0000 (11:36 +0200)]
qemumonitorjsontest: Allow deprecation of 'nbd-server-add' QMP command

qemu is going to deprecate this command in the next release. Allow this
as later patches will implement the use of replacement.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: block: Extract code for adding NBD exports to 'qemuBlockExportAddNBD'
Peter Krempa [Wed, 14 Oct 2020 09:12:19 +0000 (11:12 +0200)]
qemu: block: Extract code for adding NBD exports to 'qemuBlockExportAddNBD'

Centralize the logic deciding which arguments to use when exporting a
block backend via NBD to a single place so that it can be centrally
fixed in upcoming commits to support the new export method via
'block-export-add'.

Additionally this allows simplification of the caller from migration as
the logic deciding which arguments to use is extracted too.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoscripts: meson-html-gen: Remove
Peter Krempa [Tue, 13 Oct 2020 09:51:20 +0000 (11:51 +0200)]
scripts: meson-html-gen: Remove

The script was obscuring what's happening and not reporting errors
properly. Remove it since it's no longer used now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agodocs/manpages/meson.build: Use template code for XSLT processing
Peter Krempa [Tue, 13 Oct 2020 15:19:50 +0000 (17:19 +0200)]
docs/manpages/meson.build: Use template code for XSLT processing

Replace the reimplementation of the XSLT processing custom target with
an identical copy form docs/meson.build and a comment to keep them in
sync.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agodocs/kbase/meson.build: Use template code for XSLT processing
Peter Krempa [Tue, 13 Oct 2020 15:19:50 +0000 (17:19 +0200)]
docs/kbase/meson.build: Use template code for XSLT processing

Replace the reimplementation of the XSLT processing custom target with
an identical copy form docs/meson.build and a comment to keep them in
sync.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agodocs/internals/meson.build: Use template code for XSLT processing
Peter Krempa [Tue, 13 Oct 2020 15:19:50 +0000 (17:19 +0200)]
docs/internals/meson.build: Use template code for XSLT processing

Replace the reimplementation of the XSLT processing custom target with
an identical copy form docs/meson.build and a comment to keep them in
sync.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agodocs: meson.build: Prepare for use of identical code for XSLT processing of htmls
Peter Krempa [Tue, 13 Oct 2020 15:14:53 +0000 (17:14 +0200)]
docs: meson.build: Prepare for use of identical code for XSLT processing of htmls

Meson unfortunately doesn't give us any means to share the code using
xsltproc to output HTMLs processed by our template. This means we will
have to resort to copy&paste engineering.

To make things simpler, let's use the same block of code in
docs/meson.build but also any of the subdirs which generate htmls.

This will be achieved by making it configurable and wrapping it in a
comment that instructs anybody editing it to keep it identical.

We need to be able to configure the template file used and installation
directory. The rest of the processing is same as we do in
docs/meson.build.

This code will then be copied to subdirs to refactor the current
approach used there.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agodocs: meson.build: Generate HTML files directly by meson
Peter Krempa [Mon, 12 Oct 2020 14:13:08 +0000 (16:13 +0200)]
docs: meson.build: Generate HTML files directly by meson

Since we no longer reformat the XSLT-transformed files, there's no need
to use an external script any more.

Unfortunately this hid errors from 'xsltproc' as return value was not
checked and the stderr was piped into xmllints stdin. The result was
that any invalid input file would result into an empty output file.

Since the script's only purpose was to prevent additional temporary
files at the time we were reformatting the output in a pipeline we no
longer need this.

Moving the generation directly into the meson definition makes it more
obvious what's happening and saves readers from having to parse what's
going on. A free bonus is that errors are now properly caught and
reported.

This patch converts the main docs/ directory for now with cleanup of
other comming later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agodocs: meson.build: Limit html files depending on 'aclperms.htmlinc'
Peter Krempa [Tue, 13 Oct 2020 09:32:59 +0000 (11:32 +0200)]
docs: meson.build: Limit html files depending on 'aclperms.htmlinc'

Only 'acl.html' output file includes that file so there's no need to
make everything depend on it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agoscripts/meson-html-gen.py: Don't rereformat output files
Peter Krempa [Tue, 13 Oct 2020 14:47:48 +0000 (16:47 +0200)]
scripts/meson-html-gen.py: Don't rereformat output files

The output HTML files (especially those generated from rST files) don't
look good even after reformatting. Skip the extra step and accept that
no matter what we do HTMLs will not look great.

This additionally makes it way simpler to remove meson-html-gen.py in
the future (thus I've neglected to remove passing of xmllint).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agodocs: migration: Fix syntax
Peter Krempa [Mon, 12 Oct 2020 14:09:52 +0000 (16:09 +0200)]
docs: migration: Fix syntax

One of the paragraphs added in f51cbe92c0d was not terminated thus
making it invalid XML/XHTML.

This was not caught by the build system as 'scripts/meson-html-gen.py'
unnecessarily obscures and hides errors from 'xsltproc'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agoschema: domain: Accept VMware disk sources for the disk
Peter Krempa [Thu, 8 Oct 2020 08:39:57 +0000 (10:39 +0200)]
schema: domain: Accept VMware disk sources for the disk

Accept the 'datastore' variant of disk source specification used by our
VMware driver.

https://libvirt.org/drvesx.html#datastore

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pino Toscano <ptoscano@redhat.com>