Commit Graph

28614 Commits

Author SHA1 Message Date
Andrea Bolognani
a68ba68330 qemu: Take full advantage of conditional device property probing
Commit 4ae59411fa 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>
2018-03-08 16:05:46 +01:00
John Ferlan
4b1ec66cde 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>
2018-03-08 08:54:02 -05:00
Peter Krempa
6a59d6c103 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>
2018-03-08 14:29:50 +01:00
Peter Krempa
1e6e34b144 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>
2018-03-08 14:29:50 +01:00
Peter Krempa
15948e6266 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>
2018-03-08 14:29:50 +01:00
Peter Krempa
e7c44b3f7c 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>
2018-03-08 14:29:49 +01:00
Peter Krempa
183f96314d 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>
2018-03-08 14:29:49 +01:00
Peter Krempa
74942ff0b6 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>
2018-03-08 14:29:49 +01:00
Christian Ehrhardt
b932ed69f6
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>
2018-03-07 18:03:36 +01:00
Erik Skultety
87c991d51e 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>
2018-03-07 17:31:36 +01:00
Ján Tomko
1cdc9ecebd 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>
2018-03-07 14:10:46 +01:00
Michal Privoznik
c17666419b 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>
2018-03-07 12:27:03 +01:00
Bjoern Walk
b704d60e89 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>
2018-03-06 08:55:32 -05:00
Bjoern Walk
a07a9146bb 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>
2018-03-06 08:55:12 -05:00
Shalini Chellathurai Saroja
ab9e2041c0 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>
2018-03-06 06:38:09 -05:00
Daniel P. Berrangé
874306dde1 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>
2018-03-06 10:09:44 +00:00
Erik Skultety
b4fad8ec16 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>
2018-03-06 09:20:58 +01:00
Daniel P. Berrangé
a32600f3ce 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>
2018-03-05 18:46:24 +00:00
Daniel P. Berrangé
1b884e6411 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>
2018-03-05 17:55:17 +00:00
Daniel P. Berrangé
57232c8d62 gnulib: update to latest upstream changeset
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:55:05 +00:00
Daniel P. Berrangé
61efbbaf94 make: split vmx driver build rules into vmx/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:12:01 +00:00
Daniel P. Berrangé
9cd0bdd1a1 make: split util build rules into util/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:12:01 +00:00
Daniel P. Berrangé
d7d96a6d14 make: split RPC build rules into rpc/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:12:01 +00:00
Daniel P. Berrangé
7cbca93011 make: split admin driver build rules into admin/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:12:01 +00:00
Daniel P. Berrangé
d77f35a5ae make: split lock daemon build rules into locking/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:12:01 +00:00
Daniel P. Berrangé
efb021c8d8 make: split logging daemon build rules into logging/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:12:01 +00:00
Daniel P. Berrangé
3c1e95e6ff make: split access driver build rules into access/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:12:01 +00:00
Daniel P. Berrangé
95d8489ff3 make: split security driver build rules into security/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:12:01 +00:00
Daniel P. Berrangé
240c62ae50 make: split CPU build rules into cpu/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:12:01 +00:00
Daniel P. Berrangé
ed30a13c4b make: split XML conf build rules into conf/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:12:01 +00:00
Daniel P. Berrangé
124f06534c make: split remote driver & daemon build rules into remote/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:12:00 +00:00
Daniel P. Berrangé
d9da08b759 make: split storage driver build rules into storage/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:11:02 +00:00
Daniel P. Berrangé
d3d8b1bca8 make: split secret driver build rules into secret/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:09:49 +00:00
Daniel P. Berrangé
c6d59fb935 make: split nodedev driver build rules into node_device/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:09:48 +00:00
Daniel P. Berrangé
684388d902 make: split nwfilter driver build rules into nwfilter/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:09:08 +00:00
Daniel P. Berrangé
6d1d414c36 make: split network driver build rules into network/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:08:36 +00:00
Daniel P. Berrangé
09e771c376 make: split interface driver build rules into interface/Makefile.inc.am
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 17:08:35 +00:00
Jan Palus
43523d7421 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>
2018-03-05 16:49:50 +00:00
Andrea Bolognani
11819aee65 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>
2018-03-05 17:29:40 +01:00
Daniel P. Berrangé
11c0aadb38 Post-release version bump to 4.2.0
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 15:02:51 +00:00
Daniel P. Berrangé
c9c9fc90ce 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>
2018-03-05 13:26:51 +00:00
Ján Tomko
444f15adb8 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>
2018-03-05 13:25:20 +01:00
Ján Tomko
dc824c6128 vboxDumpNetwork: use switch for adapterType
Also return an error when VIR_STRDUP fails.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-03-05 12:57:47 +01:00
Ján Tomko
1b75e8c5fa 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>
2018-03-05 12:57:47 +01:00
Ján Tomko
21f91fc5f6 vboxDumpNetwork: use a switch for attachmentType
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-03-05 12:57:47 +01:00
Ján Tomko
0310d97ac5 vboxDumpNetwork: Use a single utf8 temp variable
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-03-05 12:57:47 +01:00
Ján Tomko
56a3f5659a 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>
2018-03-05 12:57:47 +01:00
Ján Tomko
6a4b096c66 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>
2018-03-05 12:57:47 +01:00
Ján Tomko
4226024bfb 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>
2018-03-05 12:57:47 +01:00
Ján Tomko
3b4f2924d8 vboxDumpNetworks: delete pointless comment
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-03-05 12:57:47 +01:00