]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
7 years agosecurity/: Remove spaces after casts
Martin Kletzander [Wed, 25 Apr 2018 12:42:34 +0000 (14:42 +0200)]
security/: Remove spaces after casts

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agorpc/: Remove spaces after casts
Martin Kletzander [Wed, 25 Apr 2018 12:42:34 +0000 (14:42 +0200)]
rpc/: Remove spaces after casts

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu/: Remove spaces after casts
Martin Kletzander [Wed, 25 Apr 2018 12:42:34 +0000 (14:42 +0200)]
qemu/: Remove spaces after casts

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agophyp/: Remove spaces after casts
Martin Kletzander [Wed, 25 Apr 2018 12:42:34 +0000 (14:42 +0200)]
phyp/: Remove spaces after casts

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agonwfilter/: Remove spaces after casts
Martin Kletzander [Wed, 25 Apr 2018 12:42:34 +0000 (14:42 +0200)]
nwfilter/: Remove spaces after casts

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agonetwork/: Remove spaces after casts
Martin Kletzander [Wed, 25 Apr 2018 12:42:34 +0000 (14:42 +0200)]
network/: Remove spaces after casts

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agolxc/: Remove spaces after casts
Martin Kletzander [Wed, 25 Apr 2018 12:42:34 +0000 (14:42 +0200)]
lxc/: Remove spaces after casts

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agohyperv/: Remove spaces after casts
Martin Kletzander [Wed, 25 Apr 2018 12:42:33 +0000 (14:42 +0200)]
hyperv/: Remove spaces after casts

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoesx/: Remove spaces after casts
Martin Kletzander [Wed, 25 Apr 2018 12:42:33 +0000 (14:42 +0200)]
esx/: Remove spaces after casts

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoaccess/: Remove spaces after casts
Martin Kletzander [Wed, 25 Apr 2018 12:42:33 +0000 (14:42 +0200)]
access/: Remove spaces after casts

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agotests: Drop DO_TEST_LINUX()
Andrea Bolognani [Wed, 2 May 2018 15:37:59 +0000 (17:37 +0200)]
tests: Drop DO_TEST_LINUX()

Now that mocking NUMA information works on FreeBSD, there are
no longer any test cases that need to be restricted to Linux
only.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotests: Extend NUMA mocking
Andrea Bolognani [Wed, 2 May 2018 15:35:21 +0000 (17:35 +0200)]
tests: Extend NUMA mocking

While the current amount of mocking works just fine on most of
our target platforms, it somehow causes issues when using Clang
on FreeBSD.

Work around the issue by mocking a couple more functions. It's
not pretty, but it makes qemuxml2argvtest pass on FreeBSD at
long last.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotests: Build virpcimock on FreeBSD too
Andrea Bolognani [Mon, 30 Apr 2018 14:04:39 +0000 (16:04 +0200)]
tests: Build virpcimock on FreeBSD too

There are only a couple remaining issues preventing it from
working on FreeBSD. Let's fix them.

With the mocking in place, qemumemlocktest and qemuxml2xmltest
can finally succeed on FreeBSD.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotests: Fix mode_t usage with va_arg()
Andrea Bolognani [Mon, 30 Apr 2018 15:30:12 +0000 (17:30 +0200)]
tests: Fix mode_t usage with va_arg()

Clang complains about it:

  error: second argument to 'va_arg' is of promotable type
  'mode_t' (aka 'unsigned short'); this va_arg has undefined
  behavior because arguments will be promoted to 'int'
  [-Werror,-Wvarargs]

    mode = va_arg(ap, mode_t);
                      ^~~~~~

Work around the issue by passing int to va_arg() and casting
its return value to mode_t afterwards.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agosyntax-check: Prohibit canonicalize_file_name()
Andrea Bolognani [Mon, 30 Apr 2018 14:55:57 +0000 (16:55 +0200)]
syntax-check: Prohibit canonicalize_file_name()

We want to make sure our wrapper is used instead in order
to keep the test suite working.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotests: Stop mocking canonicalize_file_name()
Andrea Bolognani [Mon, 30 Apr 2018 15:23:08 +0000 (17:23 +0200)]
tests: Stop mocking canonicalize_file_name()

We're using virFileCanonicalizePath() everywhere now, so
mocking this function has become entirely pointless.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoall: Use virFileCanonicalizePath() instead of canonicalize_file_name()
Andrea Bolognani [Thu, 3 May 2018 08:04:38 +0000 (10:04 +0200)]
all: Use virFileCanonicalizePath() instead of canonicalize_file_name()

The latter is impossible to mock on platforms that use the
gnulib implementation, such as FreeBSD, while the former
doesn't suffer from this limitation.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotests: Mock virFileCanonicalizePath()
Andrea Bolognani [Thu, 3 May 2018 08:01:04 +0000 (10:01 +0200)]
tests: Mock virFileCanonicalizePath()

We're going to need this later on.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoutil: Introduce virFileCanonicalizePath()
Andrea Bolognani [Thu, 3 May 2018 07:55:19 +0000 (09:55 +0200)]
util: Introduce virFileCanonicalizePath()

It's a trivial wrapper around canonicalize_file_name(),
which we need in order to fully mock file access on non-Linux
platforms.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoconfigure: remove bogus LIBVIRT_GETTEXT macro reference
Daniel P. Berrangé [Thu, 3 May 2018 16:04:41 +0000 (17:04 +0100)]
configure: remove bogus LIBVIRT_GETTEXT macro reference

The LIBVIRT_GETTEXT macro was an artifact of patch development and
was later renamed to LIBVIRT_CHECK_NLS. This cruft causes configure
to print out

./configure: line 75084: LIBVIRT_GETTEXT: command not found

but fortunately this is non-fatal

Reported-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agonwfilter: pass vm name in when instantiating filters
Daniel P. Berrangé [Fri, 27 Apr 2018 13:28:11 +0000 (14:28 +0100)]
nwfilter: pass vm name in when instantiating filters

The vm name is not needed for any functional requirement, but it will be
useful when debugging problems to identify which VM is associated with a
filter, since UUID is not human friendly.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agonwfilter: introduce virNWFilterBinding to decouple from virDomainNet
Daniel P. Berrangé [Thu, 26 Apr 2018 11:26:51 +0000 (12:26 +0100)]
nwfilter: introduce virNWFilterBinding to decouple from virDomainNet

The virDomainNet struct contains everything related to configuring a
guest network device. Out of all of this info, only 5 fields are
relevant to configuring network filters. It will be more convenient for
future changes to the nwfilter driver if the relevant fields are kept in
a dedicated struct. Thus the virNWFilterBinding struct is created to
track this information.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agonwfilter: fix leaking of filter parameters upon error
Daniel P. Berrangé [Thu, 26 Apr 2018 16:52:13 +0000 (17:52 +0100)]
nwfilter: fix leaking of filter parameters upon error

The filter parameters were not correctly free'd when an error hits while
adding to the hash table.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agonwfilter: remove obsolete code related to firewalld
Daniel P. Berrangé [Thu, 26 Apr 2018 12:30:33 +0000 (13:30 +0100)]
nwfilter: remove obsolete code related to firewalld

There is a bunch of left over code in the nwfilter driver related to
monitoring firewalld over dbus, that is no longer used since the
conversion to use virFirewall APIs.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agonwfilter: make virNWFilterIPAddrLearnReq type private
Daniel P. Berrangé [Thu, 26 Apr 2018 11:31:06 +0000 (12:31 +0100)]
nwfilter: make virNWFilterIPAddrLearnReq type private

The virNWFilterIPAddrLearnReq type should only be used by the IP address
learning code, so can live in the implementation file instead of header
file.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agonwfilter: change methods returning virNWFilterIPAddrLearnReq to use bool
Daniel P. Berrangé [Thu, 26 Apr 2018 11:31:06 +0000 (12:31 +0100)]
nwfilter: change methods returning virNWFilterIPAddrLearnReq to use bool

Various methods return a virNWFilterIPAddrLearnReq struct, but the
callers are only interested in whether the return value is non-NULL.
It is thus preferrable to just return a bool.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agonwfilter: remove virNWFilterHashTable typedefs entirely
Daniel P. Berrangé [Thu, 26 Apr 2018 11:16:09 +0000 (12:16 +0100)]
nwfilter: remove virNWFilterHashTable typedefs entirely

All the code now just uses the virHashTablePtr type directly.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agonwfilter: remove methods that are trivial wrappers for virHash APIs
Daniel P. Berrangé [Thu, 26 Apr 2018 11:09:18 +0000 (12:09 +0100)]
nwfilter: remove methods that are trivial wrappers for virHash APIs

This removes the virNWFilterHashTableFree, virNWFilterHashTablePut
and virNWFilterHashTableRemove methods, in favour of just calling
the virHash APIs directly.

The virNWFilterHashTablePut method was unreasonably complex because
the virHashUpdateEntry already knows how to create the entry if it
does not currently exist.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agonwfilter: remove pointless virNWFilterHashTable struct
Daniel P. Berrangé [Thu, 26 Apr 2018 10:51:28 +0000 (11:51 +0100)]
nwfilter: remove pointless virNWFilterHashTable struct

The virNWFilterHashTable struct only contains a single virHashTable
member since

  commit 293d4fe2f11db98c91175525056c8883725d4b22
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Mon Mar 24 16:35:23 2014 +0000

    Remove pointless storage of var names in virNWFilterHashTable

Thus, this struct wrapper adds no real value over just using the
virHashTable directly, but brings the complexity of needing to derefence
the hashtable to call virHash* APIs, and adds extra memory allocation
step.

To minimize code churn this just turns virNWFilterHashTable into a
typedef aliases virHashTable.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoqemu: Add tpm-crb QEMU device to the command line
Stefan Berger [Thu, 26 Apr 2018 17:42:18 +0000 (13:42 -0400)]
qemu: Add tpm-crb QEMU device to the command line

Alter qemuBuildTPMDevStr to format the tpm-crb on the command line
and use the enum range checking for valid model.

Add a test case for the formation of the tpm-crb QEMU device
command line. The qemuxml2argvtest changes cannot use the newer
DO_TEST_CAPS_LATEST since building of the command line involves
calling qemuBuildTPMBackendStr which attempts to open the
path to the device (e.g. /dev/tmp0).

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Extend the capabilities with tpm-crb device
Stefan Berger [Thu, 26 Apr 2018 17:42:17 +0000 (13:42 -0400)]
qemu: Extend the capabilities with tpm-crb device

QEMU on x86_64 (since v2.12) can support tpm-crb devices.
Introduce qemu capabilities for this device.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoconf: Enable TPM CRB interface in the domain XML
Stefan Berger [Thu, 26 Apr 2018 17:42:16 +0000 (13:42 -0400)]
conf: Enable TPM CRB interface in the domain XML

Enable the TPM CRB to be specified in the domain XML. This
now allows to describe the TPM device like this:

  <tpm model='tpm-crb'>
    <backend type='passthrough'>
      <device path='/dev/tpm0'/>
    </backend>
  </tpm>

Extend the XML schema to also allow tpm-crb.
Extend the documentation.
Add a test case for testing the XML parser and formatter.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agotest: avoid slash characters to the new domain name.
Julio Faracco [Tue, 1 May 2018 15:56:09 +0000 (12:56 -0300)]
test: avoid slash characters to the new domain name.

As QEMU driver, test driver does not accept slashes inside domain names.
This commit fixes this problem checking slashes inside the new name when
'domrename' is executed.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: avoid slash characters to the new domain name.
Julio Faracco [Tue, 1 May 2018 15:56:08 +0000 (12:56 -0300)]
qemu: avoid slash characters to the new domain name.

The 'domrename' command needs to check if the new domain name contains
the slash character. This character is not accepted by libvirt XML
definition because it is an invalid char (see Cole's commit b1fc6a7b7).
This commit enhace the 'domrename' command adding this check.

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

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agostoragefile: conditional build of virStorageFileLoadBackendModule
Daniel P. Berrangé [Thu, 3 May 2018 14:42:59 +0000 (15:42 +0100)]
storagefile: conditional build of virStorageFileLoadBackendModule

The virStorageFileLoadBackendModule method is only used if either
fs or gluster storage is built in, which doesn't happen on mingw
leading to warning of an unused static function.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotests: unlink libxl-driver.log
Daniel P. Berrangé [Thu, 3 May 2018 13:26:08 +0000 (14:26 +0100)]
tests: unlink libxl-driver.log

The libxlxml2domconfigtest causes a libxl-driver.log file to be created
which breaks make distchck if libxl is enabled. Delete the log file at
the end of the test.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agostorage: create separate loadable modules for storage file drivers
Daniel P. Berrangé [Wed, 25 Apr 2018 13:37:07 +0000 (14:37 +0100)]
storage: create separate loadable modules for storage file drivers

The storage file drivers are currently loaded as a side effect of
loading the storage driver. This is a bogus dependancy because the
storage file code has no interaction with the storage drivers, and
even ultimately be running in a completely separate daemon.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoutil: refactor storage file checks to allow error reporting
Daniel P. Berrangé [Wed, 25 Apr 2018 13:09:24 +0000 (14:09 +0100)]
util: refactor storage file checks to allow error reporting

The virStorageFileSupportsSecurityDriver and
virStorageFileSupportsAccess currently just return a boolean
value. This is ok because they don't have any failure scenarios
but a subsequent patch is going to introduce potential failure
scenario. This changes their return type from a boolean to an
int with values -1, 0, 1.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoutil: fix virStorageFileGetBackingStoreStr error handling
Daniel P. Berrangé [Wed, 25 Apr 2018 11:50:27 +0000 (12:50 +0100)]
util: fix virStorageFileGetBackingStoreStr error handling

The virStorageFileGetBackingStoreStr method has overloaded the NULL
return value to indicate both no backing available and a fatal
error dealing with it.

The caller is thus not able to correctly propagate the error
messages.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agostorage: split fs storage file code from storage driver backend
Daniel P. Berrangé [Wed, 25 Apr 2018 09:17:13 +0000 (10:17 +0100)]
storage: split fs storage file code from storage driver backend

The storage file code needs to be run in the hypervisor drivers, while
the storage backend code needs to be run in the storage driver. Split
the source code as a preparatory step for creating separate loadable
modules.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agostorage: remove unused imports of libxml headers
Daniel P. Berrangé [Thu, 3 May 2018 11:49:57 +0000 (12:49 +0100)]
storage: remove unused imports of libxml headers

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agostorage: split gluster storage file code from storage driver backend
Daniel P. Berrangé [Wed, 25 Apr 2018 09:17:13 +0000 (10:17 +0100)]
storage: split gluster storage file code from storage driver backend

The storage file code needs to be run in the hypervisor drivers, while
the storage backend code needs to be run in the storage driver. Split
the source code as a preparatory step for creating separate loadable
modules.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoutil: create new virmodule.{c,h} files for dlopen support code
Daniel P. Berrangé [Wed, 25 Apr 2018 14:35:27 +0000 (15:35 +0100)]
util: create new virmodule.{c,h} files for dlopen support code

The driver.{c,h} files are primarily targetted at loading hypervisor
drivers and some helper functions in that area. It also, however,
contains a generically useful function for loading extension modules
that is called by the storage driver. Split that functionality off
into a new virmodule.{c,h} file to isolate it.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agodocs: Grammar and spelling fixes
Ville Skyttä [Thu, 3 May 2018 11:14:19 +0000 (13:14 +0200)]
docs: Grammar and spelling fixes

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
7 years agorpm: set wireshark plugin directory from pkg-config
Daniel P. Berrangé [Thu, 3 May 2018 11:17:31 +0000 (12:17 +0100)]
rpm: set wireshark plugin directory from pkg-config

The wireshark plugin directory moved again in Fedora 29, and will
move again every time wireshark do a new minor release. Call out
to pkg-config to find the right directory to use in the RPM file
list.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agorpm: libvirt-daemon-driver-libxl must obsolete libvirt-daemon-driver-xen
Daniel P. Berrangé [Thu, 3 May 2018 10:18:42 +0000 (11:18 +0100)]
rpm: libvirt-daemon-driver-libxl must obsolete libvirt-daemon-driver-xen

Snce the xen driver was deleted we need to ensure that the old
libvirt-daemon-driver-xen sub-RPM gets removed on upgrade. We
achieve this my making libvirt-daemon-driver-libxl obsolete it.

We don't add a Provides: too, because libvirt-daemon-driver-libxl
is not a functionally identical replacement, since we don't want
to satisfy deps for 3rd party apps that have a Requires on the
libvirt-daemon-driver-xen RPM.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotests/Makefile.am: use LIBTOOL variable instead of hardcoded name
Maciej Wolny [Wed, 2 May 2018 16:54:08 +0000 (17:54 +0100)]
tests/Makefile.am: use LIBTOOL variable instead of hardcoded name

Fixes "can't find libtool" error when running valgrind checks.

Signed-off-by: Maciej Wolny <maciej.wolny@codethink.co.uk>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agoconf: remove unused VIR_DOMAIN_FS_RAM_DEFAULT_USAGE
Ján Tomko [Wed, 2 May 2018 12:37:51 +0000 (14:37 +0200)]
conf: remove unused VIR_DOMAIN_FS_RAM_DEFAULT_USAGE

Unused since its introduction in commit <76b644c>.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agodocs: schema: Add missing <interleave> element to panic device
Erik Skultety [Wed, 2 May 2018 11:54:55 +0000 (13:54 +0200)]
docs: schema: Add missing <interleave> element to panic device

Panic device has 2 optional sub-elements - <alias> and <address> the
order of which should be interchangeable in the XML.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agoMakefile: fix typo
Ján Tomko [Sat, 31 Mar 2018 13:21:38 +0000 (15:21 +0200)]
Makefile: fix typo

s/atttribute/attribute/

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agoPost-release version bump to 4.4.0
Ján Tomko [Wed, 2 May 2018 12:34:15 +0000 (14:34 +0200)]
Post-release version bump to 4.4.0

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agoRelease of libvirt-4.3.0
Daniel Veillard [Wed, 2 May 2018 12:23:26 +0000 (14:23 +0200)]
Release of libvirt-4.3.0

* docs/news.xml: updated for the release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
7 years agonews: Mention changes TLS non-shared-storage migration
Peter Krempa [Wed, 2 May 2018 07:42:12 +0000 (09:42 +0200)]
news: Mention changes TLS non-shared-storage migration

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu: migration: Use TLS environment for NBD server if requested
Peter Krempa [Wed, 21 Feb 2018 15:55:15 +0000 (16:55 +0100)]
qemu: migration: Use TLS environment for NBD server if requested

Use the TLS env for migration when starting the NBD server if TLS is
enabled for migration.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoqemu: monitor: Add 'tls-creds' parameter to 'nbd-server-start' command
Peter Krempa [Wed, 21 Feb 2018 13:18:15 +0000 (14:18 +0100)]
qemu: monitor: Add 'tls-creds' parameter to 'nbd-server-start' command

To allow encryption of the non-shared storage migration NBD connection
we will need to instantiated the NBD server with the TLS env.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoqemu: caps: Add capability for TLS transport in the NBD server
Peter Krempa [Thu, 26 Apr 2018 11:11:05 +0000 (13:11 +0200)]
qemu: caps: Add capability for TLS transport in the NBD server

The NBD server in qemu supports TLS transport. Detect this capability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoqemu: migration: Don't crash on access to 'current' job
Peter Krempa [Fri, 27 Apr 2018 14:20:15 +0000 (16:20 +0200)]
qemu: migration: Don't crash on access to 'current' job

When a VM is destroyed while being migrated (waiting in
qemuMigrationSrcWaitForCompletion) the private object cleanup code frees
the 'current' job info. Since the migration code attempts to setup
various aspects of the current job even on failure this results into a
crash.

Job data is cleared in qemuDomainObjPrivateDataClear since commit
888aa4b6b9db

Fix this by skipping all of the code which requires the qemu process to
be alive if the VM is not active any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 years agopo: delete bogus translations from various languages
Daniel P. Berrangé [Tue, 24 Apr 2018 15:11:30 +0000 (16:11 +0100)]
po: delete bogus translations from various languages

For unknown reasons about 21 languages had the same 212 msgid entries
copied into the msgstr field without having any translation applied.
This bogus non-translated data has now been purged from Zanata.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoRefresh translations to drop unused strings
Daniel P. Berrangé [Mon, 23 Apr 2018 16:46:18 +0000 (17:46 +0100)]
Refresh translations to drop unused strings

Refresh transaltion po files to drop msgid/msgstr entries that are no
longer required due to deletion/refactoring of source code.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoqemu: migration: Forbid 'nbd' migration of non-shared storage if TLS is requested
Peter Krempa [Thu, 26 Apr 2018 13:44:26 +0000 (15:44 +0200)]
qemu: migration: Forbid 'nbd' migration of non-shared storage if TLS is requested

Since libvirt is currently not able to setup the NBD migration stream
secured by TLS we should not allow such migration since data would be
transferred unencrypted.

This will break compatibility of TLS migration if non-shared storage is
requested but the security implications are more severe.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agonwfilter: increase pcap buffer size to be compatible with TPACKET_V3
Laine Stump [Wed, 25 Apr 2018 21:12:03 +0000 (17:12 -0400)]
nwfilter: increase pcap buffer size to be compatible with TPACKET_V3

When an nwfilter rule sets the parameter CTRL_IP_LEARNING to "dhcp",
this turns on the "dhcpsnoop" thread, which uses libpcap to monitor
traffic on the domain's tap device and extract the IP address from the
DHCP response.

If libpcap on the host is built with HAVE_TPACKET3 defined (to enable
support for TPACKET_V3), the dhcpsnoop code's initialization of the
libpcap socket would fail with the following error:

  virNWFilterSnoopDHCPOpen:1134 : internal error: pcap_setfilter: can't remove kernel filter: Bad file descriptor

It turns out that this was because TPACKET_V3 requires a larger buffer
size than libvirt was setting (we were setting it to 128k). Changing
the buffer size to 256k eliminates the error, and the dhcpsnoop thread
once again works properly.

A fuller explanation of why TPACKET_V3 requires such a large buffer,
for future git spelunkers:

libpcap calls setsockopt(... SOL_PACKET, PACKET_RX_RING...) to setup a
ring buffer for receiving packets; two of the attributes sent to this
API are called tp_frame_size, and tp_frame_nr. If libpcap was built
with HAVE_TPACKET3 defined, tp_trame_size is set to MAXIMUM_SNAPLEN
(defined in libpcap sources as 262144) and tp_frame_nr is set to:

 [the buffer size we set, i.e. PCAP_BUFFERSIZE i.e. 262144] / tp_frame_size.

So if PCAP_BUFFERSIZE < MAXIMUM_SNAPLEN, then tp_frame_nr (the number
of frames in the ring buffer) is 0, which is nonsensical. This same
value is later used as a multiplier to determine the size for a call
to malloc() (which would also fail).

(NB: if HAVE_TPACKET3 is *not* defined, then tp_frame_size is set to
the snaplen set by the user (in our case 576) plus a small amount to
account for ethernet headers, so 256k is far more than adequate)

Since the TPACKET_V3 code in libpcap actually reads multiple packets
into each frame, it's not a problem to have only a single frame
(especially when we are monitoring such infrequent traffic), so it's
okay to set this relatively small buffer size (in comparison to the
default, which is 2MB), which is important since every guest using
dhcp snooping in a nwfilter rule will hold 2 of these buffers for the
entire life of the guest.

Thanks to Christian Ehrhardt for discovering that buffer size was the
problem (this was not at all obvious from the error that was logged!)

Resolves: https://bugzilla.redhat.com/1547237
Fixes: https://bugs.launchpad.net/libvirt/+bug/1758037
Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com> (V1)
Reviewed-by: John Ferlan <jferlan@redhat.com>
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agoRevert "news: Update the news file with the log filter wildcard improvement"
Daniel P. Berrangé [Fri, 27 Apr 2018 15:27:26 +0000 (16:27 +0100)]
Revert "news: Update the news file with the log filter wildcard improvement"

This reverts commit 209d4d6f42a01829c68ef54b042a0c53ef0b22d3.

The wildcard feature has been temporarily removed pending re-impl.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoRevert "util: virlog: Introduce wildcard to log filters"
Daniel P. Berrangé [Fri, 20 Apr 2018 11:57:33 +0000 (12:57 +0100)]
Revert "util: virlog: Introduce wildcard to log filters"

This reverts commit 8daa593b0741452a78daea76075254ae7d3c6ab6.

There are two undesirable aspects to the impl

  - Only a bare wildcard is permitted
  - The wildcard match is not performed in the order listed

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoqemu: migration: Set the 'set' boolean in qemuMigrationParamsSetString
Peter Krempa [Fri, 27 Apr 2018 11:17:17 +0000 (13:17 +0200)]
qemu: migration: Set the 'set' boolean in qemuMigrationParamsSetString

The code setting TLS parameters verifies that TLS is supported by
looking at the dump of parameters which will be reset after migration,
but sets the parameters in the list of new parameters. As
qemuMigrationParamsSetString did not set the 'set' property, the TLS
parameters would not be used.

This is a regression after the series refactoring migration parameters
and it resulted into TLS not being used even when requested.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu: migration: Move and unexport qemuMigrationParamsSetString
Peter Krempa [Fri, 27 Apr 2018 10:59:00 +0000 (12:59 +0200)]
qemu: migration: Move and unexport qemuMigrationParamsSetString

The function is not used outside of the src/qemu/qemu_migration_params.c
file so unexport it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agologging: Don't inhibit shutdown in system daemon
Martin Kletzander [Thu, 26 Apr 2018 10:17:03 +0000 (12:17 +0200)]
logging: Don't inhibit shutdown in system daemon

That is a job of libvirtd and virtlogd has a dependency on it, so that will
prevent it properly.  Doing it one extra time in virtlogd might also cause AVC
denials because it is not allowed to call that dbus method.

Caused by commit df34363d58bb.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agosyntax-check: pass srcdir to group-qemu-caps.pl
Ján Tomko [Thu, 26 Apr 2018 11:17:41 +0000 (13:17 +0200)]
syntax-check: pass srcdir to group-qemu-caps.pl

The script assumed to be run in the source directory.
Pass top_srcdir as the argument to fix VPATH builds.

My commit 81a7571 broke this.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agosyntax-check: check QEMU caps grouping
Ján Tomko [Thu, 12 Apr 2018 06:16:12 +0000 (08:16 +0200)]
syntax-check: check QEMU caps grouping

Introduce a perl script that is able to regroup both
the QEMU_CAPS constants and the capability strings.

Check correct grouping as a part of syntax check.

For in-place regrouping after a rebase, just run:
  tests/group-qemu-caps.pl
without any parameters.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoremote: disable unused function on win32 platform build
Daniel P. Berrangé [Tue, 24 Apr 2018 18:30:16 +0000 (19:30 +0100)]
remote: disable unused function on win32 platform build

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoutil: improve virNetDevTapGetRealDeviceName
Roman Bogorodskiy [Sun, 8 Apr 2018 15:30:29 +0000 (19:30 +0400)]
util: improve virNetDevTapGetRealDeviceName

virNetDevTapGetRealDeviceName() is used on FreeBSD because interface
names (such as one sees in output of tools like ifconfig(8)) might not
match their /dev entity names, and for bhyve we need the latter.

Current implementation is not very efficient because in order to find
/dev name, it goes through all /dev/tap* entries and tries to issue
TAPGIFNAME ioctl on it. Not only this is slow, but also there's a bug in
this implementation when more than one NIC is passed to a VM: once we
find the tap interface we're looking for, we set its state to UP because
opening it for issuing ioctl sets it DOWN, even if it was UP before.
When we have more than 1 NIC for a VM, we have only last one UP because
others remain DOWN after unsuccessful attempts to match interface name.

New implementation just uses sysctl(3), so it should be faster and
won't make interfaces go down to get name.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoremote: refactor code for building UNIX socket paths
Daniel P. Berrangé [Fri, 23 Mar 2018 10:41:23 +0000 (10:41 +0000)]
remote: refactor code for building UNIX socket paths

The code for building UNIX socket paths will be getting more complex to
cope with accessing various different daemons. Refactor it to eliminate
the code duplication and isolation the logic for constructing paths.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoremote: split URI scheme into driver and transport upfront
Daniel P. Berrangé [Fri, 13 Apr 2018 08:51:25 +0000 (09:51 +0100)]
remote: split URI scheme into driver and transport upfront

Currently the remote driver extracts the transport from URI scheme and
plays games to temporarily hide the driver part when formatting URIs.
Refactor the code to split the URI scheme upfront so the two pieces are
easily available where needed.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoremote: honour errors from virDriverLoadModule
Daniel P. Berrangé [Thu, 19 Apr 2018 16:02:22 +0000 (17:02 +0100)]
remote: honour errors from virDriverLoadModule

The libvirtd daemon currently ignores the return status of
virDriverLoadModule entirely. This is way too loose, resulting in many
important problems going undiagnosed, resulting in a libvirtd that may
never work correctly. We should only ignore a non-existant module, and
pass back any fatal errors.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agodriver: add option to make missing drivers a fatal problem
Daniel P. Berrangé [Thu, 19 Apr 2018 15:50:56 +0000 (16:50 +0100)]
driver: add option to make missing drivers a fatal problem

Currently the driver module loading code does not report an error if the
driver module is physically missing on disk. This is useful for distro
packaging optional pieces. When the daemons are split up into one daemon
per driver, we will expect module loading to always succeed. If a driver
is not desired, the entire daemon should not be installed.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agodriver: use normal error reporting APIs when loading modules
Daniel P. Berrangé [Thu, 19 Apr 2018 15:21:38 +0000 (16:21 +0100)]
driver: use normal error reporting APIs when loading modules

The driver module loading code is one of the few places that still uses
VIR_ERROR for reporting failures. Convert it to normal error reporting
APIs.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agodriver: tighten check for whether loadable module exists or not
Daniel P. Berrangé [Thu, 19 Apr 2018 15:00:30 +0000 (16:00 +0100)]
driver: tighten check for whether loadable module exists or not

Currently we do a access(R_OK) check to see whether a loadable module
exists, treating failure as non-fatal. This is unreasonably loose, as a
module which exists but has had incorrect permissions set will turn into
a silent skip. We only want to skip loading if the module genuinely does
not exist on disk, due to the optional package not being installed.

Furthermore, checking the return value of virDriverLoadModuleFile() is
not a suitable witness that the module does not exist. This method can
return NULL if dlopen() fails, for example due to being unable to
resolve symbols in the library. This is should always be reported as an
error because it is a sign of the bad installation where either the
module build doesn't match the libvirtd build, or where some 3rd party
libraries are missing or broken.

Both these problems can be fixed by using virFileExists in the caller
instead.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agodriver: fix handling of error return from finding resource
Daniel P. Berrangé [Thu, 19 Apr 2018 14:25:01 +0000 (15:25 +0100)]
driver: fix handling of error return from finding resource

The virFileFindResource method merely builds up the expected fully
qualified path to the resource. It does not actually check if it exists
on disk. The loadable module callers were mistakenly thinking a NULL
indicates the file doesn't exist on disk, whereas it in fact indicates
an out of memory error.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agodriver: don't keep a pointer to the loaded library handle
Daniel P. Berrangé [Thu, 19 Apr 2018 14:20:44 +0000 (15:20 +0100)]
driver: don't keep a pointer to the loaded library handle

Now that we've activated two hacks to prevent unloading of modules,
there is no point passing back a pointer to the loaded library handle.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agobuild: prevent unloading of dlopen'd modules
Daniel P. Berrangé [Thu, 19 Apr 2018 10:42:22 +0000 (11:42 +0100)]
build: prevent unloading of dlopen'd modules

We previously added "-z nodelete" to the build of libvirt.so to prevent
crashes when thread local destructors run which point to a code that
has been dlclose()d:

  commit 8e44e5593eb9b89fbc0b54fde15f130707a0d81e
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Thu Sep 1 17:57:06 2011 +0100

      Prevent crash from dlclose() of libvirt.so

The libvirtd loadable modules can suffer from the same problem if they
were ever unloaded. Fortunately we don't ever call dlclose() on them,
but lets add a second layer of protection by linking them with the
"-z nodelete" flag. While we're doing this, lets add a third layer of
protection by passing RTLD_NODELETE to dlopen().

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agovirsh: remove left over print statement wrt Xen driver
Daniel P. Berrangé [Tue, 24 Apr 2018 15:59:21 +0000 (16:59 +0100)]
virsh: remove left over print statement wrt Xen driver

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoremote: stop trying to load Xen driver module
Daniel P. Berrangé [Thu, 19 Apr 2018 16:12:44 +0000 (17:12 +0100)]
remote: stop trying to load Xen driver module

The Xen driver was recently deleted, but libvirtd has left over code
that tries to use it. Fortunately this is dead code because WITH_XEN
will never be defined anymore.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agobuild: prevent unloading of all public libraries
Daniel P. Berrangé [Thu, 19 Apr 2018 14:14:04 +0000 (15:14 +0100)]
build: prevent unloading of all public libraries

We previously added "-z nodelete" to the build of libvirt.so to prevent
crashes when thread local destructors run which point to a code that
has been dlclose()d:

  commit 8e44e5593eb9b89fbc0b54fde15f130707a0d81e
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Thu Sep 1 17:57:06 2011 +0100

      Prevent crash from dlclose() of libvirt.so

We forgot to copy this protection into the libvirt-qemu.so, libvirt-lxc.so
and libvirt-admin.so libraries when we introduced them.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoCheck return status for virUUIDGenerate
John Ferlan [Mon, 9 Apr 2018 20:30:10 +0000 (16:30 -0400)]
Check return status for virUUIDGenerate

Although legal, a few paths were not checking a return value < 0
for failure instead they checked a non zero failure.

Clean them all up to be consistent.

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agovirNumaGetHugePageInfo: Return page_avail and page_free as ULL
Michal Privoznik [Mon, 23 Apr 2018 14:36:53 +0000 (16:36 +0200)]
virNumaGetHugePageInfo: Return page_avail and page_free as ULL

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

On some large systems (with ~400GB of RAM) it is possible for
unsigned int to overflow in which case we report invalid number
of 4K pages pool size. Switch to unsigned long long.

We hit overflow in virNumaGetPages when doing:

    huge_page_sum += 1024 * page_size * page_avail;

because although 'huge_page_sum' is an unsigned long long, the
page_size and page_avail are both unsigned int, so the promotion
to unsigned long long doesn't happen until the sum has been
calculated, by which time we've already overflowed.

Turning page_avail into a unsigned long long is not strictly
needed until we need ability to represent more than 2^32
4k pages, which equates to 16 TB of RAM. That's not
outside the realm of possibility, so makes sense that we
change it to unsigned long long to avoid future problems.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotools: do not report unknown guests in print_guests_shutdown
Christian Ehrhardt [Thu, 19 Apr 2018 06:41:03 +0000 (08:41 +0200)]
tools: do not report unknown guests in print_guests_shutdown

If another event in background while running libvirt-guests.sh
completely undefines a guest it will no more be available for proper
reporting of its shutdown.

This appears in the log as:
  Failed to determint state of guest: <UUID>. Not tracking it anymore
  Shutdown of guest  complete

The first message already reports that we are giving up on the guest
(per UUID which is all we have left at that point). To avoid the message
with an empty guest_name in such a case lets check what guest_name
returned and only print a report on valid content.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Dariusz Gadomski <dariusz.gadomski@canonical.com>
7 years agotools: fix check_guests_shutdown loop
Christian Ehrhardt [Thu, 19 Apr 2018 06:41:02 +0000 (08:41 +0200)]
tools: fix check_guests_shutdown loop

The recent fix to libvirt-guests.sh.in works for what it intended to fix
(variable scope) but failed to adapt the loop in check_guests_shutdown
correctly. Due to that it currently might detect all guests as "Failed to
determine state of guest" by bad var content or just assumes they are shut
down by picking up an empty variable.

This commit fixes loop to use the passed value and the call in the loop
to actually use the variable assigned in the iterated.

Fixes: 7e476356 "tools: fix variable scope in in check_guests_shutdown"
Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1764668
Reviewed-by: Dariusz Gadomski <dariusz.gadomski@canonical.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agonews: Document rom.enabled attribute for PCI devices
Andrea Bolognani [Fri, 20 Apr 2018 15:26:07 +0000 (17:26 +0200)]
news: Document rom.enabled attribute for PCI devices

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agotests: Make sure rom.file='' for PCI devices keeps working
Andrea Bolognani [Mon, 23 Apr 2018 11:45:59 +0000 (13:45 +0200)]
tests: Make sure rom.file='' for PCI devices keeps working

Even though we just introduced the rom.enabled attribute to
properly cover the use case, there might be guests out there
that use the only previously available way of disabling PCI
ROM loading by not opting in to schema validation.

To make sure such guests will keep working going forward,
introduce a test case covering the legacy workaround.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: Format rom.enabled attribute for PCI devices
Andrea Bolognani [Fri, 20 Apr 2018 15:17:11 +0000 (17:17 +0200)]
qemu: Format rom.enabled attribute for PCI devices

The attribute can be used to disable ROM loading completely
for a device.

This might be needed because, even when the guest is configured
such that the PCI ROM will not be loaded in the PCI BAR, some
hypervisors (eg. QEMU) might still make it available to the
guest in a form (eg. fw_cfg) that some firmwares (eg. SeaBIOS)
will consume, thus not achieving the desired result.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoconf: Add rom.enabled attribute for PCI devices
Andrea Bolognani [Thu, 19 Apr 2018 15:55:41 +0000 (17:55 +0200)]
conf: Add rom.enabled attribute for PCI devices

The attribute can be used to disable ROM loading completely
for a device.

This might be needed because, even when the guest is configured
such that the PCI ROM will not be loaded in the PCI BAR, some
hypervisors (eg. QEMU) might still make it available to the
guest in a form (eg. fw_cfg) that some firmwares (eg. SeaBIOS)
will consume, thus not achieving the desired result.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoconf: Rework/rename virDomainObjListFindByIDRef
John Ferlan [Fri, 9 Mar 2018 15:59:28 +0000 (10:59 -0500)]
conf: Rework/rename virDomainObjListFindByIDRef

Rework the code such that virDomainObjListFindByID will always
return a locked/ref counted object so that the callers can
always do the same cleanup logic to call virDomainObjEndAPI.
Makes accessing the objects much more consistent.

NB:
There were 2 callers (lxcDomainLookupByID and qemuDomainLookupByID)
that were already using the ByID name, but not virDomainObjEndAPI -
these were changed as well in this update/patch.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
7 years agoconf: Rework/rename virDomainObjListFindByUUIDRef
John Ferlan [Fri, 9 Mar 2018 15:47:46 +0000 (10:47 -0500)]
conf: Rework/rename virDomainObjListFindByUUIDRef

Now that every caller is using virDomainObjListFindByUUIDRef,
let's just remove it and keep the name as virDomainObjListFindByUUID.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
7 years agogit: add config file telling git-publish how to send patches
Daniel P. Berrangé [Wed, 18 Apr 2018 17:30:38 +0000 (18:30 +0100)]
git: add config file telling git-publish how to send patches

The "git-publish" tool is a useful git extension for sending patch
series for code review. It automatically creates versioned tags
each time code on a branch is sent, so that there is a record of
each version. It also remembers the cover letter so it does not
need re-entering each time the series is reposted.

With this config file present it is now sufficient[1] to run

  $ git publish

to send all patches in a branch to the list for review

[1] Assuming your $HOME/.gitconfig has an SMTP server listed
at least e.g.

   [sendemail]
        smtpserver = smtp.example.com

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotests: Xen: use qemu-system-i386 for emulator
Jim Fehlig [Wed, 11 Apr 2018 16:38:14 +0000 (10:38 -0600)]
tests: Xen: use qemu-system-i386 for emulator

Many of the old xm and sexpr test files used qemu-dm as the emulator.
Modern Xen systems no longer use the old, forked qemu-dm, instead
preferring the distro provided qemu or an "upstream" qemu that is
built when the Xen tools are built. This qemu is typically installed
in /usr/lib/xen/bin/qemu-system-i386.

The libxl test files already use /usr/lib/xen/bin/qemu-system-i386.
For consistency, change the old test files to use the same emulator

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agovz: Use virDomainObjListFindBy{UUID|ID}Ref
John Ferlan [Fri, 9 Mar 2018 15:30:47 +0000 (10:30 -0500)]
vz: Use virDomainObjListFindBy{UUID|ID}Ref

For vzDomainLookupByID and vzDomainLookupByUUID let's
return a locked and referenced @vm object so that callers
can then use the common and more consistent virDomainObjEndAPI
in order to handle cleanup rather than needing to know that the
returned object is locked and calling virObjectUnlock.

The LookupByName already returns the ref counted and locked object,
so this will make things more consistent.

Also adjust the prlsdkHandle{VmState|VmRemoved|Perf}Event APIs
in the same manner.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
7 years agovz: Unify vzDomObjFromDomain{Ref}
John Ferlan [Fri, 9 Mar 2018 14:59:00 +0000 (09:59 -0500)]
vz: Unify vzDomObjFromDomain{Ref}

Rather than have two API's doing different things for different
callers, let's make one API that will always return a locked and
ref counted object. That way, the callers will always know that
they must call virDomainObjEndAPI and not have to decide whether
they should call virObjectUnlock instead.

This will make things consistent with LookupByName which returns
the locked and ref counted object.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
7 years agovmware: Use virDomainObjListFindBy{UUID|ID}Ref
John Ferlan [Mon, 23 Oct 2017 17:25:34 +0000 (13:25 -0400)]
vmware: Use virDomainObjListFindBy{UUID|ID}Ref

For vmwareDomObjFromDomainLocked and vmwareDomainLookupByID
let's return a locked and referenced @vm object so that callers
can then use the common and more consistent virDomainObjEndAPI
in order to handle cleanup rather than needing to know that the
returned object is locked and calling virObjectUnlock.

The LookupByName already returns the ref counted and locked object,
so this will make things more consistent.

For vmwareDomainUndefineFlags and vmwareDomainShutdownFlags since
virDomainObjListRemove will return an unlocked object, we need to
relock before making the EndAPI call.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agovmware: Add more descriptive error message on Find failure
John Ferlan [Fri, 9 Mar 2018 14:46:47 +0000 (09:46 -0500)]
vmware: Add more descriptive error message on Find failure

If vmwareDomainLookupByID or vmwareDomainLookupByName fails
to find a vm, let's be a bit more descriptive by providing
the failing id or name in the error message.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agovmware: Create accessors to virDomainObjListFindByUUID
John Ferlan [Mon, 23 Oct 2017 17:19:46 +0000 (13:19 -0400)]
vmware: Create accessors to virDomainObjListFindByUUID

Rather than repeat code throughout, create and use a couple of
accessors in order to lookup by UUID.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agovmware: Properly clean up in vmwareDomainLookupByName
John Ferlan [Fri, 9 Mar 2018 14:48:07 +0000 (09:48 -0500)]
vmware: Properly clean up in vmwareDomainLookupByName

The virDomainObjListFindByName returns a locked and reffed
domain object, all we did was unlock it, leaving an extra
ref. Use the virDomainObjEndAPI to cleanup instead.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>