]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
7 years agoqemu: Remove virQEMUCapsProcessProps()
Andrea Bolognani [Tue, 6 Mar 2018 13:44:49 +0000 (14:44 +0100)]
qemu: Remove virQEMUCapsProcessProps()

This function was introduced in commit 41f5c2ca2776 as a way
to probe the same property for multiple devices at once.

Although the resulting representation is very compact, it
doesn't provide any extra features compared to the existing
virQEMUCapsProcessStringFlags() mechanism, which is already
used for pretty much all device properties.

Drop the custom function and datatypes and start using the
standard ones instead.

Note that, in theory, the end result is not identical
because we're no longer probing properties for

  virtio-serial-pci
  virtio-9p-pci
  virtio-rng-pci
  virtio-input-host-pci
  virtio-keyboard-pci
  virtio-mouse-pci
  virtio-tablet-pci

However, chances of any of those devices being compiled
into a QEMU binary where

  virtio-balloon-pci
  virtio-blk-pci
  virtio-scsi-pci
  virtio-net-pci
  virtio-gpu-pci

are compiled out are slim enough that it doesn't make any
difference in practice, as the lack of test suite churn
shows.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: Ignore subsequent attempts to probe device properties
Andrea Bolognani [Tue, 6 Mar 2018 12:43:26 +0000 (13:43 +0100)]
qemu: Ignore subsequent attempts to probe device properties

In some cases, we are probing multiple devices for the same
property and setting the corresponding capability if it's
found on any of the devices: when that happens, we can quit
early after finding the first property and avoiding a bunch
of string comparisons.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: Take full advantage of conditional device property probing
Andrea Bolognani [Tue, 6 Mar 2018 12:49:39 +0000 (13:49 +0100)]
qemu: Take full advantage of conditional device property probing

Commit 4ae59411fa3f introduced the ability to make probing for
device properties conditional on a capability being set, but
didn't extend the use of this feature to existing devices.

This commit does the last bit of work, which results in a lot
of pointless QMP chatter no longer happening and our test suite
shrinking a fair bit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: Fix memory leak in qemuConnectGetAllDomainStats error path
John Ferlan [Wed, 7 Mar 2018 14:43:30 +0000 (09:43 -0500)]
qemu: Fix memory leak in qemuConnectGetAllDomainStats error path

If we return -1 on VIR_ALLOC_N failure, we leaked @vms, so
goto cleanup instead.

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agoconf: Replace virDomainDiskSourceEncryptionParse by an XPath query
Peter Krempa [Tue, 6 Mar 2018 13:24:49 +0000 (14:24 +0100)]
conf: Replace virDomainDiskSourceEncryptionParse by an XPath query

Remove the rather bulky function in favor of an XPath query.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoutil: storage: Sanitize parsing of disk encryption XMLs
Peter Krempa [Tue, 6 Mar 2018 13:17:59 +0000 (14:17 +0100)]
util: storage: Sanitize parsing of disk encryption XMLs

Pass in the XPath context as we do in all other places rather than
allocating a new one.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoutil: storageencryption: Refactor cleanup section in virStorageEncryptionParseXML
Peter Krempa [Tue, 6 Mar 2018 13:57:17 +0000 (14:57 +0100)]
util: storageencryption: Refactor cleanup section in virStorageEncryptionParseXML

The function used the 'cleanup' label only in error cases. This patch
makes the code pass the cleanup label in every case and removes few
unnecessary VIR_FREEs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoconf: Replace virDomainDiskSourceAuthParse by an XPath query
Peter Krempa [Tue, 6 Mar 2018 13:24:49 +0000 (14:24 +0100)]
conf: Replace virDomainDiskSourceAuthParse by an XPath query

Remove the rather bulky function in favor of an XPath query.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoutil: storage: Sanitize parsing of disk auth XMLs
Peter Krempa [Tue, 6 Mar 2018 13:17:59 +0000 (14:17 +0100)]
util: storage: Sanitize parsing of disk auth XMLs

Pass in the XPath context as we do in all other places rather than
allocating a new one.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoutil: storage: Simplify error handling in virStorageAuthDefParseXML
Peter Krempa [Tue, 6 Mar 2018 13:03:27 +0000 (14:03 +0100)]
util: storage: Simplify error handling in virStorageAuthDefParseXML

Unify the cleanup and error paths and simplify the code flow by removing
some unnecessary variables.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agovirt-aa-helper: resolve yet to be created paths
Christian Ehrhardt [Thu, 1 Mar 2018 13:58:39 +0000 (14:58 +0100)]
virt-aa-helper: resolve yet to be created paths

In certain cases a xml contains paths that do not yet exist, but
are valid as qemu will create them later on - for example
vhostuser mode=server sockets.

In any such cases so far the check to virFileExists failed and due to
that the paths stayed non-resolved in regard to symlinks.

But for apparmor those non-resolved rules are non functional as they
are evaluated after resolving any symlinks.

Therefore for non-existent files and partially non-existent paths
resolve as much as possible to get valid rules.

Example:
   <interface type='vhostuser'>
       <model type='virtio'/>
       <source type='unix' path='/var/run/symlinknet' mode='server'/>
   </interface>

Got rendered as:
  "/var/run/symlinknet" rw,

But correct with "/var/run" being a symlink to "/run" is:
  "/run/symlinknet" rw,

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoutil: mdev: Treat the 'name' sysfs attribute as optional
Erik Skultety [Mon, 5 Mar 2018 14:43:45 +0000 (15:43 +0100)]
util: mdev: Treat the 'name' sysfs attribute as optional

When commit 3545cbef moved the sysfs attribute reading logic from
_udev.c module to virmdev.c, it had to replace our udev read wrappers
with the ones available from virfile.c. The problem is that the original
logic worked correctly with udev read wrappers which don't return an
error code for a missing attribute, virfile.c readers however - not so
much. Therefore add another parameter to the macro, so we can again
accept the fact that optional attributes may be missing.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: report a nicer error when USB is disabled
Ján Tomko [Thu, 14 Sep 2017 07:13:20 +0000 (09:13 +0200)]
qemu: report a nicer error when USB is disabled

If the user tries to define a domain that has

  <controller type='usb' model='none'/>

and also some USB devices, we report an error:
  error: internal error: No free USB ports

Which is technically still correct for a domain with no USB ports.

Change it to:

USB is disabled for this domain, but USB devices are present in the domain XML

https://bugzilla.redhat.com/show_bug.cgi?id=1347550
Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemuDomainObjBeginJob: Don't account DESTROY job to maxQueuedJobs
Michal Privoznik [Mon, 5 Mar 2018 09:13:29 +0000 (10:13 +0100)]
qemuDomainObjBeginJob: Don't account DESTROY job to maxQueuedJobs

When trying to destroy a domain (e.g. because we've seen EOF on
the monitor) we try to acquire QEMU_JOB_DESTROY. However, if
max_queued is set in qemu.conf this may fail and since our code
doesn't count on that we will still report domain as active even
though the qemu process is long gone. More specifically, if we've
seen EOF on the monitor, qemuProcessHandleMonitorEOF() is called
which sends MONITOR_EOF job to the event worker pool and
unregisters monitor from the event loop. The worker pool calls
processMonitorEOFEvent() which tries to set job which may fail
due to the limit as described above.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agonews: add logging of guest crash information on S390
Bjoern Walk [Tue, 27 Feb 2018 09:32:57 +0000 (10:32 +0100)]
news: add logging of guest crash information on S390

Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: log the crash information for S390
Bjoern Walk [Tue, 27 Feb 2018 09:32:56 +0000 (10:32 +0100)]
qemu: log the crash information for S390

Since QEMU 2.12 commit id '4ada99ade' guest crash information for
S390 is available in the QEMU monitor, e.g.:

  {
    "timestamp": {
        "seconds": 1518004739,
        "microseconds": 552563
    },
    "event": "GUEST_PANICKED",
    "data": {
        "action": "pause",
        "info": {
            "core": 0,
            "psw-addr": 1102832,
            "reason": "disabled-wait",
            "psw-mask": 562956395872256,
            "type": "s390"
        }
    }
  }

Let's log this information into the domain log file, e.g.:

    2018-02-08 13:11:26.075+0000: panic s390: core='0' psw-mask='0x0002000180000000' psw-addr='0x000000000010f146' reason='disabled-wait'

Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agotests: Add capabilities for QEMU 2.11.0 on s390x
Shalini Chellathurai Saroja [Mon, 26 Feb 2018 10:20:18 +0000 (11:20 +0100)]
tests: Add capabilities for QEMU 2.11.0 on s390x

Let us introduce the xml and reply files for QEMU 2.11.0 on s390x.

Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
7 years agotests: force use of "NORMAL" TLS priority in test suite
Daniel P. Berrangé [Mon, 5 Mar 2018 12:46:16 +0000 (12:46 +0000)]
tests: force use of "NORMAL" TLS priority in test suite

When generating certificates we rely on GNUTLS' built-in default setup
for the ciphers used in the certs. We then currently run with the distro
specific TLS priority setup which can be much stronger, to the extent
that the certificates we generate are considered untrustworthy. We don't
care about the quality of the ciphers we use in the test suite, so just
force the priority to "NORMAL" which should ensure our certs are
accepted by GNUTLS.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoqemu: Fix comparison assignment in qemuDomainUpdateDeviceLive
Erik Skultety [Tue, 6 Mar 2018 08:20:58 +0000 (09:20 +0100)]
qemu: Fix comparison assignment in qemuDomainUpdateDeviceLive

Fix this common typo and assign a value rather than implicitly
type-casted comparison result. Introduced by commit b6a264e855.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agocfg.mak: ignore trailing whitespace in gnulib local patches
Daniel P. Berrangé [Mon, 5 Mar 2018 18:46:24 +0000 (18:46 +0000)]
cfg.mak: ignore trailing whitespace in gnulib local patches

The diff files in gnulib/local may well contain trailing whitespace.
They are simply diff's of gnulib code which should not be modified to
follow libvirt style rules.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agognulib: temporary hacks to deal with glibc libio.h removal
Daniel P. Berrangé [Mon, 5 Mar 2018 17:20:03 +0000 (17:20 +0000)]
gnulib: temporary hacks to deal with glibc libio.h removal

GLibc deprecated libio.h in 2.27 and has removed it in current
code that will become 2.28. The latter is now in Fedora rawhide
and this change breaks gnulib which mistakenly still relies on
these ancient symbols. Add a local hack for gnulib until a
proper fix is available upstream.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agognulib: update to latest upstream changeset
Daniel P. Berrangé [Mon, 5 Mar 2018 16:47:31 +0000 (16:47 +0000)]
gnulib: update to latest upstream changeset

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split vmx driver build rules into vmx/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split vmx driver build rules into vmx/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split util build rules into util/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split util build rules into util/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split RPC build rules into rpc/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split RPC build rules into rpc/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split admin driver build rules into admin/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split admin driver build rules into admin/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split lock daemon build rules into locking/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split lock daemon build rules into locking/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split logging daemon build rules into logging/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split logging daemon build rules into logging/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split access driver build rules into access/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split access driver build rules into access/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split security driver build rules into security/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split security driver build rules into security/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split CPU build rules into cpu/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split CPU build rules into cpu/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split XML conf build rules into conf/Makefile.inc.am
Daniel P. Berrangé [Fri, 23 Feb 2018 16:33:19 +0000 (16:33 +0000)]
make: split XML conf build rules into conf/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split remote driver & daemon build rules into remote/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split remote driver & daemon build rules into remote/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split storage driver build rules into storage/Makefile.inc.am
Daniel P. Berrangé [Tue, 27 Feb 2018 11:30:54 +0000 (11:30 +0000)]
make: split storage driver build rules into storage/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split secret driver build rules into secret/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split secret driver build rules into secret/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split nodedev driver build rules into node_device/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split nodedev driver build rules into node_device/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split nwfilter driver build rules into nwfilter/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split nwfilter driver build rules into nwfilter/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split network driver build rules into network/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split network driver build rules into network/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split interface driver build rules into interface/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split interface driver build rules into interface/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake sure libvirt is linked first
Jan Palus [Mon, 5 Mar 2018 15:39:48 +0000 (16:39 +0100)]
make sure libvirt is linked first

so it's not affected by flags that might be passed in $(*_LIBS) like
-L/usr/lib which might result in linking against system library and
requiring incorrect version of private symbols

Signed-off-by: Jan Palus <atler@pld-linux.org>
7 years agoconf: Assign explicit value to VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE
Andrea Bolognani [Fri, 2 Mar 2018 14:26:14 +0000 (15:26 +0100)]
conf: Assign explicit value to VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE

Pretty much any reasonable compiler would do this automatically,
but there's no harm in being explicit about it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
7 years agoPost-release version bump to 4.2.0
Daniel P. Berrangé [Mon, 5 Mar 2018 15:02:51 +0000 (15:02 +0000)]
Post-release version bump to 4.2.0

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotravis: force install of python2 into $PATH on macOS
Daniel P. Berrangé [Mon, 5 Mar 2018 10:13:12 +0000 (10:13 +0000)]
travis: force install of python2 into $PATH on macOS

The homebrew formula's ignored Python PEP-0394 recommendations and
changed the plain python binary in /usr/local/bin to point to Python 3
instead of Python 2. Python 2 is not even installed into a location that
is in $PATH by default anymore. The homebrew packages print a message
to stderr claiming to provide a way to fix this

[quote]
  This formula installs a python2 executable to /usr/local/opt/python@2/bin

  If you wish to have this formula's python executable in your PATH then add

  the following to ~/.bash_profile:

    export PATH="/usr/local/opt/python@2/libexec/bin:$PATH"
[/quote]

When trying to update $PATH are suggested we find out this message is a
lie and /usr/local/opt/python@2 does not even exist, instead Python
seems to end up in /usr/local/Cellar/python@2/2.7.14_1

Rather than hardcoding this version specific directory in our travis
config, we change to run "brew link --force python@2", to make it create
symlinks in /usr/local/bin for the python2 binary.

The original change triggering this problem was

  https://github.com/Homebrew/homebrew-core/pull/24604#issue-171653084

There are countless bug reports against homebrew-core that are closed
without fixes, so it seems they are determined to ignore the Python
PEP 0394 recommendations on this.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoconf: set postParseFailed even without ALLOW_POST_PARSE_FAIL
Ján Tomko [Fri, 2 Mar 2018 14:12:49 +0000 (15:12 +0100)]
conf: set postParseFailed even without ALLOW_POST_PARSE_FAIL

We allow the postParse callbacks to fail for some reasons (missing
emulator binary) when parsing the configs from /etc/libvirt.
In that case, def->postParseFailed is set to true and the post
parse callbacks are re-executed on domain startup.

However this bool was only set when virDomainDefPostParse was called
with the ALLOW_POST_PARSE_FAIL flag set. If the callback failed
again on domain startup, the bool would be reset and subsequent
startups would not attempt to reexecute the callback.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovboxDumpNetwork: use switch for adapterType
Ján Tomko [Fri, 23 Feb 2018 14:01:06 +0000 (15:01 +0100)]
vboxDumpNetwork: use switch for adapterType

Also return an error when VIR_STRDUP fails.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovboxDumpNetwork: use VIR_STEAL_PTR instead of VIR_STRDUP
Ján Tomko [Fri, 23 Feb 2018 13:52:24 +0000 (14:52 +0100)]
vboxDumpNetwork: use VIR_STEAL_PTR instead of VIR_STRDUP

We can steal the strings instead of creating more copies.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovboxDumpNetwork: use a switch for attachmentType
Ján Tomko [Fri, 23 Feb 2018 13:41:03 +0000 (14:41 +0100)]
vboxDumpNetwork: use a switch for attachmentType

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovboxDumpNetwork: Use a single utf8 temp variable
Ján Tomko [Fri, 23 Feb 2018 13:34:09 +0000 (14:34 +0100)]
vboxDumpNetwork: Use a single utf8 temp variable

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovboxDumpNetwork: Use a single utf16 variable
Ján Tomko [Fri, 23 Feb 2018 13:18:10 +0000 (14:18 +0100)]
vboxDumpNetwork: Use a single utf16 variable

There is a pattern of using two temporary utf16/utf8 variables
for every value we get from VirtualBox and put in the domain
definition right away.

Reuse the same variable name to improve the chances of getting
the function on one screen.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovboxDumpNetwork: use virMacAddrParseHex
Ján Tomko [Fri, 23 Feb 2018 13:31:50 +0000 (14:31 +0100)]
vboxDumpNetwork: use virMacAddrParseHex

Use the virMacAddrParse helper that does not require colon-separated
values instead of using extra code to format it that way.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovboxDumpNetworks: do not allocate def->nets upfront
Ján Tomko [Fri, 23 Feb 2018 12:51:24 +0000 (13:51 +0100)]
vboxDumpNetworks: do not allocate def->nets upfront

Use VIR_APPEND_ELEMENT instead and change the return type
to int to catch allocation errors.

This removes the need to figure out the adapter count
upfront.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovboxDumpNetworks: delete pointless comment
Ján Tomko [Fri, 23 Feb 2018 12:47:25 +0000 (13:47 +0100)]
vboxDumpNetworks: delete pointless comment

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovboxDumpNetwork: allocate the network too
Ján Tomko [Fri, 23 Feb 2018 12:45:21 +0000 (13:45 +0100)]
vboxDumpNetwork: allocate the network too

Move the allocation from vboxDumpNetworks inside vboxDumpNetwork.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovboxDumpNetworks: reduce indentation level
Ján Tomko [Fri, 23 Feb 2018 12:19:25 +0000 (13:19 +0100)]
vboxDumpNetworks: reduce indentation level

The 'enabled' bool is initialized to false, there is no need to nest the
conditions.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovboxDumpNetwork: re-introduce this function
Ján Tomko [Fri, 23 Feb 2018 11:15:38 +0000 (12:15 +0100)]
vboxDumpNetwork: re-introduce this function

Split out per-adapter code from vboxDumpNetworks.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovboxDumpNetwork: rename to vboxDumpNetworks
Ján Tomko [Fri, 23 Feb 2018 11:10:06 +0000 (12:10 +0100)]
vboxDumpNetwork: rename to vboxDumpNetworks

Free up 'vboxDumpNetwork' for dumping single network.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovboxDumpNetwork: add temp variable for current network
Ján Tomko [Fri, 23 Feb 2018 11:06:18 +0000 (12:06 +0100)]
vboxDumpNetwork: add temp variable for current network

Instead of using def->nets every time, use a temporary pointer.
This will allow splitting out the per-adapter code.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovboxDumpSharedFolders: return a value
Ján Tomko [Wed, 31 Jan 2018 15:11:18 +0000 (16:11 +0100)]
vboxDumpSharedFolders: return a value

The allocation errors in this function are already handled by jumping
to a cleanup label.

Change the return type from void to int and return -1 on error.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovboxDumpSharedFolders: remove pointless comment
Ján Tomko [Wed, 31 Jan 2018 15:39:25 +0000 (16:39 +0100)]
vboxDumpSharedFolders: remove pointless comment

Now that the functions are separate, we no longer need comment
separators.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovboxDumpSharedFolders: rename non-standard label
Ján Tomko [Wed, 31 Jan 2018 15:37:16 +0000 (16:37 +0100)]
vboxDumpSharedFolders: rename non-standard label

s/sharedFoldersCleanup/cleanup/

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agoAUTHORS: Add myself to the list of committers
Nikolay Shirokovskiy [Mon, 5 Mar 2018 10:45:16 +0000 (13:45 +0300)]
AUTHORS: Add myself to the list of committers

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
7 years agoRelease of libvirt 4.1.0
Daniel Veillard [Mon, 5 Mar 2018 09:02:19 +0000 (10:02 +0100)]
Release of libvirt 4.1.0

- docs/news.xml : updated for release
- po/*.po*: regenerated

Signed-off-by: Daniel Veillard<veillard@redhat.com>
7 years agotests: introduce qemucapsfixreplies helper
Pavel Hrdina [Thu, 1 Mar 2018 14:25:05 +0000 (15:25 +0100)]
tests: introduce qemucapsfixreplies helper

Sometimes we don't regenerate QEMU capabilities replies using QEMU
binary but we simply add a new entry manually.  In that case you need
to manually fix all the replies ids.  This helper will do that for you.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
7 years agonews: Update release notes
Michal Privoznik [Thu, 1 Mar 2018 13:48:34 +0000 (14:48 +0100)]
news: Update release notes

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agosrc: Fix checking for clang
Andrea Bolognani [Thu, 1 Mar 2018 16:32:08 +0000 (17:32 +0100)]
src: Fix checking for clang

The check was trying to use the shell variable $CC instead of
the make variable $(CC); it also interpreted grep's return code
wrong: 1 means the provided pattern was *not* matched. As a
result, pdwtags was never run, not even when building with gcc.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoconf: Fix crash in virDomainDefCompatibleDevice
John Ferlan [Thu, 1 Mar 2018 12:08:32 +0000 (07:08 -0500)]
conf: Fix crash in virDomainDefCompatibleDevice

Commit id 'edae027c' blindly assumed that the passed @oldDev
parameter would not be NULL when calling virDomainDeviceGetInfo;
however, commit id 'b6a264e8' passed NULL for AttachDevice
callers under the premise that there wouldn't be a device
to check/update against.

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agotravis: test upstart/systemd init script handling
Daniel P. Berrangé [Fri, 23 Feb 2018 10:58:27 +0000 (10:58 +0000)]
travis: test upstart/systemd init script handling

Enable testing of both the upstart and systemd init script handling.
We test a different one in each scenario. Even though trusty only
cares about upstart, it is fine for us to test rules that install
systemd, since we're not actually running these scripts for real.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotravis: test "make install" and "make dist" on macOS
Daniel P. Berrangé [Wed, 28 Feb 2018 12:27:38 +0000 (12:27 +0000)]
travis: test "make install" and "make dist" on macOS

We can't use "make distcheck" on macOS because many unit tests fail. We
can still get coverage of some of the things "distcheck" validates, by
running the "install" and "dist" targets. This is particularly useful
because many conditional features are disabled on macOS, and this helps
make sure we can still successfully install & dist when these bits are
disabled.

The default script is getting unreadable since it is all on one long
line. Rather than adding further conditional clauses to it, we make
use of the travis matrix config override for the script.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotravis: run "make distcheck" instead of just "make check"
Daniel P. Berrangé [Thu, 22 Feb 2018 14:14:17 +0000 (14:14 +0000)]
travis: run "make distcheck" instead of just "make check"

Running "make distcheck" includes the "make check", and "make dist"
targets. It ensures that we have CLEANFILES and uninstall rules setup
correctly, as well as validating VPATH builds succeed.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotravis: drop precise distro jobs
Daniel P. Berrangé [Wed, 28 Feb 2018 10:38:23 +0000 (10:38 +0000)]
travis: drop precise distro jobs

The precise distro is marked deprecated in travis and will be dropped
entirely in 2 months time.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: skip pdwtags when building with CLang
Daniel P. Berrangé [Wed, 28 Feb 2018 14:38:20 +0000 (14:38 +0000)]
make: skip pdwtags when building with CLang

When building with CLang the structs that are emitted by pdwtags appear
in a completely different order than with GCC, which causes the
comparison against expected data to fail.

Ideally the test would not be sensitive to the ordering, because even
future GCC could cause changes, but that's not easy to fix. So for now
just skip the test when using clang.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agodocs: remove legacy XHTML <!DOCTYPE> declaration
Daniel P. Berrangé [Wed, 28 Feb 2018 17:42:47 +0000 (17:42 +0000)]
docs: remove legacy XHTML <!DOCTYPE> declaration

We have switched the docs to using the HTML5 doctype declaration in

  commit b1c81567c7172bc9dcd701cf46ea3f87725d62c7
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Wed Jul 26 18:01:25 2017 +0100

    docs: switch to using HTML5 doctype declaration

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agovshCommandOpt: Do more checking if skipChecks is set
Michal Privoznik [Wed, 28 Feb 2018 09:09:56 +0000 (10:09 +0100)]
vshCommandOpt: Do more checking if skipChecks is set

Currently if cmd->skipChecks is set (done only from completers)
some basic checks are skipped because we're working over
partially parsed command. See a26ff63ae4 for more detailed
explanation. Anyway, the referenced commit was too aggressive in
disabling checks and effectively returned success even in clear
case of failure. For instance:

  # domif-getlink --interface <TAB><TAB>

causes virshDomainInterfaceCompleter() to be called, which calls
virshDomainGetXML() which eventually calls
vshCommandOptStringReq(.., name = "domain"); The --domain
argument is required for the command and if not present -1 should
be returned to tell the caller the argument was not found. Well,
zero is returned meaning the argument was not found but it's not
required either.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovz: fix ref/unref of domain obj in vzDomainRevertToSnapshot
Nikolay Shirokovskiy [Wed, 28 Feb 2018 06:31:49 +0000 (09:31 +0300)]
vz: fix ref/unref of domain obj in vzDomainRevertToSnapshot

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
7 years agovirsh: fixing segfault by pool autocompleter function.
Julio Faracco [Wed, 28 Feb 2018 01:17:54 +0000 (22:17 -0300)]
virsh: fixing segfault by pool autocompleter function.

The commands which requires a pool to perform any action for a volume is
throwing a segfault when you pass the volume name before a pool name or
without the argument '--pool'.

An example that works:
virsh # vol-list loops-pool
 Name                 Path
-------------------------------------------------------------------
 loop0                /mnt/loop0

virsh # vol-info --pool loops-pool lo<TAB>

An example that does not work:
virsh # vol-list loops-pool
 Name                 Path
-------------------------------------------------------------------
 loop0                /mnt/loop0

virsh # vol-info lo<TAB>
Segmentation Fault

The example 'vol-info' can be executed as 'vol-info loop0 --pool
loops-pool'. So, this commit fixes this problem when the arguments are
inverted and avoids the segfault.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemu: fix memory leak of @vporttype during migration.
Zhangzijian [Wed, 28 Feb 2018 01:18:23 +0000 (01:18 +0000)]
qemu: fix memory leak of @vporttype during migration.

12 bytes in 1 blocks are definitely lost in loss record 188 of 1,145
at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x5D2CD77: xmlStrndup (in /lib/x86_64-linux-gnu/libxml2.so.2.7.8)
by 0x514E137: virXMLPropString (virxml.c:506)
by 0x234F51: qemuMigrationCookieNetworkXMLParse qemu_migration.c:1001)
by 0x235FF8: qemuMigrationCookieXMLParse (qemu_migration.c:1333)
by 0x236214: qemuMigrationCookieXMLParseStr (qemu_migration.c:1372)
by 0x2365D2: qemuMigrationEatCookie (qemu_migration.c:1456)
by 0x243DBA: qemuMigrationFinish (qemu_migration.c:6381)
by 0x204032: qemuDomainMigrateFinish3 (qemu_driver.c:13228)
by 0x521CCBB: virDomainMigrateFinish3 (libvirt-domain.c:4788)
by 0x1936DE: remoteDispatchDomainMigrateFinish3 (remote.c:4580)
by 0x16DBB1: remoteDispatchDomainMigrateFinish3Helper(remote_dispatch.h:7582)

Signed-off-by: ZhangZijian <zhang.zijian@h3c.com>
7 years agonwfilter: save error from DHCP snoop thread to report in main thread
Laine Stump [Fri, 23 Feb 2018 01:29:20 +0000 (20:29 -0500)]
nwfilter: save error from DHCP snoop thread to report in main thread

A problem encountered due to a bug in libpcap was reported to the
caller as:

   An error occurred, but the cause is unknown

This was because the error had been logged in the DHCPSnoop
thread. The worker thread handling the API call to start a domain
spins up the DHCPSnoop thread which watches for dhcp packets with
libpcap, then uses virCondSignal() to notify the worker thread (which
has been waiting with virCondWait()). The worker thread knows that
there was an error (because threadStatus != THREAD_STATUS_OK), but the
error info had been stored in thread-specific storage for the other
thread, so the worker thread can only report that there was a failure,
but it doesn't know why.

The solution is to save the error that was logged (with
virErrorPreserveLast() into the object the is used to share info
between the threads, then we can set the error in the worker thread
using virErrorRestore().

In the case of the error I was looking at, this changed the "unknown"
message into:

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

Signed-off-by: Laine Stump <laine@laine.org>
7 years agostorage: fix sheepdog driver / test linking to avoid duplicating source
Daniel P. Berrangé [Mon, 26 Feb 2018 17:54:12 +0000 (17:54 +0000)]
storage: fix sheepdog driver / test linking to avoid duplicating source

The libvirt_storage_backend_sheepdog_priv.la library depends on symbols
provided in the libvirt_driver_storage_impl.la library. As such the
latter must be listed 2nd when passed to the linker to avoid symbol
resolution problems. This mistake is being masked by the sheepdog
driver linking in a second copy of the storage driver code. Remove
this duplicate linkage of backend source and fix the test link order.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: fix uninstall of subdirectory data
Daniel P. Berrangé [Mon, 26 Feb 2018 16:56:03 +0000 (16:56 +0000)]
make: fix uninstall of subdirectory data

A typo in the uninstall-data-extra rule expansion meant we just called
the install rule again, instead of the uninstall rule. While fixing
this, just inline the dependancy, since the intermediate
install-data-extra rule adds no value.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agopo: refresh translations from zanata
Daniel P. Berrangé [Tue, 27 Feb 2018 14:11:44 +0000 (14:11 +0000)]
po: refresh translations from zanata

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agolxc: fix rpc event leak on error path in virLXCControllerEventSend
Nikolay Shirokovskiy [Mon, 26 Feb 2018 11:13:50 +0000 (14:13 +0300)]
lxc: fix rpc event leak on error path in virLXCControllerEventSend

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
7 years agodaemon: fix rpc event leak on error path in remoteDispatchObjectEventSend
Nikolay Shirokovskiy [Mon, 26 Feb 2018 11:13:49 +0000 (14:13 +0300)]
daemon: fix rpc event leak on error path in remoteDispatchObjectEventSend

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
7 years agovz: build fix: handle missing switch enum cases
Nikolay Shirokovskiy [Mon, 26 Feb 2018 09:25:51 +0000 (12:25 +0300)]
vz: build fix: handle missing switch enum cases

Ensure all enum cases are listed in switch statements, or cast away
enum type in places where we don't wish to cover all cases.

Build is broken after 67966ad51 [1].

[1] m4: enforce that all enum cases are listed in switch statements

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
7 years agovz: build fix after excluding cross driver headers
Nikolay Shirokovskiy [Mon, 26 Feb 2018 09:25:50 +0000 (12:25 +0300)]
vz: build fix after excluding cross driver headers

Build is broken by 5529b057 [1].

[1] cfg: forbid includes of headers in network and storage drivers again

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
7 years agoqemu: Add virConnectPtr back to some migration methods
Michal Privoznik [Mon, 26 Feb 2018 09:20:06 +0000 (10:20 +0100)]
qemu: Add virConnectPtr back to some migration methods

This partially reverts 82592551cb8c4112cfa2264d50b8dce5349533d5.

When migrating a domain, qemuMigrationDstPrepareAny() is called
which eventually calls qemuProcessLaunch(conn = NULL, flags =
VIR_QEMU_PROCESS_START_AUTODESTROY); But the very first thing
that qemuProcessLaunch does is check if AUTODESTROY flag is set
and @conn is not NULL. Well, it is.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoqemuProcessLaunch: Print all arguments to debug
Michal Privoznik [Mon, 26 Feb 2018 08:37:31 +0000 (09:37 +0100)]
qemuProcessLaunch: Print all arguments to debug

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoqemuMigrationSrcIsSafe: Check local storage more thoroughly
Michal Privoznik [Mon, 26 Feb 2018 08:35:25 +0000 (09:35 +0100)]
qemuMigrationSrcIsSafe: Check local storage more thoroughly

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

If a domain disk is stored on local filesystem (e.g. ext4) but is
not being migrated it is very likely that domain is not able to
run on destination. Regardless of share/cache mode.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agolibxl: round memory values to next 1MiB increment
Jim Fehlig [Thu, 22 Feb 2018 01:48:38 +0000 (18:48 -0700)]
libxl: round memory values to next 1MiB increment

libxl requires the memory sizes to be rounded to 1MiB increments.
Attempting to start a domain that violates this requirement will
fail with the marginally helpful error

2018-02-22 01:55:32.921+0000: xc: panic: xc_dom_boot.c:141: xc_dom_boot_mem_init: can't allocate low memory for domain: Out of memory
2018-02-22 01:55:32.921+0000: libxl: libxl_dom.c:671:libxl__build_dom: xc_dom_boot_mem_init failed: No such file or directory

Round the maximum and current memory values to the next 1MiB
increment when generating the libxl_domain_config object.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
7 years agomake: split lxc driver build rules into lxc/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split lxc driver build rules into lxc/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split vz driver build rules into vz/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split vz driver build rules into vz/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split xenapi driver build rules into xenapi/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split xenapi driver build rules into xenapi/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split xen driver build rules into xen/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split xen driver build rules into xen/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split libxl driver build rules into libxl/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split libxl driver build rules into libxl/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split xenconfig driver build rules into xenconfig/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split xenconfig driver build rules into xenconfig/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split bhyve driver build rules into bhyve/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split bhyve driver build rules into bhyve/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split qemu driver build rules into qemu/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split qemu driver build rules into qemu/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split openvz driver build rules into openvz/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split openvz driver build rules into openvz/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split vbox driver build rules into vbox/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split vbox driver build rules into vbox/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split vmware driver build rules into vmware/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split vmware driver build rules into vmware/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomake: split hyperv driver build rules into hyperv/Makefile.inc.am
Daniel P. Berrangé [Wed, 21 Feb 2018 18:05:56 +0000 (18:05 +0000)]
make: split hyperv driver build rules into hyperv/Makefile.inc.am

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>