]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agoconfigure: move TLS priority check to its own file
Pavel Hrdina [Wed, 14 Dec 2016 15:33:57 +0000 (16:33 +0100)]
configure: move TLS priority check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move default editor check to its own file
Pavel Hrdina [Fri, 9 Dec 2016 10:04:33 +0000 (11:04 +0100)]
configure: move default editor check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move loader/nvram check to its own file
Pavel Hrdina [Thu, 15 Dec 2016 12:39:21 +0000 (13:39 +0100)]
configure: move loader/nvram check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move chrdev lock files check to its own file
Pavel Hrdina [Tue, 13 Dec 2016 12:45:25 +0000 (13:45 +0100)]
configure: move chrdev lock files check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move sysctl config check to its own file
Pavel Hrdina [Tue, 29 Nov 2016 07:33:19 +0000 (08:33 +0100)]
configure: move sysctl config check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move numad check to its own file
Pavel Hrdina [Mon, 12 Dec 2016 12:54:35 +0000 (13:54 +0100)]
configure: move numad check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move DTrace check to its own file
Pavel Hrdina [Wed, 30 Nov 2016 13:34:57 +0000 (14:34 +0100)]
configure: move DTrace check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: group all library checks together
Pavel Hrdina [Thu, 15 Dec 2016 13:56:29 +0000 (14:56 +0100)]
configure: group all library checks together

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt-parted: use LIBVIRT_CHECK_PKG
Pavel Hrdina [Mon, 12 Dec 2016 12:46:19 +0000 (13:46 +0100)]
m4/virt-parted: use LIBVIRT_CHECK_PKG

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move libparted check to its own file
Pavel Hrdina [Mon, 12 Dec 2016 12:34:56 +0000 (13:34 +0100)]
configure: move libparted check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt-devmapper: use LIBVIRT_CHECK_(PKG|LIB)
Pavel Hrdina [Mon, 12 Dec 2016 12:33:42 +0000 (13:33 +0100)]
m4/virt-devmapper: use LIBVIRT_CHECK_(PKG|LIB)

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move devmapper check to its own file
Pavel Hrdina [Sun, 11 Dec 2016 15:00:39 +0000 (16:00 +0100)]
configure: move devmapper check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move pm-utils check to its own file
Pavel Hrdina [Mon, 12 Dec 2016 09:12:13 +0000 (10:12 +0100)]
configure: move pm-utils check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move nwfilter check to its own file
Pavel Hrdina [Tue, 6 Dec 2016 15:00:41 +0000 (16:00 +0100)]
configure: move nwfilter check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move version script check to one place
Pavel Hrdina [Thu, 8 Dec 2016 13:12:18 +0000 (14:12 +0100)]
configure: move version script check to one place

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move windres check to its own file
Pavel Hrdina [Tue, 6 Dec 2016 12:57:12 +0000 (13:57 +0100)]
configure: move windres check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move windows symbols check to its own file
Pavel Hrdina [Tue, 6 Dec 2016 12:56:38 +0000 (13:56 +0100)]
configure: move windows symbols check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move MinGW check to its own file
Pavel Hrdina [Tue, 6 Dec 2016 12:55:50 +0000 (13:55 +0100)]
configure: move MinGW check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move Cygwin check to its own file
Pavel Hrdina [Tue, 6 Dec 2016 12:54:36 +0000 (13:54 +0100)]
configure: move Cygwin check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move windows common check to its own file
Pavel Hrdina [Thu, 15 Dec 2016 10:48:38 +0000 (11:48 +0100)]
configure: move windows common check to its own file

This renames MSCOM_LIBS to WIN32_EXTRA_LIBS to make it consistent with
WIN32_EXTRA_CFLAGS.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move libnl check to its own file
Pavel Hrdina [Mon, 12 Dec 2016 09:07:24 +0000 (10:07 +0100)]
configure: move libnl check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move virtualport check to its own file
Pavel Hrdina [Tue, 13 Dec 2016 11:40:48 +0000 (12:40 +0100)]
configure: move virtualport check to its own file

This patch moves the virtualport result out of *Driver* section because
it's not a driver.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move macvtap check to its own file
Pavel Hrdina [Mon, 12 Dec 2016 08:59:15 +0000 (09:59 +0100)]
configure: move macvtap check to its own file

This patch moves the macvtap result out of *Driver* section because
it's not a driver.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt-libpcap: error out if asked for libpcap but it was not found
Pavel Hrdina [Thu, 8 Dec 2016 14:01:01 +0000 (15:01 +0100)]
m4/virt-libpcap: error out if asked for libpcap but it was not found

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt-libpcap: remove unreasonable dependency on QEMU
Pavel Hrdina [Mon, 12 Dec 2016 08:57:37 +0000 (09:57 +0100)]
m4/virt-libpcap: remove unreasonable dependency on QEMU

Libpcap is used by nwfilter driver and it could be build without QEMU
driver.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move libpcap check to its own file
Pavel Hrdina [Fri, 9 Dec 2016 10:01:47 +0000 (11:01 +0100)]
configure: move libpcap check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move XDR check to its own file
Pavel Hrdina [Tue, 13 Dec 2016 11:40:30 +0000 (12:40 +0100)]
configure: move XDR check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move atomic check to its own file
Pavel Hrdina [Thu, 15 Dec 2016 10:47:20 +0000 (11:47 +0100)]
configure: move atomic check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move pthread check it its own file
Pavel Hrdina [Mon, 12 Dec 2016 07:07:08 +0000 (08:07 +0100)]
configure: move pthread check it its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move polkit check to its own file
Pavel Hrdina [Mon, 12 Dec 2016 07:05:18 +0000 (08:05 +0100)]
configure: move polkit check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move firewalld check to its own file
Pavel Hrdina [Mon, 14 Nov 2016 14:34:40 +0000 (15:34 +0100)]
configure: move firewalld check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move with-driver-modules check to its own file
Pavel Hrdina [Mon, 14 Nov 2016 14:34:04 +0000 (15:34 +0100)]
configure: move with-driver-modules check to its own file

Rename DRIVER_MODULE_(LDFLAGS|LIBS|CFLAGS) to unify the naming.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move dlopen check to its own file
Pavel Hrdina [Fri, 11 Nov 2016 23:20:21 +0000 (00:20 +0100)]
configure: move dlopen check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt-libxml: use LIBVIRT_CHECK_PKG
Pavel Hrdina [Mon, 19 Dec 2016 14:26:17 +0000 (15:26 +0100)]
m4/virt-libxml: use LIBVIRT_CHECK_PKG

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt-libxml: use only pkg-config to check for libxml2
Pavel Hrdina [Mon, 19 Dec 2016 14:16:05 +0000 (15:16 +0100)]
m4/virt-libxml: use only pkg-config to check for libxml2

Pkg-config file libxml-2.0.pc was introduced in libxml2-2.2.4 and we
require at least 2.6.0 so the crazy xml2-config check can be dropped.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move libxml check to its own file
Pavel Hrdina [Mon, 19 Dec 2016 14:11:06 +0000 (15:11 +0100)]
configure: move libxml check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt-lib: add new parameter to override default fail action
Pavel Hrdina [Fri, 11 Nov 2016 23:13:30 +0000 (00:13 +0100)]
m4/virt-lib: add new parameter to override default fail action

This allows to use two or more LIBVIRT_CHECK_(LIB|LIB_ALT|PKG) macros
for one library.  For example, when we check for existence of
pgk-config file of some library and we know that not all versions of
that library that libvirt requires provides this file, we can fallback
to use library check.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt: introduce LIBVIRT_ARG_* macros for all library checks
Pavel Hrdina [Mon, 12 Dec 2016 17:11:51 +0000 (18:11 +0100)]
m4/virt: introduce LIBVIRT_ARG_* macros for all library checks

Usage of AC_REQUIRE will mess with order how LIBVIRT_CHECK_* macros
are composed into configure.ac.  This ensures that the output of
configure --help is properly ordered and grouped into sections.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt-lib: move LIBVIRT_ARG_WITH out of LIBVIRT_CHECK_(LIB|LIB_ALT|PKG)
Pavel Hrdina [Wed, 23 Nov 2016 12:22:25 +0000 (13:22 +0100)]
m4/virt-lib: move LIBVIRT_ARG_WITH out of LIBVIRT_CHECK_(LIB|LIB_ALT|PKG)

Following patch will update LIBVIRT_CHECK_(LIB|LIB_ALT|PKG) macros in
a way that you will be able to call a another macro as a fallback if
the first one fails.  To allow that, we need to move the
LIBVIRT_ARG_WITH out of those macro to not have two or more same lines
in output of "configure --help".

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: use LIBVIRT_ARG_ENABLE macro
Pavel Hrdina [Tue, 13 Dec 2016 12:34:42 +0000 (13:34 +0100)]
configure: use LIBVIRT_ARG_ENABLE macro

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: use LIBVIRT_ARG_WITH(_ALT) macros
Pavel Hrdina [Mon, 14 Nov 2016 14:25:41 +0000 (15:25 +0100)]
configure: use LIBVIRT_ARG_WITH(_ALT) macros

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt-lib: introduce LIBVIRT_ARG_ENABLE macro
Pavel Hrdina [Tue, 13 Dec 2016 12:14:39 +0000 (13:14 +0100)]
m4/virt-lib: introduce LIBVIRT_ARG_ENABLE macro

This macro helps create unified output of "configure --help".

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt-lib: introduce LIBVIRT_ARG_WITH(_ALT) macro
Pavel Hrdina [Sat, 12 Nov 2016 13:10:45 +0000 (14:10 +0100)]
m4/virt-lib: introduce LIBVIRT_ARG_WITH(_ALT) macro

These macros help create unified output of "configure --help".

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt: use LIBVIRT_RESULT macro instead of AC_MSG_NOTICE
Pavel Hrdina [Wed, 14 Dec 2016 15:55:30 +0000 (16:55 +0100)]
m4/virt: use LIBVIRT_RESULT macro instead of AC_MSG_NOTICE

The LIBVIRT_RESULT does a nice formatting of the output and ensures
that the format is unified.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt: create result macros for the remaining virt check
Pavel Hrdina [Wed, 14 Dec 2016 15:51:30 +0000 (16:51 +0100)]
m4/virt: create result macros for the remaining virt check

All checks that prints result at the end of configure uses
LIBVIRT_RESULT_${CHECK_NAME}.  Create those macros for remaining check.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move external programs check to its own file
Pavel Hrdina [Tue, 13 Dec 2016 12:47:07 +0000 (13:47 +0100)]
configure: move external programs check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: fix wireshark dissector configure output
Pavel Hrdina [Tue, 13 Dec 2016 11:40:05 +0000 (12:40 +0100)]
configure: fix wireshark dissector configure output

Commit 373973206aa moved wireshark dissector code to its own file but
forgot to properly update configure.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt-netcf: fix bug where we overwrite LIBS
Pavel Hrdina [Thu, 15 Dec 2016 21:53:31 +0000 (22:53 +0100)]
m4/virt-netcf: fix bug where we overwrite LIBS

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoxen: add QED format test
Cédric Bosdonnat [Mon, 19 Dec 2016 09:13:35 +0000 (10:13 +0100)]
xen: add QED format test

Follow up of commit 340bb6b7 to add unit tests for the QED format
support. Also add missing QED case in xenFormatXLDisk()

8 years agoapparmor: pass attach_disconnected
Guido Günther [Mon, 19 Dec 2016 07:15:15 +0000 (08:15 +0100)]
apparmor: pass attach_disconnected

to cure

 + virsh lxc-enter-namespace --noseclabel sl /bin/ls /bin/ls
 libvirt:  error : Expected at least one file descriptor
 error: internal error: Child process (2714) unexpected exit status 125

caused by

 apparmor="DENIED" operation="open" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/libvirtd" name="" pid=1422 comm="libvirtd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

8 years agovirsh: Allow display of the physical volume size
John Ferlan [Tue, 29 Nov 2016 18:25:42 +0000 (13:25 -0500)]
virsh: Allow display of the physical volume size

Add a new qualifier '--physical' to the 'vol-info' command in order to
dispaly the physical size of the volume. The size can differ from the
allocation value depending on the volume file time. In particular, qcow2
volumes will have a physical value larger than allocation. This also occurs
for sparse files, although for those the capacity is the largest size;
whereas, for qcow2 capacity is the logical size.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agostorage: Introduce virStorageVolInfoFlags
John Ferlan [Tue, 29 Nov 2016 15:44:36 +0000 (10:44 -0500)]
storage: Introduce virStorageVolInfoFlags

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

This function will essentially be a wrapper to virStorageVolInfo in order
to provide a mechanism to have the "physical" size of the volume returned
instead of the "allocation" size. This will provide similar capabilities to
the virDomainBlockInfo which can return both allocation and physical of a
domain storage volume.

NB: Since we're reusing the _virStorageVolInfo and not creating a new
_virStorageVolInfoFlags structure, we'll need to generate the rpc APIs
remoteStorageVolGetInfoFlags and remoteDispatchStorageVolGetInfoFlags
(although both were originally created from gendispatch.pl and then
just copied into daemon/remote.c and src/remote/remote_driver.c).

The new API will allow the usage of a VIR_STORAGE_VOL_GET_PHYSICAL flag
and will make the decision to return the physical or allocation value
into the allocation field.

In order to get that physical value, virStorageBackendUpdateVolTargetInfoFD
adds logic to fill in physical value matching logic in qemuStorageLimitsRefresh
used by virDomainBlockInfo when the domain is inactive.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoconf: Display <physical> in output of voldef
John Ferlan [Tue, 13 Dec 2016 15:56:21 +0000 (10:56 -0500)]
conf: Display <physical> in output of voldef

Although the virStorageBackendUpdateVolTargetInfo will update the
target.physical value, there is no way to provide that information
via the virStorageGetVolInfo API since it only returns the capacity
and allocation of a volume. So as described in commit id '0282ca45',
it should be possible to generate an output only <physical> value
for that purpose.

This patch generates the <physical> value in the volume XML output
for the sole purpose of being able to view/see the value to allow
someone to parse the XML in order to obtain the value.

Update the documentation to describe the output only nature.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: Adjust qemuDomainGetBlockInfo data for sparse backed files
John Ferlan [Mon, 12 Dec 2016 22:12:09 +0000 (17:12 -0500)]
qemu: Adjust qemuDomainGetBlockInfo data for sparse backed files

According to commit id '0282ca45a' the 'physical' value should
essentially be the last offset of the image or the host physical
size in bytes of the image container. However, commit id '15fa84ac'
refactored the GetBlockInfo to use the same returned data as the
GetStatsBlock API for an active domain. For the 'entry->physical'
that would end up being the "actual-size" as set through the
qemuMonitorJSONBlockStatsUpdateCapacityOne (commit '7b11f5e5').
Digging deeper into QEMU code one finds that actual_size is
filled in using the same algorithm as GetBlockInfo has used for
setting the 'allocation' field when the domain is inactive.

The difference in values is seen primarily in sparse raw files
and other container type files (such as qcow2), which will return
a smaller value via the stat API for 'st_blocks'. Additionally
for container files, the 'capacity' field (populated via the
QEMU "virtual-size" value) may be slightly different (smaller)
in order to accomodate the overhead for the container. For
sparse files, the state 'st_size' field is returned.

This patch thus alters the allocation and physical values for
sparse backed storage files to be more appropriate to the API
contract. The result for GetBlockInfo is the following:

 capacity: logical size in bytes of the image (how much storage
           the guest will see)
 allocation: host storage in bytes occupied by the image (such
             as highest allocated extent if there are no holes,
             similar to 'du')
 physical: host physical size in bytes of the image container
           (last offset, similar to 'ls')

NB: The GetStatsBlock API allows a different contract for the
values:

 "block.<num>.allocation" - offset of the highest written sector
                            as unsigned long long.
 "block.<num>.capacity" - logical size in bytes of the block device
                          backing image as unsigned long long.
 "block.<num>.physical" - physical size in bytes of the container
                          of the backing image as unsigned long long.

8 years agoexamples: Resolve sign-compare warnings
Michal Privoznik [Tue, 20 Dec 2016 09:29:52 +0000 (10:29 +0100)]
examples: Resolve sign-compare warnings

For instance:

hellolibvirt/hellolibvirt.c: In function 'showDomains':
hellolibvirt/hellolibvirt.c:100:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < numNames; i++) {
                   ^

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agotests: Add tests for disk configuration validation
Marc Hartmayer [Tue, 29 Nov 2016 12:11:32 +0000 (13:11 +0100)]
tests: Add tests for disk configuration validation

Add tests for controller based disks to check disk address compatibility
with disk bus types.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
8 years agoconf: Detect misconfiguration between disk bus and disk address
Marc Hartmayer [Tue, 29 Nov 2016 12:11:31 +0000 (13:11 +0100)]
conf: Detect misconfiguration between disk bus and disk address

This patch detects a misconfiguration between the disk bus type and disk
address type for controller based disk buses (SATA, SCSI, FDC and
IDE). The addresses of these bus types are all managed in common code so
it's possible to decide in common code whether the disk address and bus
type are compatible or not.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
8 years agoqemu: qemuDomainDiskChangeSupported: Add missing 'address' check
Marc Hartmayer [Tue, 6 Dec 2016 14:30:13 +0000 (15:30 +0100)]
qemu: qemuDomainDiskChangeSupported: Add missing 'address' check

Disk->info is not live updatable so add a check for this. Otherwise
libvirt reports success even though no data was updated.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agoconf: Make virDomainDeviceInfoAddressIsEqual() public
Marc Hartmayer [Tue, 6 Dec 2016 14:30:12 +0000 (15:30 +0100)]
conf: Make virDomainDeviceInfoAddressIsEqual() public

This function will be needed by the QEMU driver in an upcoming
patch. Additionally, removed a useless empty line.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
8 years agocgroup: reduce complexity of controller disabling
Boris Fiuczynski [Thu, 8 Dec 2016 13:24:18 +0000 (14:24 +0100)]
cgroup: reduce complexity of controller disabling

This patch reduces the complexity of the filtering algorithm in
virCgroupDetect by first correcting the controller mask and then
checking for potential co-mounts without any correlating
controller mask modifications.

If you agree that this patch removes complexity and improves
readability it could simply be squashed into the first patch
of this series.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
8 years agocgroup: unavailable controller prevents controller disabling
Boris Fiuczynski [Thu, 8 Dec 2016 13:24:17 +0000 (14:24 +0100)]
cgroup: unavailable controller prevents controller disabling

The cgroup controller filtering in virCgroupDetect does not work
properly if the following conditions are met:
1) the host system does not have a cgroup controller which
libvirt requests (unavailable controller) and
2) libvirt is configured to disable a controller (disabled controller) and
3) the disabled controller is located before the unavailable controller
in virCgroupController.

As an example: The memory controller is unavailable and the cpuset
controller is configured to be disabled.
In this scenario trying to start a domain results in the error
error: Controller 'cpuset' is not wanted, but 'memory' is co-mounted: Invalid argument

This error occurs when virCgroupDetect is called with a valid parent group.
The resulting group created by virCgroupCopyMounts holds for cpuset and
memory controller empty mount points. The filtering of disabled controllers
checks for co-mounts by comparing the mount points. The cpuset controller
causes the filtering to occur before the memory controller is marked as to be
ignored by modifying the controller mask since it is unavailable.
Therefore the co-mount detection logic compares the cpuset and memory controller
mount points and since both are empty the memory controller is regarded
erroneously as being co-mounted.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agolocking: Fix documentation on how automatic sanlock leases are stored
Peter Krempa [Thu, 15 Dec 2016 14:22:19 +0000 (15:22 +0100)]
locking: Fix documentation on how automatic sanlock leases are stored

s/MD5 checkout/MD5 hash/

8 years agoqemu: blockcopy: Save monitor error prior to calling into lock manager
Peter Krempa [Thu, 15 Dec 2016 14:09:47 +0000 (15:09 +0100)]
qemu: blockcopy: Save monitor error prior to calling into lock manager

The error would be overwritten otherwise producing a meaningless error
message.

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

8 years agodocs: link to news file and other resources
Daniel P. Berrange [Wed, 14 Dec 2016 09:22:14 +0000 (09:22 +0000)]
docs: link to news file and other resources

In the website reorg we accidentally lost all links to the nice
reformatted news.html file. Add a link on the front page, and
also extend the download page table so that it includes links
to API docs and news files for each module (where available)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoPoint to the new libvirt-go bindings
Daniel P. Berrange [Tue, 13 Dec 2016 17:05:16 +0000 (17:05 +0000)]
Point to the new libvirt-go bindings

The github.com/rgbkrk/libvirt-go bindings were the most complete
bindings historically, but their API coverage stops at 1.2.4,
with exception of a couple of newer APIs.

The new bindings at http://libvirt.org/git/?p=libvirt-go.git;a=log
how have (almost[1]) 100% API coverage all the way to 2.5.0. They also
expose the APIs in a way that allows for much stronger go type
checking by the compiler, and expose typed parameters as explicit
structs. Finally the bindings are able to conditionally compile against
any libvirt version 1.2.0 -> 2.5.0 without use of go build tags.

Change the docs to point to these new bindings, since they'll be
a better bet for users long term.

[1] virEvent & virStream callbacks are still TODO to be fixed
    real soon.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonetwork: Add support for local PTR domains
Jiri Denemark [Thu, 8 Dec 2016 21:23:09 +0000 (22:23 +0100)]
network: Add support for local PTR domains

Similarly to localOnly DNS domain, localPtr attribute can be used to
tell the DNS server not to forward reverse lookups for unknown IPs which
belong to the virtual network.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoutil: Introduce virSocketAddrPTRDomain
Jiri Denemark [Thu, 8 Dec 2016 21:21:39 +0000 (22:21 +0100)]
util: Introduce virSocketAddrPTRDomain

The API creates PTR domain which corresponds to a given addr/prefix.
Both IPv4 and IPv6 addresses are supported, but the prefix must be
divisible by 8 for IPv4 and divisible by 4 for IPv6.

The generated PTR domain has the following format

IPv4: 1.2.3.4.in-addr.arpa
IPv6: 0.1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.0.1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.ip6.arpa

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoconf: Make virNetworkIPDefParseXML a little bit saner
Jiri Denemark [Thu, 8 Dec 2016 13:05:16 +0000 (14:05 +0100)]
conf: Make virNetworkIPDefParseXML a little bit saner

Iterating over all child nodes when we only support one instance of each
child is pretty weird. And it would even cause memory leaks if more
than one <tftp> element was specified.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: block copy: Forbid block copy to relative paths
Peter Krempa [Fri, 16 Dec 2016 17:30:39 +0000 (18:30 +0100)]
qemu: block copy: Forbid block copy to relative paths

Similarly to 29bb066915 forbid paths used with blockjobs to be relative.

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

8 years agovirfile: Support bind mount only on linux
Michal Privoznik [Thu, 15 Dec 2016 15:06:15 +0000 (16:06 +0100)]
virfile: Support bind mount only on linux

Other systems (despite having sys/mount.h) do not support bind
mounts.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Mark more namespace code linux-only
Michal Privoznik [Thu, 15 Dec 2016 15:06:14 +0000 (16:06 +0100)]
qemu: Mark more namespace code linux-only

Some of the functions are not called on non-linux platforms
which makes them useless there.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoconfigure: Link witch -lacl only on linux
Michal Privoznik [Thu, 15 Dec 2016 15:06:13 +0000 (16:06 +0100)]
configure: Link witch -lacl only on linux

There's no -lacl on FreeBSD.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoMake use of PERF_COUNT_HW_REF_CPU_CYCLES conditional
Daniel P. Berrange [Fri, 16 Dec 2016 10:30:27 +0000 (10:30 +0000)]
Make use of PERF_COUNT_HW_REF_CPU_CYCLES conditional

The PERF_COUNT_HW_REF_CPU_CYCLES constant is not available
on all Linux distros libvirt targets, so its use must be
made conditional. Other constant have existed long enough
that we can assume they exist, as we don't support very
old distros like RHEL-5 any more.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agodocs: document cpu host-passthrough migration issue
Jason J. Herne [Fri, 9 Dec 2016 19:38:35 +0000 (14:38 -0500)]
docs: document cpu host-passthrough migration issue

Documents in formatdomain.html that when migrating a guest
defined with the host-passthrough CPU model from a machine that
is running on a newer CPU model than the destination machine's
CPU model, it is very likely that the guest will crash upon
arrival.

Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
8 years agoperf: add ref_cpu_cycles perf event support
Nitesh Konkar [Tue, 13 Dec 2016 16:01:41 +0000 (21:31 +0530)]
perf: add ref_cpu_cycles perf event support

This patch adds support and documentation for
the ref_cpu_cycles perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agoperf: add stalled_cycles_backend perf event support
Nitesh Konkar [Tue, 13 Dec 2016 16:01:40 +0000 (21:31 +0530)]
perf: add stalled_cycles_backend perf event support

This patch adds support and documentation for
the stalled_cycles_backend perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agoperf: add stalled_cycles_frontend perf event support
Nitesh Konkar [Tue, 13 Dec 2016 16:01:39 +0000 (21:31 +0530)]
perf: add stalled_cycles_frontend perf event support

This patch adds support and documentation
for the stalled_cycles_frontend perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agoperf: add bus_cycles perf event support
Nitesh Konkar [Tue, 13 Dec 2016 16:01:38 +0000 (21:31 +0530)]
perf: add bus_cycles perf event support

This patch adds support and documentation
for the bus_cycles perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agoadmin: Update the news file to include the new logging features
Erik Skultety [Fri, 25 Nov 2016 07:57:00 +0000 (08:57 +0100)]
admin: Update the news file to include the new logging features

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoadmin: Add an example demonstrating how to use the logging APIs
Erik Skultety [Thu, 24 Nov 2016 13:04:11 +0000 (14:04 +0100)]
admin: Add an example demonstrating how to use the logging APIs

Provide a simple C example demonstrating the use of both query APIs as
well as setter APIs.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirt-admin: Wire-up the logging APIs
Erik Skultety [Wed, 9 Mar 2016 14:12:55 +0000 (15:12 +0100)]
virt-admin: Wire-up the logging APIs

Finally, now that all APIs have been introduced, wire them up to virt-admin
and introduce daemon-log-outputs and daemon-log-filters commands.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoadmin: Introduce virAdmConnectSetLoggingFilters
Erik Skultety [Wed, 30 Mar 2016 13:14:54 +0000 (15:14 +0200)]
admin: Introduce virAdmConnectSetLoggingFilters

Enable libvirt users to modify logging filters of a daemon from outside.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoadmin: Introduce virAdmConnectSetLoggingOutputs
Erik Skultety [Tue, 8 Mar 2016 12:37:56 +0000 (13:37 +0100)]
admin: Introduce virAdmConnectSetLoggingOutputs

Enable libvirt users to modify daemon's logging output settings from outside.
If either an empty string or NULL is passed, a default logging output will be
used the same way as it would be in case writing an empty string to the
libvirtd.conf

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoadmin: Introduce virAdmConnectGetLoggingFilters
Erik Skultety [Fri, 4 Mar 2016 21:58:55 +0000 (22:58 +0100)]
admin: Introduce virAdmConnectGetLoggingFilters

Enable libvirt users to query logging filter settings.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoadmin: Introduce virAdmConnectGetLoggingOutputs
Erik Skultety [Fri, 4 Mar 2016 22:00:40 +0000 (23:00 +0100)]
admin: Introduce virAdmConnectGetLoggingOutputs

Enable libvirt users to query logging output settings.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agodaemon: Hook up the virLog{Get,Set}DefaultOutput to the daemon's init routine
Erik Skultety [Mon, 31 Oct 2016 11:52:51 +0000 (12:52 +0100)]
daemon: Hook up the virLog{Get,Set}DefaultOutput to the daemon's init routine

Now that virLog{Get,Set}DefaultOutput routines are introduced we can wire them
up to the daemon's logging initialization code. Also, change the order of
operations a bit so that we still strictly honor our precedence of settings:
cmdline > env > config now that outputs and filters are not appended anymore.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoadmin: Allow passing NULL to virLogSetOutputs
Erik Skultety [Fri, 25 Nov 2016 10:50:51 +0000 (11:50 +0100)]
admin: Allow passing NULL to virLogSetOutputs

Along with an empty string, it should also be possible for users to pass
NULL to the public APIs which in turn would trigger a routine(future
work) responsible for defining an appropriate default logging output
given the current circumstances.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Introduce virLog{Get,Set}DefaultOutput
Erik Skultety [Mon, 31 Oct 2016 11:50:24 +0000 (12:50 +0100)]
virlog: Introduce virLog{Get,Set}DefaultOutput

These helpers will manage the log destination defaults (fetch/set). The reason
for this is to stay consistent with the current daemon's behaviour with respect
to /etc/libvirt/<daemon>.conf file, since both assignment of an empty string
or not setting the log output variable at all trigger the daemon's decision on
the default log destination which depends on whether the daemon runs daemonized
or not.
This patch also changes the logic of the selection of the default
logging output compared to how it is done now. The main difference though is
that we should only really care if we're running daemonized or not, disregarding
the fact of (not) having a TTY completely (introduced by commit eba36a3878) as
that should be of the libvirtd's parent concern (what FD it will pass to it).

 Before:
 if (godaemon || !hasTTY):
     if (journald):
         use journald

 if (godaemon):
     if (privileged):
         use SYSCONFIG/libvirtd.log
     else:
         use XDG_CONFIG_HOME/libvirtd.log
 else:
     use stderr

 After:
 if (godaemon):
     if (journald):
         use journald

     else:
         if (privileged):
             use SYSCONFIG/libvirtd.log
         else:
             use XDG_CONFIG_HOME/libvirtd.log
 else:
     use stderr

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoqemu: snapshot: Don't attempt to resume cpus if they were not paused
Peter Krempa [Wed, 14 Dec 2016 07:01:34 +0000 (08:01 +0100)]
qemu: snapshot: Don't attempt to resume cpus if they were not paused

External disk-only snapshots with recent enough qemu don't require
libvirt to pause the VM. The logic determining when to resume cpus was
slightly flawed and attempted to resume them even if they were not
paused by the snapshot code. This normally was not a problem, but with
locking enabled the code would attempt to acquire the lock twice.

The fallout of this bug would be a error from the API, but the actual
snapshot being created. The bug was introduced with when adding support
for external snapshots with memory (checkpoints) in commit f569b87.

Resolves problems described by:
https://bugzilla.redhat.com/show_bug.cgi?id=1403691

8 years agoqemu: monitor: Don't resume lockspaces in resume event handler
Peter Krempa [Wed, 14 Dec 2016 07:42:43 +0000 (08:42 +0100)]
qemu: monitor: Don't resume lockspaces in resume event handler

After qemu delivers the resume event it's already running and thus it's
too late to enter lockspaces since it may already have modified the
disk. The code only creates false log entries in the case when locking
is enabled. The lockspace needs to be acquired prior to starting cpus.

8 years agoqemu: Enable mount namespace
Michal Privoznik [Tue, 6 Dec 2016 16:35:12 +0000 (17:35 +0100)]
qemu: Enable mount namespace

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

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Let users opt-out from containerization
Michal Privoznik [Fri, 18 Nov 2016 15:34:45 +0000 (16:34 +0100)]
qemu: Let users opt-out from containerization

Given how intrusive previous patches are, it might happen that
there's a bug or imperfection. Lets give users a way out: if they
set 'namespaces' to an empty array in qemu.conf the feature is
suppressed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Manage /dev entry on RNG hotplug
Michal Privoznik [Fri, 18 Nov 2016 14:19:12 +0000 (15:19 +0100)]
qemu: Manage /dev entry on RNG hotplug

When attaching a device to a domain that's using separate mount
namespace we must maintain /dev entries in order for qemu process
to see them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Manage /dev entry on chardev hotplug
Michal Privoznik [Fri, 18 Nov 2016 13:53:27 +0000 (14:53 +0100)]
qemu: Manage /dev entry on chardev hotplug

When attaching a device to a domain that's using separate mount
namespace we must maintain /dev entries in order for qemu process
to see them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Manage /dev entry on hostdev hotplug
Michal Privoznik [Wed, 16 Nov 2016 14:27:47 +0000 (15:27 +0100)]
qemu: Manage /dev entry on hostdev hotplug

When attaching a device to a domain that's using separate mount
namespace we must maintain /dev entries in order for qemu process
to see them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Manage /dev entry on disk hotplug
Michal Privoznik [Tue, 15 Nov 2016 15:53:04 +0000 (16:53 +0100)]
qemu: Manage /dev entry on disk hotplug

When attaching a device to a domain that's using separate mount
namespace we must maintain /dev entries in order for qemu process
to see them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Enter the namespace on relabelling
Michal Privoznik [Wed, 23 Nov 2016 10:52:57 +0000 (11:52 +0100)]
qemu: Enter the namespace on relabelling

Instead of trying to fix our security drivers, we can use a
simple trick to relabel paths in both namespace and the host.
I mean, if we enter the namespace some paths are still shared
with the host so any change done to them is visible from the host
too.
Therefore, we can just enter the namespace and call
SetAllLabel()/RestoreAllLabel() from there. Yes, it has slight
overhead because we have to fork in order to enter the namespace.
But on the other hand, no complexity is added to our code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Prepare RNGs when starting a domain
Michal Privoznik [Tue, 15 Nov 2016 15:10:23 +0000 (16:10 +0100)]
qemu: Prepare RNGs when starting a domain

When starting a domain and separate mount namespace is used, we
have to create all the /dev entries that are configured for the
domain.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Prepare inputs when starting a domain
Michal Privoznik [Tue, 15 Nov 2016 15:03:02 +0000 (16:03 +0100)]
qemu: Prepare inputs when starting a domain

When starting a domain and separate mount namespace is used, we
have to create all the /dev entries that are configured for the
domain.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Prepare TPM when starting a domain
Michal Privoznik [Tue, 15 Nov 2016 14:25:15 +0000 (15:25 +0100)]
qemu: Prepare TPM when starting a domain

When starting a domain and separate mount namespace is used, we
have to create all the /dev entries that are configured for the
domain.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>