]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
6 years agotests: qemuxml2xml: Use testQemuInfoSetArgs
Cole Robinson [Sun, 31 Mar 2019 20:44:25 +0000 (16:44 -0400)]
tests: qemuxml2xml: Use testQemuInfoSetArgs

No functional change, just replacing the old custom infrastructure

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: qemuxml2xml: Use struct testQemuInfo
Cole Robinson [Sun, 31 Mar 2019 16:36:27 +0000 (12:36 -0400)]
tests: qemuxml2xml: Use struct testQemuInfo

The qemuxml2xml testInfo is now just a subset of testQemuInfo, so it's
a drop in replacement

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: add testQemuGetLatestCaps
Cole Robinson [Sun, 31 Mar 2019 16:43:44 +0000 (12:43 -0400)]
tests: add testQemuGetLatestCaps

Move the capslatest building from qemuxml2argv to testutilsqemu

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: Move testQemuInfo* to testutilsqemu
Cole Robinson [Sun, 31 Mar 2019 15:49:34 +0000 (11:49 -0400)]
tests: Move testQemuInfo* to testutilsqemu

So it can eventually be shared with qemuxml2xml

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: qemuxml2argv: Rename testInfo* to testQemuInfo*
Cole Robinson [Sun, 31 Mar 2019 15:32:18 +0000 (11:32 -0400)]
tests: qemuxml2argv: Rename testInfo* to testQemuInfo*

In preparation for moving these bits to a shared place, rename them
to match one of the testutilsqemu.c function prefixes. Rename
info->flags handling too as it will need to be moved

testInfoSetPaths isn't renamed because it will stay local

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: qemuxml2argv: add testInfoSetPaths
Cole Robinson [Sun, 31 Mar 2019 15:08:19 +0000 (11:08 -0400)]
tests: qemuxml2argv: add testInfoSetPaths

This moves infile and outfile building outside the test case,
which better fits the pattern of qemuxml2xmltest. It also lets us
drop the qemuxml2argtest-specific 'suffix' from testInfo

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: qemuxml2argv: Add info->{in,out}file
Cole Robinson [Sun, 31 Mar 2019 14:59:30 +0000 (10:59 -0400)]
tests: qemuxml2argv: Add info->{in,out}file

Track infile and outfile in testInfo. This is step towards moving path
creation out of the test case, which will eventually help sharing more
code with qemuxml2xmltest.c

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: qemuxml2xml: Remove info->outActiveName
Cole Robinson [Sun, 31 Mar 2019 16:33:52 +0000 (12:33 -0400)]
tests: qemuxml2xml: Remove info->outActiveName

Reuse info->outfile for it. This requires us to set paths before
each virTestRun invocation

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: qemuxml2xml: Add info->{in,out}file
Cole Robinson [Sun, 31 Mar 2019 16:07:16 +0000 (12:07 -0400)]
tests: qemuxml2xml: Add info->{in,out}file

Just renamed from existing inName and outActiveName

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: qemuxml2xml: Break out testInfoSet*Paths
Cole Robinson [Sun, 31 Mar 2019 16:21:45 +0000 (12:21 -0400)]
tests: qemuxml2xml: Break out testInfoSet*Paths

These will need to be separate to share testInfo with qemuxml2argv

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoutil: json: Use VIR_APPEND_ELEMENT in virJSONValueObjectAppend
Peter Krempa [Tue, 5 Feb 2019 17:36:59 +0000 (18:36 +0100)]
util: json: Use VIR_APPEND_ELEMENT in virJSONValueObjectAppend

The function open-codes addition into an array. Use the helper instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: block: Use VIR_RETURN_PTR
Peter Krempa [Fri, 5 Apr 2019 15:52:17 +0000 (17:52 +0200)]
qemu: block: Use VIR_RETURN_PTR

Demonstrate how VIR_RETURN_PTR is used by refactoring qemu_block.c

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agointernal: Introduce VIR_RETURN_PTR
Peter Krempa [Fri, 5 Apr 2019 15:29:40 +0000 (17:29 +0200)]
internal: Introduce VIR_RETURN_PTR

With the introduction of more and more internal data types which support
VIR_AUTOPTR it's becoming common to see the following pattern:

  VIR_AUTOPTR(virSomething) some = NULL
  virSomethingPtr ret = NULL;

  ... (ret is not touched ) ...

  VIR_STEAL_PTR(ret, some);
  return ret;

This patch introduces a macro named VIR_RETURN_PTR which returns the
pointer directly without the need for an explicitly defined return
variable and use of VIR_STEAL_PTR. Internally obviously a temporary
pointer is created to allow setting the original pointer to NULL so that
the VIR_AUTOPTR function does not free the memory which we want to
actually return.

The name of the temporary variable is deliberately long and complex to
minimize the possibility of collision.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: block: Remove unneeded cleanup jumps
Peter Krempa [Thu, 4 Apr 2019 09:31:05 +0000 (11:31 +0200)]
qemu: block: Remove unneeded cleanup jumps

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: block: Add and use AUTOPTR func for qemuBlockNodeNameBackingChainData
Peter Krempa [Thu, 4 Apr 2019 09:18:07 +0000 (11:18 +0200)]
qemu: block: Add and use AUTOPTR func for qemuBlockNodeNameBackingChainData

This is a locally used helper struct but we can make use of automatic
freeing for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: block: Use VIR_AUTOFREE for char *
Peter Krempa [Thu, 4 Apr 2019 09:13:36 +0000 (11:13 +0200)]
qemu: block: Use VIR_AUTOFREE for char *

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: block: Use VIR_AUTOPTR for virHashTablePtr
Peter Krempa [Thu, 4 Apr 2019 09:03:24 +0000 (11:03 +0200)]
qemu: block: Use VIR_AUTOPTR for virHashTablePtr

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: block: Use VIR_AUTOPTR for virURIPtr
Peter Krempa [Thu, 4 Apr 2019 09:03:24 +0000 (11:03 +0200)]
qemu: block: Use VIR_AUTOPTR for virURIPtr

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: uri: Introduce VIR_AUTOPTR freeing function
Peter Krempa [Thu, 4 Apr 2019 08:56:31 +0000 (10:56 +0200)]
util: uri: Introduce VIR_AUTOPTR freeing function

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: block: Use VIR_AUTOPTR for virJSONValue
Peter Krempa [Thu, 4 Apr 2019 08:55:32 +0000 (10:55 +0200)]
qemu: block: Use VIR_AUTOPTR for virJSONValue

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: block: Introduce and use AUTOPTR func for qemuBlockStorageSourceAttachDataPtr
Peter Krempa [Thu, 4 Apr 2019 08:46:21 +0000 (10:46 +0200)]
qemu: block: Introduce and use AUTOPTR func for qemuBlockStorageSourceAttachDataPtr

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemuHotplugDiskSourceDataFree: also free backends
Ján Tomko [Wed, 10 Apr 2019 14:22:21 +0000 (16:22 +0200)]
qemuHotplugDiskSourceDataFree: also free backends

Also free the backends array, not just its members.

Fixes: d3f9dda2c9fd9fa7d2f7f1f1dd70ed7d83938101
Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: remove qemuGetDomainDefaultHugepath
Ján Tomko [Thu, 4 Apr 2019 11:58:02 +0000 (13:58 +0200)]
qemu: remove qemuGetDomainDefaultHugepath

It is no longer used.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: do not fill in default pagesize in qemuGetDomainHupageMemPath
Ján Tomko [Thu, 4 Apr 2019 11:53:17 +0000 (13:53 +0200)]
qemu: do not fill in default pagesize in qemuGetDomainHupageMemPath

Commit 6864d8f740e2502dc7625bdf18ffde4465b14f69 moved this one level up
for qemuBuildMemoryBackendProps but left qemuBuildMemPathStr intact.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: rename function for getting the default hugepage size
Ján Tomko [Thu, 4 Apr 2019 11:51:45 +0000 (13:51 +0200)]
qemu: rename function for getting the default hugepage size

Use qemuBuildMemoryGetDefaultPagesize.

Fixes: 6864d8f740e2502dc7625bdf18ffde4465b14f69
Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: Fix MinGW build for domaincapstest
Andrea Bolognani [Wed, 10 Apr 2019 13:08:46 +0000 (15:08 +0200)]
tests: Fix MinGW build for domaincapstest

Commit 5b9819eedc71 started using the virFileWrapper APIs in
the test program, and correctly called them only in the section
of code guarded by WITH_QEMU; however, a single call to the
virFileWrapperClearPrefixes() function ended up in the
hypervisor-agnostic section, causing a build failure on MinGW.

Move the call to the QEMU-only section; while at it, also drop
the virFileWrapperRemovePrefix() calls, which are entirely
redundant since we'd drop all prefixes immediately afterwards
anyway.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
6 years agodomain capabilities: Expose firmware auto selection feature
Michal Privoznik [Thu, 4 Apr 2019 10:42:14 +0000 (12:42 +0200)]
domain capabilities: Expose firmware auto selection feature

If a management application wants to use firmware auto selection
feature it can't currently know if the libvirtd it's talking to
support is or not. Moreover, it doesn't know which values that
are accepted for the @firmware attribute of <os/> when parsing
will allow successful start of the domain later, i.e. if the mgmt
application wants to use 'bios' whether there exists a FW
descriptor in the system that describes bios.

This commit then adds 'firmware' enum to <os/> element in
<domainCapabilities/> XML like this:

  <enum name='firmware'>
    <value>bios</value>
    <value>efi</value>
  </enum>

We can see both 'bios' and 'efi' listed which means that there
are descriptors for both found in the system (matched with the
machine type and architecture reported in the domain capabilities
earlier and not shown here).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
6 years agoqemu_firmware: Introduce qemuFirmwareGetSupported
Michal Privoznik [Thu, 4 Apr 2019 13:52:53 +0000 (15:52 +0200)]
qemu_firmware: Introduce qemuFirmwareGetSupported

The point of this API is to fetch all FW descriptors, parse them
and return list of supported interfaces and SMM feature for given
combination of machine type and guest architecture.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
6 years agoqemu_firmware: Separate machine and arch matching into a function
Michal Privoznik [Thu, 4 Apr 2019 13:51:47 +0000 (15:51 +0200)]
qemu_firmware: Separate machine and arch matching into a function

This part of the code will be reused later.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
6 years agoqemu_firmware: Separate firmware loading into a function
Michal Privoznik [Thu, 4 Apr 2019 13:20:37 +0000 (15:20 +0200)]
qemu_firmware: Separate firmware loading into a function

This piece of code will be reused later.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
6 years agoRevert "Include unistd.h directly by files using it"
Peter Krempa [Wed, 10 Apr 2019 10:26:21 +0000 (12:26 +0200)]
Revert "Include unistd.h directly by files using it"

This reverts commit a5e16020907e91bca1b0ab6c4ee5dbbdcccf6a54.

Getting rid of unistd.h from our headers will require more work than
just fixing the broken mingw build. Revert it until I have a more
complete proposal.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoInclude unistd.h directly by files using it
Peter Krempa [Mon, 1 Apr 2019 12:47:18 +0000 (14:47 +0200)]
Include unistd.h directly by files using it

util/virutil.h bogously included unistd.h. Drop it and replace it by
including it directly where needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Move enum convertors into virenum.(c|h)
Peter Krempa [Mon, 1 Apr 2019 10:14:26 +0000 (12:14 +0200)]
util: Move enum convertors into virenum.(c|h)

virutil.(c|h) is a very gross collection of random code. Remove the enum
handlers from there so we can limit the scope where virtutil.h is used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Don't include 'viralloc.h' into other header files
Peter Krempa [Mon, 1 Apr 2019 14:28:05 +0000 (16:28 +0200)]
util: Don't include 'viralloc.h' into other header files

'viralloc.h' does not provide any type or macro which would be necessary
in headers. Prevent leakage of the inclusion.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Move the VIR_AUTO(CLEAN|PTR) helper macros into a separate header
Peter Krempa [Mon, 1 Apr 2019 13:14:30 +0000 (15:14 +0200)]
util: Move the VIR_AUTO(CLEAN|PTR) helper macros into a separate header

Keeping them with viralloc.h forcibly pulls in the other stuff from
viralloc.h into other header files. This in turn creates a mess
as more and more headers pull in the 'viral' header file.

If we want to make 'viralloc.h' omnipresent we should pick a different
approach.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agovmx: Define VMX_CONFIG_FORMAT_ARGV
Han Han [Tue, 9 Apr 2019 10:01:25 +0000 (18:01 +0800)]
vmx: Define VMX_CONFIG_FORMAT_ARGV

Define VMX_CONFIG_FORMAT_ARGV to replace the hardcoded 'vmware-vmx'
string used by the domxml-X-native APIs. This follows the pattern used
by other drivers.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Han Han <hhan@redhat.com>
6 years agodocs: Add virt-lightning app
Michal Privoznik [Mon, 1 Apr 2019 12:14:58 +0000 (14:14 +0200)]
docs: Add virt-lightning app

There was this introduction made on the users list:

https://www.redhat.com/archives/libvirt-users/2019-March/msg00046.html

Add the application onto the list of apps known to use libvirt.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
6 years agorpc: Refactor cleanup paths in virNetLibsshAuthenticatePassword
Peter Krempa [Tue, 2 Apr 2019 15:35:42 +0000 (17:35 +0200)]
rpc: Refactor cleanup paths in virNetLibsshAuthenticatePassword

Now that the memory disposal is handled automatically we can simplify
the cleanup paths. In this case it's not as simple as sometimes the
value of the called function is returned.

While at it fix the initialization value of the returned variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_map: rename x86_EPYC-IBRS file to x86_EPYC-IBPB
Pavel Hrdina [Tue, 9 Apr 2019 11:10:37 +0000 (13:10 +0200)]
cpu_map: rename x86_EPYC-IBRS file to x86_EPYC-IBPB

The later is the correct CPU model name.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agoutil: Fix uninitalized variable to avoid garbage
Julio Faracco [Mon, 8 Apr 2019 20:32:14 +0000 (17:32 -0300)]
util: Fix uninitalized variable to avoid garbage

This commit fixes an unitialized variable to avoid garbage value
when virNetDevBridgeGet method returns error. When, that method fails
before initialize 'val' variable, it can cause problems related to
that.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agosnapshot: Fix use-after-free during snapshot delete
Eric Blake [Mon, 8 Apr 2019 16:45:47 +0000 (11:45 -0500)]
snapshot: Fix use-after-free during snapshot delete

Commit b647d2195 introduced a use-after-free situation when the caller
is trying to delete a snapshot and its children: if the callback
function deletes the parent, it is no longer safe to query the parent
to learn which children also need to be deleted (where we previously
saved deleting the parent for last).  To fix the problem, while still
maintaining support for topological visits of callback functions, we
have to stash off any information needed for later traversal prior to
using a callback function (virDomainMomentForEachChild already does
this, it is only virDomainMomentActOnDescendant that was running into
problems).

Sadly, the testsuite did not cover the problem at the time. Worse,
even though I later added commit 280a2b41e to catch problems like
this, and even though that test is indeed sufficient to detect the
problem when run under valgrind or suitable MALLOC_PERTURB_ settings,
I'm guilty of not running the test in such an environment.  Thus,
v5.2.0 has a regression that could have been prevented had we used the
testsuite to its full power. On the bright side, deleting snapshots
requires ACL domain:snapshot, which is arguably as powerful as
domain:write, so I don't think this use-after-free forms a security
hole.

At some point, it would be nice to convert virDomainMomentObj into a
virObject, at which point, the solution is even simpler: add
virObjectRef/Unref around the callback. But as that will require
auditing even more places in the code, I went with the simplest patch
for the regression fix.

Fixes: b647d2195
Reported-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Tested-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
6 years agocpu_x86: Require <cpuid> within <feature> in CPU map
Jiri Denemark [Wed, 13 Mar 2019 09:23:01 +0000 (10:23 +0100)]
cpu_x86: Require <cpuid> within <feature> in CPU map

A feature with no cpuid element is invalid and it should not be silently
treated as a feature with all CPUID bits set to zero.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Do not cache microcode version
Jiri Denemark [Fri, 5 Apr 2019 09:33:32 +0000 (11:33 +0200)]
cpu_x86: Do not cache microcode version

The microcode version checks are used to invalidate cached CPU data we
get from QEMU. To minimize /proc/cpuinfo parsing the microcode version
was only read when libvirtd started and cached for the daemon's
lifetime. However, the CPU microcode can change anytime (updating the
microcode package can automatically upload it to the CPU) and we need to
stop caching it to avoid using stale CPU model data.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agodomaincapstest: Test QEMU 3.1.0
Jiri Denemark [Mon, 11 Mar 2019 15:46:46 +0000 (16:46 +0100)]
domaincapstest: Test QEMU 3.1.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Move VIR_AUTOUNREF definition to virobject.h
Peter Krempa [Wed, 3 Apr 2019 11:37:26 +0000 (13:37 +0200)]
util: Move VIR_AUTOUNREF definition to virobject.h

This helper has solely to do with virObjects. Move it together with
other virObject stuff.

This also avoids the potential problem where VIR_AUTOUNREF uses
virObjectAutoUnref which is defined in virobject.h.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoexamples: enable all compiler warnings
Daniel P. Berrangé [Tue, 2 Apr 2019 10:00:13 +0000 (11:00 +0100)]
examples: enable all compiler warnings

Now that all the examples are warning free, keep it that way by enabling
all the normal compiler warning flags.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agodominfo: make example more useful
Daniel P. Berrangé [Tue, 2 Apr 2019 09:58:33 +0000 (10:58 +0100)]
dominfo: make example more useful

The example currently assumes that a NULL URI will open Xen and thus
also assumes that a domain with ID 0 exists. Change it to require the
URI and a domain name as command line arguments.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agodomtop: remove unused domain name parameter
Daniel P. Berrangé [Tue, 2 Apr 2019 09:58:20 +0000 (10:58 +0100)]
domtop: remove unused domain name parameter

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoexamples: avoid goto jump over initialization of variable
Daniel P. Berrangé [Tue, 2 Apr 2019 09:57:19 +0000 (10:57 +0100)]
examples: avoid goto jump over initialization of variable

Jumping over the declaration and initialization of a variable is bad as
it means the jump target sees a potentially non-initialized variable.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agodocs: Remove search.php and all references
Cole Robinson [Wed, 3 Apr 2019 22:00:23 +0000 (18:00 -0400)]
docs: Remove search.php and all references

libvirt.org/search.php drops into some kind of screen which I guess
is supposed to show a search bar with options, but presently for me
renders as nothing but the following text:

Search the documentation on Libvirt.org

The search service indexes the libvirt APIs and documentation as well as the libvir-list@redhat.com mailing-list archives. To use it simply provide a set of keywords:

The main page search bar now redirects to google, this page is broken,
I say we just remove it and move on.

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agodocs: Remove index.py
Cole Robinson [Wed, 3 Apr 2019 21:57:11 +0000 (17:57 -0400)]
docs: Remove index.py

This was used for generating the website search, which now just calls
out to google. Remove it

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agodocs: Use google sitesearch for website search
Cole Robinson [Tue, 2 Apr 2019 18:07:57 +0000 (14:07 -0400)]
docs: Use google sitesearch for website search

The website search is perpetually broken, has had XSS issues in the
past, and I suspect when it's working it's not as fast or capable as
a simple google site:libvirt.org search

Replace the <form> implementation with one that sends the user to
google.com with 'site:libvirt.org' appended to the search string

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agovircgrouppriv.h: Use #pragma once
Cole Robinson [Wed, 3 Apr 2019 21:44:51 +0000 (17:44 -0400)]
vircgrouppriv.h: Use #pragma once

Acked-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agonode_device_hal.h: Use #pragma once
Cole Robinson [Wed, 3 Apr 2019 17:30:14 +0000 (13:30 -0400)]
node_device_hal.h: Use #pragma once

Acked-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agonode_device_udev.h: Use #pragma once
Cole Robinson [Wed, 3 Apr 2019 17:29:22 +0000 (13:29 -0400)]
node_device_udev.h: Use #pragma once

Acked-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agonode_device_driver.h: Use #pragma once
Cole Robinson [Wed, 3 Apr 2019 17:29:03 +0000 (13:29 -0400)]
node_device_driver.h: Use #pragma once

Acked-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agobuild-aux: header-ifdef: Handle #pragma once
Cole Robinson [Wed, 3 Apr 2019 21:45:02 +0000 (17:45 -0400)]
build-aux: header-ifdef: Handle #pragma once

If we see it, skip all remaining header guard checks

Acked-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agobuild-aux: header-ifdef: Fix typos
Cole Robinson [Wed, 3 Apr 2019 21:25:37 +0000 (17:25 -0400)]
build-aux: header-ifdef: Fix typos

Acked-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: Avoid writing into $HOME during virsh-snapshot
Eric Blake [Wed, 27 Mar 2019 18:42:45 +0000 (13:42 -0500)]
tests: Avoid writing into $HOME during virsh-snapshot

In a constrained CI environment, where it is intentional that attempts
to write outside the current directory will fail, virsh-snapshot was
failing:

@@ -1,2 +1,3 @@
 error: invalid argument: parent s3 for snapshot s2 not found
 error: marker
+error: Failed to create '/home/travis/.cache/libvirt/virsh': Permission denied
FAIL virsh-snapshot (exit status: 1)

But we've already solved the problem in virsh-uriprecedence: tell
virsh to use XDG locations pointing to somewhere we can write rather
than its default of falling back to $HOME with the test being at risk
of breaking due to the user's environment and/or unacceptably altering
the user's normal cache.  Hoist that solution into test-lib.sh, so
that all scripts can use it as needed. While at it, fix a latent typo
where XDG_RUNTIME_HOME was set to a literal relative directory name
"XDG_CACHE_HOME" (the typo did not affect virsh-uriprecedence, but
could matter to other clients).

Fixes: 280a2b41
Fixes: 398de147
Reported-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agodocs: update Perl download to point to modern CPAN site
Daniel P. Berrangé [Wed, 3 Apr 2019 15:41:27 +0000 (16:41 +0100)]
docs: update Perl download to point to modern CPAN site

The search.cpan.org site is a transparent redirect to metacpan.org these
days, so we should just point directly to the new site.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agodocs: stop advertizing FTP or HTTP for downloads of libvirt
Daniel P. Berrangé [Wed, 3 Apr 2019 15:37:43 +0000 (16:37 +0100)]
docs: stop advertizing FTP or HTTP for downloads of libvirt

On the modern internet it is not credible to continue to advertize
software downloads over unencrypted connections. Even if users could
theoretically use GPG to verify the signatures, not all our downloads
are signed and few people know how to correctly verify signatures.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agonews: Document PCI by default on RISC-V
Andrea Bolognani [Fri, 22 Mar 2019 13:43:01 +0000 (14:43 +0100)]
news: Document PCI by default on RISC-V

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: Refresh capabilities for QEMU 4.0.0 on RISC-V
Andrea Bolognani [Thu, 21 Mar 2019 15:35:27 +0000 (16:35 +0100)]
tests: Refresh capabilities for QEMU 4.0.0 on RISC-V

There are a few differences, but the one we're interested in is
that PCIe Root Ports are finally available: as a result of this,
our riscv64-virt-headless guest will switch from virtio-mmio to
virtio-pci.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
6 years agoqemu: Unify address assignment for virt guests
Andrea Bolognani [Mon, 15 Oct 2018 14:20:11 +0000 (16:20 +0200)]
qemu: Unify address assignment for virt guests

The rules are the same for all virt guests, regardless of the
architecture.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
6 years agoqemu: Require PCIe Root Port for PCI by default on ARM virt
Andrea Bolognani [Thu, 21 Mar 2019 15:50:18 +0000 (16:50 +0100)]
qemu: Require PCIe Root Port for PCI by default on ARM virt

Our PCIe topology depends on the availability of PCIe Root Ports,
so if none of the suitable devices (pcie-root-port, ioh3420) is
compiled into QEMU we should fall back to virtio-mmio rather than
trying to use PCI addresses only to fail immediately afterwards
when we realize we can't use the necessary controllers.

Note that this additional check is basically moot for ARM virt
guests, because PCIe Root Ports were enabled in QEMU builds for
the architecture well before guest OS support had been widely
available; however, the opposite is true for RISC-V, and tweaking
the code this way will allow us to share it between architectures.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
6 years agotools: console: pass stream/fd errors to user
Nikolay Shirokovskiy [Thu, 14 Feb 2019 14:41:21 +0000 (17:41 +0300)]
tools: console: pass stream/fd errors to user

If the console was disconnected due to a connection problem or a problem on the
server side it is convinient to provide the cause to the user. If the error
come from the API then the error is saved in a virsh global variable. However,
since success is returned from virshRunConsole after we reach the waiting stage,
then the error is never reported. Let's track the error in the event loop.

Next after failure we do a cleanup and this cleanup can overwrite
root cause. Thus let's save root cause immediately and then set it to
virsh error after all cleanup is done.

Since we'll be sending the error to the consumer, each failure path from
the event handlers needs to be augmented to provide what error generated
the failure.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agotools: console: check if console was shutdown in callbacks
Nikolay Shirokovskiy [Mon, 25 Feb 2019 14:10:01 +0000 (17:10 +0300)]
tools: console: check if console was shutdown in callbacks

On error in main thread virConsoleShutdown is called which
deletes fd watches/stream callback and yet callbacks can
be called after. Thus we can incorrectly allocate
terminalToStream.data memory and get memory leak for example.
Let's check if console was shutdown in the very beginning of
callbacks.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agotools: console: add missing locks in callbacks
Nikolay Shirokovskiy [Mon, 25 Feb 2019 14:05:01 +0000 (17:05 +0300)]
tools: console: add missing locks in callbacks

Stream/fd callbacks accessing console object are called from the
event loop thread and the console object is also accessed from
the main thread so we are better add locking to handlers.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agotools: console: cleanup console on errors in main thread
Nikolay Shirokovskiy [Mon, 18 Mar 2019 08:57:56 +0000 (11:57 +0300)]
tools: console: cleanup console on errors in main thread

We only check now for virObjectWait failures in virshRunConsole but
we'd better check and for other failures too. And we need to shutdown
console on error in the main thread.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agotools: console: make console virLockableObject
Nikolay Shirokovskiy [Mon, 18 Mar 2019 08:53:06 +0000 (11:53 +0300)]
tools: console: make console virLockableObject

We need to turn console into virObject object because stream/fd callbacks
can be called from the event loop thread after freeing console
in main thread. It is convinient to turn into virLockableObject as
we have mutex in console object.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agoqemu: Don't duplicate suspend events and state changes
Nikolay Shirokovskiy [Fri, 8 Feb 2019 07:36:56 +0000 (10:36 +0300)]
qemu: Don't duplicate suspend events and state changes

Since the STOP event handler can use the pausedReason as sent to
qemuProcessStopCPUs, we no longer need to send duplicate suspended
lifecycle events because we know what caused the stop along with extra
details. This processing allows us to also remove the duplicated state
change from qemuProcessStopCPUs.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agoqemu: Map suspended state reason to suspended event detail
Nikolay Shirokovskiy [Tue, 9 Oct 2018 13:45:50 +0000 (16:45 +0300)]
qemu: Map suspended state reason to suspended event detail

Map is based on existing cases in code where we send suspended
event after changing domain state to paused.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agoqemu: Pass stop reason from qemuProcessStopCPUs to stop handler
Nikolay Shirokovskiy [Tue, 9 Oct 2018 13:41:51 +0000 (16:41 +0300)]
qemu: Pass stop reason from qemuProcessStopCPUs to stop handler

Similar to commit [1] which saves and passes the running reason to
the RESUME event handler, during qemuProcessStopCPUs let's save and pass
the pause reason in the domain private data so that the STOP event
handler can use it.

[1] 5dab984ed : qemu: Pass running reason to RESUME event handler

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agovirNWFilterBindingObjListAddLocked: Produce better error message than 'Duplicate...
Michal Privoznik [Tue, 19 Mar 2019 13:39:20 +0000 (14:39 +0100)]
virNWFilterBindingObjListAddLocked: Produce better error message than 'Duplicate key'

If there are two concurrent threads, one of which is removing an
nwfilter from the list and the other is trying to add it back they
may serialize in the following order:

1) obj->removing is set and @obj is unlocked.
2) The tread that's trying to add the nwfilter onto the list locks
   the list and tries to find, if the nwfilter already exists.
3) Our lookup functions say it doesn't, so the thread proceeds to
   virHashAddEntry() which fails with 'Duplicate key' error.

This is obviously not helpful error message at all.

The problem lies in our lookup function
(virNWFilterBindingObjListFindByPortDevLocked()) which return
NULL even if the object is still on the list. They do this so
that the object is not mistakenly looked up by some API. The fix
consists of moving 'removing' check one level up and thus
allowing virNWFilterBindingObjListAddLocked() to produce
meaningful error message.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
6 years agovirDomainObjListAddLocked: Produce better error message than 'Duplicate key'
Michal Privoznik [Tue, 19 Mar 2019 12:26:21 +0000 (13:26 +0100)]
virDomainObjListAddLocked: Produce better error message than 'Duplicate key'

If there are two concurrent threads, one of which is removing a
domain from the list and the other is trying to add it back they
may serialize in the following order:

1) vm->removing is set and @vm is unlocked.
2) The tread that's trying to add the domain onto the list locks
   the list and tries to find, if the domain already exists.
3) Our lookup functions say it doesn't, so the thread proceeds to
   virHashAddEntry() which fails with 'Duplicate key' error.

This is obviously not helpful error message at all.

The problem lies in our lookup functions
(virDomainObjListFindByUUIDLocked() and
virDomainObjListFindByNameLocked()) which return NULL even if the
object is still on the list. They do this so that the object is
not mistakenly looked up by some driver. The fix consists of
moving 'removing' check one level up and thus allowing
virDomainObjListAddLocked() to produce meaningful error message.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
6 years agovirsh.pod: Improve native configuration format doc
Han Han [Thu, 28 Mar 2019 04:06:46 +0000 (12:06 +0800)]
virsh.pod: Improve native configuration format doc

Add native guest format of BSD hypervisor and VMware/ESX. Quote native
guest format of domxml-from-native for domxml-to-native.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Han Han <hhan@redhat.com>
6 years agoutil: Remove virParseNumber
Peter Krempa [Mon, 1 Apr 2019 15:45:46 +0000 (17:45 +0200)]
util: Remove virParseNumber

We have more modern replacements.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agorpc: ssh: Use virStrToLong_i instead of virParseNumber
Peter Krempa [Mon, 1 Apr 2019 15:25:04 +0000 (17:25 +0200)]
rpc: ssh: Use virStrToLong_i instead of virParseNumber

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agovmx: Refactor number parsing in virVMXParseConfig
Peter Krempa [Mon, 1 Apr 2019 15:43:20 +0000 (17:43 +0200)]
vmx: Refactor number parsing in virVMXParseConfig

Parsing of the cpu affinity list was using virParseNumber. Modernize it
to get rid of the virParseNumber call.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agovmx: Remove unused variable in virVMXParseConfig
Peter Krempa [Mon, 1 Apr 2019 15:23:16 +0000 (17:23 +0200)]
vmx: Remove unused variable in virVMXParseConfig

'cpumasklen' is only written to since ee7d23ba4b4d487f8ac078c66b74.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Remove virPipeReadUntilEOF
Peter Krempa [Mon, 1 Apr 2019 16:35:15 +0000 (18:35 +0200)]
util: Remove virPipeReadUntilEOF

Unused since 3c269b51a6f03a1a678e8d

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemuBuildMemoryBackendProps: Get pagesize early
Michal Privoznik [Fri, 29 Mar 2019 15:21:28 +0000 (16:21 +0100)]
qemuBuildMemoryBackendProps: Get pagesize early

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

Up until memfd introduction (in 24b74d187ca) we did not need to
know @pagesize because qemuGetDomainHupageMemPath() could deal
with it being zero (value of zero means use the default hugetlbfs
mount). But since for memfd we are not passing a path to
hugetlbfs mount rather the page size value we need to know its
value upfront.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agovirfile: Introduce and use virFileGetDefaultHugepage
Michal Privoznik [Fri, 29 Mar 2019 15:10:09 +0000 (16:10 +0100)]
virfile: Introduce and use virFileGetDefaultHugepage

This helper returns the default hugetlbfs mount point from given
array of mount points.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemuxml2xmltest: Add memfd tests
Michal Privoznik [Fri, 29 Mar 2019 15:58:23 +0000 (16:58 +0100)]
qemuxml2xmltest: Add memfd tests

Somehow, these were not tested. Use symlinks to point expected
output back to the input. This way we can also fix some
discrepancies in the input XMLs.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemuxml2xmltest: Move virObjectUnref() call
Michal Privoznik [Fri, 29 Mar 2019 15:33:51 +0000 (16:33 +0100)]
qemuxml2xmltest: Move virObjectUnref() call

The current location looks very arbitrary. Move it to the end of
the mymain() function so it is less confusing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemuxml2argvdata: Drop useless spaces at the beginning of lines
Michal Privoznik [Fri, 29 Mar 2019 15:30:04 +0000 (16:30 +0100)]
qemuxml2argvdata: Drop useless spaces at the beginning of lines

There are three test XMLs that have useless spaces at the
beginning of each line. I intend to add these to qemuxml2xmltest
and make xmlout a symlink to the original XML. In order to do
that the XMLs must look better than they do now.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agomingw: Bump minimum supported Fedora version to 28
Andrea Bolognani [Wed, 3 Apr 2019 13:45:53 +0000 (15:45 +0200)]
mingw: Bump minimum supported Fedora version to 28

Should have been part of 2569ba133822, but clearly wasn't.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agomingw: unconditionally enable libssh2 in RPM
Daniel P. Berrangé [Wed, 3 Apr 2019 10:17:06 +0000 (11:17 +0100)]
mingw: unconditionally enable libssh2 in RPM

The libssh2 support in libvirt is not solely for phyp, it is used by the
remote driver too.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agomingw: remove obsolete Group tag in RPM spec
Daniel P. Berrangé [Wed, 3 Apr 2019 10:15:33 +0000 (11:15 +0100)]
mingw: remove obsolete Group tag in RPM spec

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agovirjson: drop compatibility macros
Ján Tomko [Wed, 3 Apr 2019 12:24:25 +0000 (14:24 +0200)]
virjson: drop compatibility macros

Since commit 66460e3 dropped support for YAJL 1, we no longer need
these.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
6 years agovirjsontest: switch DO_TEST_PARSE_FILE to use output files
Ján Tomko [Fri, 1 Jun 2018 11:10:11 +0000 (13:10 +0200)]
virjsontest: switch DO_TEST_PARSE_FILE to use output files

Also switch the expected output of DO_TEST_PARSE_FILE to be
in a file, now that we demonstrated the input files match
the expected string representation.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirjsontest: introduce DO_TEST_PARSE_FILE
Ján Tomko [Fri, 1 Jun 2018 11:06:30 +0000 (13:06 +0200)]
virjsontest: introduce DO_TEST_PARSE_FILE

Introduce a new macro DO_TEST_PARSE_FILE which takes the input JSON
from a file instead of a C string.

This lets us get rid of quote escaping and makes the JSON easier to
edit.

The output JSON is still taken from a string and will be moved
separately.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirjsontest: remove unnecessary cleanup labels
Ján Tomko [Tue, 2 Apr 2019 14:21:57 +0000 (16:21 +0200)]
virjsontest: remove unnecessary cleanup labels

Now that cleanup is handled automatically, we can use 'return' more
often.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirjsontest: use VIR_AUTOFREE for strings
Ján Tomko [Wed, 3 Apr 2019 12:40:52 +0000 (14:40 +0200)]
virjsontest: use VIR_AUTOFREE for strings

The only remaining use of VIR_FREE is for reusing variables.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirjsontest: use VIR_AUTOPTR for virJSONValues
Ján Tomko [Tue, 2 Apr 2019 14:14:13 +0000 (16:14 +0200)]
virjsontest: use VIR_AUTOPTR for virJSONValues

Remove all explicit usage of virJSONValueFree.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirjsontest: reword error messages in testJSONFromString
Ján Tomko [Tue, 2 Apr 2019 14:07:01 +0000 (16:07 +0200)]
virjsontest: reword error messages in testJSONFromString

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agotestJSONFromString: regroup if blocks
Ján Tomko [Tue, 2 Apr 2019 14:06:52 +0000 (16:06 +0200)]
testJSONFromString: regroup if blocks

Handle failure to parse the JSON in an else branch for readability.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirjsontest: switch AddAndRemove tests to work with files
Ján Tomko [Fri, 1 Jun 2018 07:05:23 +0000 (09:05 +0200)]
virjsontest: switch AddAndRemove tests to work with files

Instead of using JSON in C strings, put it in separate files
for easier manipulation.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agorbd: fix build with LIBRBD_VERSION_CODE <= 265
Ján Tomko [Wed, 3 Apr 2019 11:14:55 +0000 (13:14 +0200)]
rbd: fix build with LIBRBD_VERSION_CODE <= 265

Add ATTRIBUTE_UNUSED to the volStorageBackendRBDGetFlags stub.

Fixes: 21deeaf02fdf216b08210fc899579736973ca81d
Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoconfigure.ac: add foreign to AM_INIT_AUTOMAKE
Ján Tomko [Wed, 3 Apr 2019 00:29:03 +0000 (02:29 +0200)]
configure.ac: add foreign to AM_INIT_AUTOMAKE

We do not care about the portability warnings implied by the implicit
'gnu' option. Switch to 'foreign' to opt out of checking the files
present in the top directory to let us drop ChangeLog completely.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>