]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agotests: fix compilation of shunloadtest
Jim Fehlig [Mon, 16 Jan 2017 17:58:00 +0000 (10:58 -0700)]
tests: fix compilation of shunloadtest

While local builds succeed fine, a build worker building in a
chroot environment is encountering the following error with
libvirt 3.0.0 release candidates

[  162s] shunloadtest.o: In function `main':
[  162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:110: undefined reference to `dlopen'
[  162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:114: undefined reference to `dlsym'
[  162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:133: undefined reference to `dlclose'
[  162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:111: undefined reference to `dlerror'
[  162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:115: undefined reference to `dlerror'
[  162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:116: undefined reference to `dlclose'

Fix by appending DLOPEN_LIBS to shunloadtest_LDADD.

8 years agodocs: Add news.xml entry for pool --uuid and --name adjustments
John Ferlan [Wed, 18 Jan 2017 14:16:35 +0000 (09:16 -0500)]
docs: Add news.xml entry for pool --uuid and --name adjustments

8 years agovirsh: pool-list: allow both --uuid and --name in one cmd
Chen Hanxiao [Fri, 6 Jan 2017 14:42:53 +0000 (22:42 +0800)]
virsh: pool-list: allow both --uuid and --name in one cmd

This patch will allow --uuid and --name in one cmd.
The pool's UUID and name will be printed side by side.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agovirsh: pool-list: introduce --name for printing pool's name only
Chen Hanxiao [Fri, 6 Jan 2017 14:42:52 +0000 (22:42 +0800)]
virsh: pool-list: introduce --name for printing pool's name only

This patch will introduce option --name.
If specified, only name of pools will be printed out.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agovirsh: pool-list: introduce --uuid for printing pool's UUID only
Chen Hanxiao [Fri, 6 Jan 2017 14:42:51 +0000 (22:42 +0800)]
virsh: pool-list: introduce --uuid for printing pool's UUID only

This patch will introduce option --uuid.
If specified, only UUID of pools will be printed out.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agonodedev: Fabric name must not be required for fc_host capability
Boris Fiuczynski [Mon, 16 Jan 2017 13:27:34 +0000 (14:27 +0100)]
nodedev: Fabric name must not be required for fc_host capability

fabric_name is one of many fc_host attributes in Linux that is optional
and left to the low-level driver to decide if it is implemented.
The zfcp device driver does not provide a fabric name for an fcp host.

This patch removes the requirement for a fabric name by making it optional.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agoutil: add file exists check in virReadFCHost
Boris Fiuczynski [Mon, 16 Jan 2017 13:27:33 +0000 (14:27 +0100)]
util: add file exists check in virReadFCHost

File open errors are prevented by a file exists check before
virFileReadAll is called since all callers of the virReadFCHost
method handle errors themselves based on the NULL return anyway.
Also included is a minor spelling correction in a comment.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agodisk: Fixup error handling path for devmapper when part_separator='yes'
John Ferlan [Tue, 15 Nov 2016 19:37:01 +0000 (14:37 -0500)]
disk: Fixup error handling path for devmapper when part_separator='yes'

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

If libvirt_parthelper is erroneously told to append the partition
separator 'p' onto the generated output for a disk pool using device
mapper that has 'user_friendly_names' set to true, then the error
recovery path will fail to find volume resulting in the pool being
in an unusable state.

So, augment the documentation to provide the better hint that the
part_separator='yes' should be set when user_friendly_names are not
being used. Additionally, once we're in the error path where the
returned name doesn't match the expected partition name try to see
if the reason is because the 'p' was erroneosly added. If so alter
the about to be removed vol->target.path so that the DiskDeleteVol
code can find the partition that was created and remove it.

8 years agostorage: Allow probe of volume capacity for BLOCK type
John Ferlan [Tue, 6 Dec 2016 23:37:46 +0000 (18:37 -0500)]
storage: Allow probe of volume capacity for BLOCK type

If the voldef type is VIR_STORAGE_VOL_BLOCK, then as long as the
format is known, let's allow the probe to happen - gets a truer value
and the same probe/update would be allowed for the same volume defined
in a domain.

8 years agostorage: Fix virStorageBackendUpdateVolTargetInfo type check
John Ferlan [Tue, 6 Dec 2016 11:17:20 +0000 (06:17 -0500)]
storage: Fix virStorageBackendUpdateVolTargetInfo type check

For volume processing in virStorageBackendUpdateVolTargetInfo to get
the capacity commit id 'a760ba3a7' added the ability to probe a volume
that didn't list a target format. Unfortunately, the code used the
virStorageSource  (e.g. target->type - virStorageType) rather than
virStorageVolDef (e.g. vol->type - virStorageVolType) in order to
make the comparison. As it turns out target->type for a volume is
not filled in at all for a voldef as the code relies on vol->type.
Ironically the result is that only VIR_STORAGE_VOL_BLOCK's would get
their capacity updated.

This patch will adjust the code to check the "vol->type" field instead
as an argument. This way for a voldef, the correct comparison is made.

Additionally for a backingStore, the 'type' field is never filled in;
however, since we know that the provided path is a location at which
the backing store can be accessed on the local filesystem thus just
pass VIR_STORAGE_VOL_FILE in order to satisfy the adjusted voltype
check. Whether it's a FILE or a BLOCK only matters if we're trying to
get more data based on the target->format.

8 years agoPost-release version bump to 3.1.0
Michal Privoznik [Wed, 18 Jan 2017 10:53:56 +0000 (11:53 +0100)]
Post-release version bump to 3.1.0

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agotests: Distribute qemuhotplugtestcpus
Michal Privoznik [Wed, 18 Jan 2017 10:42:59 +0000 (11:42 +0100)]
tests: Distribute qemuhotplugtestcpus

Starting from a245abce436f4f333 another set of tests for
qemuhotplugtest has been introduced. This time for vcpu hotplug.
However, the test data (which live in qemuhotplugtestcpus dir)
are not being distributed properly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agospec: Depend on the gluster command line tool
Peter Krempa [Tue, 10 Jan 2017 17:08:44 +0000 (18:08 +0100)]
spec: Depend on the gluster command line tool

The gluster command line tool that is used to lookup storage pool
sources moved from the gluster-client package to gluster-cli.

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

8 years agostorage: gluster: Remove build-time dependency on the 'gluster' cli tool
Peter Krempa [Mon, 9 Jan 2017 14:56:12 +0000 (15:56 +0100)]
storage: gluster: Remove build-time dependency on the 'gluster' cli tool

The tool is used for pool discovery. Since we call an external binary we
don't really need to compile out the code that uses it. We can check
whether it exists at runtime.

8 years agostorage: gluster: Report error if no volumes were found in pool lookup
Peter Krempa [Tue, 10 Jan 2017 17:35:03 +0000 (18:35 +0100)]
storage: gluster: Report error if no volumes were found in pool lookup

Similarly to the 'netfs' pool, return an error if the host does not have
any volumes.

8 years agostorage: Fix error reporting when looking up storage pool sources
Peter Krempa [Tue, 10 Jan 2017 17:29:54 +0000 (18:29 +0100)]
storage: Fix error reporting when looking up storage pool sources

In commit 4090e15399 we went back from reporting no errors if no storage
pools were found on a given host to reporting a bad error. And only in
cases when gluster was not installed.

Report a less bad error in case there are no volumes. Also report the
error when gluster is installed but no volumes were found, since
virStorageBackendFindGlusterPoolSources would return success in that
case.

8 years agotests: hotplug: Test CPU hotplug with ppc64 data
Peter Krempa [Fri, 9 Dec 2016 15:52:16 +0000 (16:52 +0100)]
tests: hotplug: Test CPU hotplug with ppc64 data

Add a positive test and few negative tests.

8 years agotests: hotplug: Add test data for legacy cpu hotplug
Peter Krempa [Fri, 9 Dec 2016 14:54:54 +0000 (15:54 +0100)]
tests: hotplug: Add test data for legacy cpu hotplug

Test that the old approach generates correct commands.

8 years agotests: hotplug: Add test infrastructure for testing qemu CPU hotplug code
Peter Krempa [Sun, 4 Dec 2016 18:08:25 +0000 (19:08 +0100)]
tests: hotplug: Add test infrastructure for testing qemu CPU hotplug code

The cpu hotplug operation is rather complex so the testing code needs to
provide quite lot of data and monitor conversations to successfully test
it. The code mainly tests the selection of cpus according to the target
count request.

8 years agotests: qemu: Add helper to load full monitor conversation from file
Peter Krempa [Wed, 30 Nov 2016 13:43:50 +0000 (14:43 +0100)]
tests: qemu: Add helper to load full monitor conversation from file

Similar to the existing qemuMonitorTestNewFromFile the *Full version
will allow to check both commands and supply responses for a better
monitor testing.

8 years agotests: qemu: monitor: Add helpers to test full command syntax
Peter Krempa [Fri, 25 Nov 2016 09:43:23 +0000 (10:43 +0100)]
tests: qemu: monitor: Add helpers to test full command syntax

Add test monitor infrastructure that will test the commands verbatim
rather than trying to do any smart handling.

8 years agotests: qemumonitor: Propagate better error messages
Peter Krempa [Thu, 1 Dec 2016 08:22:44 +0000 (09:22 +0100)]
tests: qemumonitor: Propagate better error messages

8 years agoqemu: Move cpu hotplug code into qemu_hotplug.c
Peter Krempa [Thu, 24 Nov 2016 15:56:56 +0000 (16:56 +0100)]
qemu: Move cpu hotplug code into qemu_hotplug.c

Move all the worker code into the appropriate file. This will also allow
testing of cpu hotplug.

8 years agoqemu: Prepare for reuse of qemuDomainSetVcpusLive
Peter Krempa [Wed, 9 Nov 2016 14:03:34 +0000 (15:03 +0100)]
qemu: Prepare for reuse of qemuDomainSetVcpusLive

Extract the call to qemuDomainSelectHotplugVcpuEntities outside of
qemuDomainSetVcpusLive and decide whether to hotplug or unplug the
entities specified by the cpumap using a boolean flag.

This will allow to use qemuDomainSetVcpusLive in cases where we prepare
the list of vcpus to enable or disable by other means.

8 years agotests: qemu: Document qemuMonitorTestNewFromFile
Peter Krempa [Wed, 30 Nov 2016 08:58:12 +0000 (09:58 +0100)]
tests: qemu: Document qemuMonitorTestNewFromFile

8 years agoutil: json: Add helper to reformat JSON strings
Peter Krempa [Wed, 30 Nov 2016 09:46:57 +0000 (10:46 +0100)]
util: json: Add helper to reformat JSON strings

For use in test cases it will be helpful to allow reformatting JSON
strings. Add a wrapper on top of the parser and formatter to achieve
this.

8 years agoqemu: monitor: More strict checking of 'query-cpus' if hotplug is supported
Peter Krempa [Sun, 4 Dec 2016 17:53:03 +0000 (18:53 +0100)]
qemu: monitor: More strict checking of 'query-cpus' if hotplug is supported

In cases where CPU hotplug is supported by qemu force the monitor to
reject invalid or broken responses to 'query-cpus'. It's expected that
the command returns usable data in such case.

8 years agonews: Fix xml dump of autogenerated websocket
Nikolay Shirokovskiy [Wed, 18 Jan 2017 07:21:44 +0000 (10:21 +0300)]
news: Fix xml dump of autogenerated websocket

8 years agoRelease of libvirt-3.0.0
Daniel Veillard [Tue, 17 Jan 2017 18:07:00 +0000 (19:07 +0100)]
Release of libvirt-3.0.0

8 years agotests: fix QED disk test in xlconfigtest
Jim Fehlig [Mon, 16 Jan 2017 18:31:42 +0000 (11:31 -0700)]
tests: fix QED disk test in xlconfigtest

When LIBXL_HAVE_QED is defined, xlconfigtest fails

 9) Xen XL-2-XML Format disk-qed  ... command line: config parsing error
 in disk specification: no vdev specified in
 `target=/var/lib/libvirt/images/XenGuest2,format=qed,backendtype=qdisk,vdev=hda,access=rw'
FAILED

As per the xl-disk-configuration(5) man page, target= must come
last in the disk specification when specified by name:

When this parameter is specified by name, ie with the target=
syntax in the configuration file, it consumes the whole rest of the
DISKSPEC including trailing whitespaces.  Therefore in that case
it must come last.

Change tests/xlconfigdata/test-disk-qed.cfg to adhere to this
restriction.

8 years agosecurity: SELinux: fix the transaction model's list append
Erik Skultety [Tue, 17 Jan 2017 11:22:14 +0000 (12:22 +0100)]
security: SELinux: fix the transaction model's list append

The problem is in the way how the list item is created prior to
appending it to the transaction list - the @path argument is just a
shallow copy instead of deep copy of the hostdev device's path.
Unfortunately, the hostdev devices from which the @path is extracted, in
order to add them into the transaction list, are only temporary and
freed before the buildup of the qemu namespace, thus making the @path
attribute in the transaction list NULL, causing 'permission denied' or
'double free' or 'unknown cause' errors.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agosecurity: DAC: fix the transaction model's list append
Erik Skultety [Tue, 17 Jan 2017 11:21:27 +0000 (12:21 +0100)]
security: DAC: fix the transaction model's list append

The problem is in the way how the list item is created prior to
appending it to the transaction list - the @path attribute is just a
shallow copy instead of deep copy of the hostdev device's path.
Unfortunately, the hostdev devices from which the @path is extracted, in
order to add them into the transaction list, are only temporary and
freed before the buildup of the qemu namespace, thus making the @path
attribute in the transaction list NULL, causing 'permission denied' or
'double free' or 'unknown cause' errors.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoqemu: Don't leak hostCPUModelInfo in virQEMUCaps
Jiri Denemark [Tue, 17 Jan 2017 13:34:23 +0000 (14:34 +0100)]
qemu: Don't leak hostCPUModelInfo in virQEMUCaps

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Actually unshare() iff running as root
Michal Privoznik [Tue, 17 Jan 2017 11:15:16 +0000 (12:15 +0100)]
qemu: Actually unshare() iff running as root

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

While all the code that deals with qemu namespaces correctly
detects whether we are running as root (and turn into NO-OP for
qemu:///session) the actual unshare() call is not guarded with
such check. Therefore any attempt to start a domain under
qemu:///session shall fail as unshare() is reserved for root.

The fix consists of moving unshare() call (for which we have a
wrapper called virProcessSetupPrivateMountNS) into
qemuDomainBuildNamespace() where the proper check is performed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
8 years agoRevert "perf: Add cache_l1d perf event support"
Daniel P. Berrange [Mon, 16 Jan 2017 16:54:34 +0000 (16:54 +0000)]
Revert "perf: Add cache_l1d perf event support"

This reverts commit ae16c95f1bb5591c27676c5de8d383e5612c3568.

8 years agonews: document events changes and lxc fix
Daniel P. Berrange [Wed, 11 Jan 2017 16:32:59 +0000 (16:32 +0000)]
news: document events changes and lxc fix

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonews: Add support for guest CPU configuration on s390
Jiri Denemark [Fri, 13 Jan 2017 16:25:33 +0000 (17:25 +0100)]
news: Add support for guest CPU configuration on s390

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agostorage: Alter error message in probe/empty checks
John Ferlan [Fri, 13 Jan 2017 12:33:02 +0000 (07:33 -0500)]
storage: Alter error message in probe/empty checks

For case VIR_STORAGE_BLKID_PROBE_DIFFERENT, clean up the message to
avoid using the virsh like --overwrite syntax. Additionally provide
a different error message when not writing the label to avoid confusion.

8 years agostorage: Clean up return value checking
John Ferlan [Fri, 13 Jan 2017 12:34:03 +0000 (07:34 -0500)]
storage: Clean up return value checking

Rather than special casing the VIR_STORAGE_BLKID_PROBE_UNKNOWN after
calling virStorageBackendBLKIDFindPart, just allow the switch statement
handle setting ret = -2.

8 years agostorage: Alter logic when both BLKID and PARTED unavailable
John Ferlan [Fri, 13 Jan 2017 00:29:40 +0000 (19:29 -0500)]
storage: Alter logic when both BLKID and PARTED unavailable

If neither BLKID or PARTED is available and we're not writing, then
just return 0 which allows the underlying storage pool to generate
a failure. If both are unavailable and we're writing, then generate
a more generic error message.

8 years agodocs: add entry for aggregation of pcie-root-ports to news.xml
Laine Stump [Fri, 13 Jan 2017 15:27:05 +0000 (10:27 -0500)]
docs: add entry for aggregation of pcie-root-ports to news.xml

8 years agoqemu-capabilities: Fix query-cpu-model-expansion on s390 with older kernel
Collin L. Walling [Thu, 12 Jan 2017 16:18:11 +0000 (11:18 -0500)]
qemu-capabilities: Fix query-cpu-model-expansion on s390 with older kernel

When running on s390 with a kernel that does not support cpu model checking and
with a Qemu new enough to support query-cpu-model-expansion, the gathering of qemu
capabilities will fail. Qemu responds to the query-cpu-model-expansion qmp
command with an error because the needed kernel ioct does not exist. When this
happens a guest cannot even be defined due to missing qemu capabilities data.

This patch fixes the problem by silently ignoring generic errors stemming from
calls to query-cpu-model-expansion.

Reported-by: Farhan Ali <alifm@linux.vnet.ibm.com>
Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
8 years agoqemu: Copy SELinux labels for namespace too
Michal Privoznik [Fri, 13 Jan 2017 09:03:23 +0000 (10:03 +0100)]
qemu: Copy SELinux labels for namespace too

When creating new /dev/* for qemu, we do chown() and copy ACLs to
create the exact copy from the original /dev. I though that
copying SELinux labels is not necessary as SELinux will chose the
sane defaults. Surprisingly, it does not leaving namespace with
the following labels:

crw-rw-rw-. root root system_u:object_r:tmpfs_t:s0     random
crw-------. root root system_u:object_r:tmpfs_t:s0     rtc0
drwxrwxrwt. root root system_u:object_r:tmpfs_t:s0     shm
crw-rw-rw-. root root system_u:object_r:tmpfs_t:s0     urandom

As a result, domain is unable to start:

error: internal error: process exited while connecting to monitor: Error in GnuTLS initialization: Failed to acquire random data.
qemu-kvm: cannot initialize crypto: Unable to initialize GNUTLS library: Failed to acquire random data.

The solution is to copy the SELinux labels as well.

Reported-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agodocs: Fix libvirt_guest nss module name
Michal Privoznik [Fri, 13 Jan 2017 10:41:11 +0000 (11:41 +0100)]
docs: Fix libvirt_guest nss module name

In the documentation we are mixing libvirt-guest and
libvirt_guest module name. The correct name is the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoRevert "storage: Validate the device formats at logical startup"
Peter Krempa [Thu, 12 Jan 2017 13:04:09 +0000 (14:04 +0100)]
Revert "storage: Validate the device formats at logical startup"

The check is pointless since LVM is capable to detect it's own members
and the check is flawed as it would fail if neither libblkid nor parted
is installed.

We don't really need to babysit LVM in this way.

This reverts commit cb38b6cbc7e35e7ee92a7f54828f21261227d17a.

8 years agoRevert "storage: For FS pool check for properly formatted target volume"
Peter Krempa [Thu, 12 Jan 2017 12:50:19 +0000 (13:50 +0100)]
Revert "storage: For FS pool check for properly formatted target volume"

The check does not work properly (crashes) with netfs filesystems and
also checking that a device is not empty when attempting to mount a
filesystem is not very usefull since the mount will fail anyways.

As the code would improve only a very minor corner case I don't really
see a reason to have this code at all.

This code would also fail if libvirt is compiled without support for
blkid and without parted.

This reverts commit a11fd69735e6951cda9bf256d8e423696a441aa4.

8 years agolibxl: always enable pae for x86_64 HVM
Jim Fehlig [Thu, 12 Jan 2017 00:42:42 +0000 (17:42 -0700)]
libxl: always enable pae for x86_64 HVM

For HVM domains, pae is only set in libxl_domain_build_info when
explicitly specified in the hypervisor <features> config. This is
fine for i686 machines, but is incorrect behavior for x86_64 machines
where pae must always be enabled. See the following discussion for
additional details

https://www.redhat.com/archives/libvir-list/2017-January/msg00254.html

8 years agodocs: Document <sndbuf/>
Michal Privoznik [Thu, 12 Jan 2017 11:43:21 +0000 (12:43 +0100)]
docs: Document <sndbuf/>

This element has been introduced in fe053dbea7, but isn't
documented yet. After exactly 6 years I guess we can finally
document it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonews: document libxl HVM network attach fix
Joao Martins [Thu, 12 Jan 2017 12:02:55 +0000 (12:02 +0000)]
news: document libxl HVM network attach fix

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
8 years agoqemu: Ignore non-boolean CPU model properties
Jiri Denemark [Wed, 11 Jan 2017 13:35:52 +0000 (14:35 +0100)]
qemu: Ignore non-boolean CPU model properties

The query-cpu-model-expansion is currently implemented for s390(x) only
and all CPU properties it returns are booleans. However, x86
implementation will report more types of properties. Without making the
code more tolerant older libvirt would fail to probe newer QEMU
versions.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Don't check CPU model property key
Jiri Denemark [Wed, 11 Jan 2017 13:29:58 +0000 (14:29 +0100)]
qemu: Don't check CPU model property key

The qemuMonitorJSONParseCPUModelProperty function is a callback for
virJSONValueObjectForeachKeyValue and is called for each key/value pair,
thus it doesn't really make sense to check whether key is NULL.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agonews: document drive addresses fix
Marc Hartmayer [Thu, 12 Jan 2017 09:58:34 +0000 (10:58 +0100)]
news: document drive addresses fix

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
8 years agonews: Reflect hugepages patch
Michal Privoznik [Wed, 11 Jan 2017 16:56:21 +0000 (17:56 +0100)]
news: Reflect hugepages patch

In f55afd8 I've made libvirt to construct hugepage path on
per-domain basis. However, this change was not reflected in
the NEWS file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainCreateDevice: Canonicalize paths
Michal Privoznik [Wed, 11 Jan 2017 16:32:46 +0000 (17:32 +0100)]
qemuDomainCreateDevice: Canonicalize paths

So far the decision whether /dev/* entry is created in the qemu
namespace is really simple: does the path starts with "/dev/"?
This can be easily fooled by providing path like the following
(for any considered device like disk, rng, chardev, ..):

  /dev/../var/lib/libvirt/images/disk.qcow2

Therefore, before making the decision the path should be
canonicalized.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Use namespaces iff available on the host kernel
Michal Privoznik [Wed, 11 Jan 2017 10:05:50 +0000 (11:05 +0100)]
qemu: Use namespaces iff available on the host kernel

So far the namespaces were turned on by default unconditionally.
For all non-Linux platforms we provided stub functions that just
ignored whatever namespaces setting there was in qemu.conf and
returned 0 to indicate success. Moreover, we didn't really check
if namespaces are available on the host kernel.

This is suboptimal as we might have ignored user setting.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoutil: Introduce virFileMoveMount
Michal Privoznik [Wed, 11 Jan 2017 10:29:00 +0000 (11:29 +0100)]
util: Introduce virFileMoveMount

This is a simple wrapper over mount(). However, not every system
out there is capable of moving a mount point. Therefore, instead
of having to deal with this fact in all the places of our code we
can have a simple wrapper and deal with this fact at just one
place.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agolxc_container: Drop userns_supported
Michal Privoznik [Wed, 11 Jan 2017 09:45:44 +0000 (10:45 +0100)]
lxc_container: Drop userns_supported

This is unnecessary wrapper around virProcessNamespaceAvailable().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agolxc: Move lxcContainerAvailable to virprocess
Michal Privoznik [Wed, 11 Jan 2017 09:23:39 +0000 (10:23 +0100)]
lxc: Move lxcContainerAvailable to virprocess

Other drivers (like qemu) would like to know if the namespaces
are available therefore it makes sense to move this function to
a shared module.

At the same time, this function had some default namespaces that
are checked with every call. It is not necessary - let callers
pass just those namespaces they are interested in.

With the move the function is renamed to
virProcessNamespaceAvailable.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainSetupAllInputs: Update debug message
Michal Privoznik [Wed, 11 Jan 2017 14:16:06 +0000 (15:16 +0100)]
qemuDomainSetupAllInputs: Update debug message

Due to a copy-paste error, the debug message reads:

  Setting up disks

It should have been:

  Setting up inputs.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agodocs: Add logical storage pool overwrite change description to news.xml
John Ferlan [Wed, 11 Jan 2017 00:32:25 +0000 (19:32 -0500)]
docs: Add logical storage pool overwrite change description to news.xml

Add "New Features" entry to describe the overwrite flag for logical backend.

8 years agodocs: Add file system pool overwrite change description to news.xml
John Ferlan [Wed, 11 Jan 2017 00:30:04 +0000 (19:30 -0500)]
docs: Add file system pool overwrite change description to news.xml

Add bug fixes description of overwrite changes for a file system storage pool

8 years agodocs: Add NPIV/vHBA change description to news.xml
John Ferlan [Wed, 11 Jan 2017 00:35:10 +0000 (19:35 -0500)]
docs: Add NPIV/vHBA change description to news.xml

Add "Improvements" for commit id 'bb74a7ffe' and '78be2e8b7' which add
support for using the parent wwnn/wwpn or fabric_name rather than just
using the parent by scsi_hostX name.

8 years agodocs: Document the new vHBA/NPIV params for storage
John Ferlan [Wed, 11 Jan 2017 12:09:03 +0000 (07:09 -0500)]
docs: Document the new vHBA/NPIV params for storage

Commit id 'bb74a7ffe' forgot to adjust the storage docs to describe the
new fields.

8 years agolibxl: fix usb inputs loop error
Cédric Bosdonnat [Tue, 10 Jan 2017 16:09:03 +0000 (17:09 +0100)]
libxl: fix usb inputs loop error

List indexes where mixed up in the code looping over the USB
input devices.

8 years agoremote: do not check for an existing config dir
Pino Toscano [Tue, 10 Jan 2017 18:43:20 +0000 (19:43 +0100)]
remote: do not check for an existing config dir

When composing the path to the default known_hosts file (for the libssh
and libssh2 drivers), do not check whether the configuration directory
(determined by virGetUserConfigDirectory()) exists: both the drivers can
handle non-existing files, and are able to create them (and their
directories) in that case.

This adds a small behaviour change: before, the key for an unknown host,
and manually accepted, was saved only if the configuration directory
existed -- a bit incoherent behaviour though.

8 years agoremote: fix logic for known_hosts and keyfile checks
Pino Toscano [Tue, 10 Jan 2017 18:43:19 +0000 (19:43 +0100)]
remote: fix logic for known_hosts and keyfile checks

If any of them is specified for the libssh and libssh2 drivers, there is
no need to depend on checks based on other paths: in particular, a
specified path for known_hosts was ignored if the local config directory
could not be determined, and the path for keyfile was ignored if the
home could not be determined.

Instead, lazily determine and use these two paths only in case they are
needed.

8 years agorpc: libssh: allow a NULL known_hosts file
Pino Toscano [Tue, 10 Jan 2017 18:43:18 +0000 (19:43 +0100)]
rpc: libssh: allow a NULL known_hosts file

Make sure that virNetLibsshSessionSetHostKeyVerification accepts a NULL
value for the path to the known_hosts file:
- call ssh_options_set(SSH_OPTIONS_KNOWNHOSTS) anyway, using /dev/null,
  otherwise libssh will use its default path
- do not call ssh_write_knownhost when no known hosts file was set

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

8 years agoNEWS: Add trailing periods to all sentences
Andrea Bolognani [Tue, 10 Jan 2017 18:54:12 +0000 (19:54 +0100)]
NEWS: Add trailing periods to all sentences

Suggested-by: John Ferlan <jferlan@redhat.com>
8 years agoconf: eliminate virDomainPCIAddressReleaseSlot() in favor of ...Addr()
Laine Stump [Mon, 24 Oct 2016 15:25:53 +0000 (11:25 -0400)]
conf: eliminate virDomainPCIAddressReleaseSlot() in favor of ...Addr()

Surprisingly there was a virDomainPCIAddressReleaseAddr() function
already, but it was completely unused. Since we don't reserve entire
slots at once any more, there is no need to release entire slots
either, so we just replace the single call to
virDomainPCIAddressReleaseSlot() with a call to
virDomainPCIAddressReleaseAddr() and remove the now unused function.

The keen observer may be concerned that ...Addr() doesn't call
virDomainPCIAddressValidate(), as ...Slot() did. But really the
validation was pointless anyway - if the device hadn't been suitable
to be connected at that address, it would have failed validation
before every being reserved in the first place, so by definition it
will pass validation when it is being unplugged. (And anyway, even if
something "bad" happened and we managed to have a device incorrectly
at the given address, we would still want to be able to free it up for
use by a device that *did* validate properly).

8 years agoqemu: rename qemuDomainPCIAddressReserveNextSlot() to ...Addr()
Laine Stump [Mon, 24 Oct 2016 15:10:47 +0000 (11:10 -0400)]
qemu: rename qemuDomainPCIAddressReserveNextSlot() to ...Addr()

This function doesn't actually reserve an entire slot any more, it
reserves a single PCI address, so this name is more appropriate.

8 years agoqemu: remove qemuDomainPCIAddressReserveNextAddr()
Laine Stump [Sun, 23 Oct 2016 22:11:06 +0000 (18:11 -0400)]
qemu: remove qemuDomainPCIAddressReserveNextAddr()

This function is only called in two places, and the function itself is
just adding a single argument and calling
virDomainPCIAddressReserveNextAddr(), so we can remove it and instead
call virDomainPCIAddressReserveNextAddr() directly. (The main
motivation for doing this is to free up the name so that
qemuDomainPCIAddressReserveNextSlot() can be renamed in the next
patch, as its current name is now inaccurate and misleading).

8 years agoconf: rename virDomainPCIAddressReserveSlot() to ...Addr()
Laine Stump [Sun, 23 Oct 2016 16:14:16 +0000 (12:14 -0400)]
conf: rename virDomainPCIAddressReserveSlot() to ...Addr()

This function doesn't actually reserve an entire slot any more, it
reserves a single PCI address, so this name is more appropriate.

8 years agoconf: rename virDomainPCIAddressReserveAddr() to ...Internal()
Laine Stump [Sun, 23 Oct 2016 16:07:20 +0000 (12:07 -0400)]
conf: rename virDomainPCIAddressReserveAddr() to ...Internal()

This is in preparation for renaming virDomainPCIAddressReserveSlot()
to virDomainPCIAddressReserveAddr(), which is a better description of
what it does.

8 years agoconf: make virDomainPCIAddressReserveAddr() a static function
Laine Stump [Sun, 23 Oct 2016 16:03:47 +0000 (12:03 -0400)]
conf: make virDomainPCIAddressReserveAddr() a static function

It is now only used in domain_addr.c.

8 years agoqemu: replace virDomainPCIAddressReserveAddr with virDomainPCIAddressReserveSlot
Laine Stump [Sun, 23 Oct 2016 15:57:55 +0000 (11:57 -0400)]
qemu: replace virDomainPCIAddressReserveAddr with virDomainPCIAddressReserveSlot

All occurences of the former use fromConfig=true, and that's exactly
how virDomainPCIAddressReserveSlot() calls
virDomainPCIaddressReserveAddr(), so just use *Slot() so that *Addr()
can be made static to conf/domain_addr.c (both functions will be
renamed in upcoming patches).

8 years agoconf: eliminate virDomainPCIAddressReserveNextSlot()
Laine Stump [Sat, 22 Oct 2016 17:28:07 +0000 (13:28 -0400)]
conf: eliminate virDomainPCIAddressReserveNextSlot()

Since we don't actually reserve an entire slot at a time anymore, the
name of this function is just confusing, and it's almost identical in
operation to virDomainPCIAddressReserveNextAddr() anyway, so remove
the *Slot() function and replace calls to it with calls to *Addr(...,
-1).

8 years agoconf: rename virDomainPCIAddressGetNextSlot() to ...GetNextAddr()
Laine Stump [Sat, 22 Oct 2016 17:10:10 +0000 (13:10 -0400)]
conf: rename virDomainPCIAddressGetNextSlot() to ...GetNextAddr()

With the advent of VIR_PCI_CONNECT_AGGREGATE_SLOT, the new name is
more appropriate, since the address returned may be another address
on the same slot as last time, not necessarily a new slot.

8 years agoconf: fix fromConfig argument to virDomainPCIAddressValidate()
Laine Stump [Sat, 22 Oct 2016 16:53:17 +0000 (12:53 -0400)]
conf: fix fromConfig argument to virDomainPCIAddressValidate()

fromConfig should be true if the caller wants
virDomainPCIAddressValidate() to loosen restrictions on its
interpretation of the pciConnectFlags. In particular, either
PCI_DEVICE or PCIE_DEVICE will be counted as equivalent to both, and
HOTPLUG will be ignored. In a few cases where libvirt was manually
overriding automatic address assignment, it was setting fromConfig to
false when validating the hardcoded manual override. This patch
changes those to fromConfig=true as a preemptive strike against any
future bugs that might otherwise surface.

8 years agoconf: fix fromConfig argument to virDomainPCIAddressReserveAddr()
Laine Stump [Sat, 22 Oct 2016 16:35:38 +0000 (12:35 -0400)]
conf: fix fromConfig argument to virDomainPCIAddressReserveAddr()

Although setting virDomainPCIAddressReserveAddr()'s fromConfig=true is
correct when a PCI addres is coming from a domain's config, the *true*
purpose of the fromConfig argument is to lower restrictions on what
kind of device can plug into what kind of controller - if fromConfig
is true, then a PCIE_DEVICE can plug into a slot that is marked as
only compatible with PCI_DEVICE (and vice versa), and the HOTPLUG flag
is ignored.

For a long time there have been several calls to
virDomainPCIAddressReserveAddr() that have fromConfig incorrectly set
to false - it's correct that the addresses aren't coming from user
config, but they are coming from hardcoded exceptions in libvirt that
should, if anything, pay *even less* attention to following the
pciConnectFlags (under the assumption that the libvirt programmer knew
what they were doing).

See commit b87703cf7 for an example of an actual bug caused by the
incorrect setting of the "fromConfig" argument to
virDomainPCIAddressReserveAddr(). Although they haven't resulted in
any reported bugs, this patch corrects all the other incorrect
settings of fromConfig in calls to virDomainPCIAddressReserveAddr().

8 years agoconf: aggregate multiple pcie-root-ports onto a single slot
Laine Stump [Thu, 20 Oct 2016 19:46:01 +0000 (15:46 -0400)]
conf: aggregate multiple pcie-root-ports onto a single slot

Set the VIR_PCI_CONNECT_AGGREGATE_SLOT flag for pcie-root-ports so
that they will be assigned to all the functions on a slot.

Some qemu test case outputs had to be adjusted due to the
pcie-root-ports now being put on multiple functions.

8 years agoconf: aggregate multiple devices on a slot when assigning PCI addresses
Laine Stump [Wed, 19 Oct 2016 18:15:01 +0000 (14:15 -0400)]
conf: aggregate multiple devices on a slot when assigning PCI addresses

If a PCI device has VIR_PCI_CONNECT_AGGREGATE_SLOT set in its
pciConnectFlags, then during address assignment we allow multiple
instances of this type of device to be auto-assigned to multiple
functions on the same device. A slot is used for aggregating multiple
devices only if the first device assigned to that slot had
VIR_PCI_CONNECT_AGGREGATE_SLOT set. but any device types that have
AGGREGATE_SLOT set might be mix/matched on the same slot.

(NB: libvirt should never set the AGGREGATE_SLOT flag for a device
type that might need to be hotplugged. Currently it is only planned
for pcie-root-port and possibly other PCI controller types, and none
of those are hotpluggable anyway)

There aren't yet any devices that use this flag. That will be in a
later patch.

8 years agoqemu: use virDomainPCIAddressSetAllMulti() to set multi when needed
Laine Stump [Tue, 10 Jan 2017 05:20:11 +0000 (00:20 -0500)]
qemu: use virDomainPCIAddressSetAllMulti() to set multi when needed

If there are multiple devices assigned to the different functions of a
single PCI slot, they will not work properly if the device at function
0 doesn't have its "multi" attribute turned on, so it makes sense for
libvirt to turn it on during PCI address assignment. Setting multi
then assures that the new setting is stored in the config (so it will
be used next time the domain is started), preventing any potential
problems in the case that a future change in the configuration
eliminates the devices on all non-0 functions (multi will still be set
for function 0 even though it is the only function in use on the slot,
which has no useful purpose, but also doesn't cause any problems).

(NB: If we were to instead just decide on the setting for
multifunction at runtime, a later removal of the non-0 functions of a
slot would result in a silent change in the guest ABI for the
remaining device on function 0 (although it may seem like an
inconsequential guest ABI change, it *is* a guest ABI change to turn
off the multi bit).)

8 years agoconf: new function virDomainPCIAddressSetAllMulti()
Laine Stump [Tue, 10 Jan 2017 05:02:40 +0000 (00:02 -0500)]
conf: new function virDomainPCIAddressSetAllMulti()

This utility function iterates through all devices looking for any
with a PCI address that has function != 0 (which implies that multiple
functions are in use on that slot), then uses an inner iterator to
find the device that's on function 0 of that same slot and sets the
"multi" in its virDomainDeviceInfo (as long as it hasn't already been
set explicitly by someone who presumably has better information than
we do).

It isn't yet called from anywhere, so will have no functional effect.

8 years agoconf: start search for next unused PCI address at same slot as previous find
Laine Stump [Fri, 21 Oct 2016 17:05:33 +0000 (13:05 -0400)]
conf: start search for next unused PCI address at same slot as previous find

There is a very slight time advantage to beginning the search for the
next unused PCI address at the slot *after* the previous find (which
is now used), but if we do that, we will miss allocating the other
functions of the same slot (when we implement a
VIR_PCI_CONNECT_AGGREGATE_SLOT flag to support that).

8 years agoconf: eliminate repetitive code in virDomainPCIAddressGetNextSlot()
Laine Stump [Wed, 19 Oct 2016 17:58:42 +0000 (13:58 -0400)]
conf: eliminate repetitive code in virDomainPCIAddressGetNextSlot()

virDomainPCIAddressGetNextSlot() starts searching from the last
allocated address and goes to the end of all the buses, then goes back
to the first bus and searches from there up to the starting point (in
case any address has been freed since the last time an address was
allocated. The loops for these two are almost, but not exactly, the
same, so they have remained as separate loops with the same code
inside the loop. To lessen maintenance headaches, the identical code
has been moved out into the function
virDomainPCIAddressFindUnusedFunctionOnBus(), which is called in place
of the loop contents.

8 years agoconf: eliminate concept of "reserveEntireSlot"
Laine Stump [Wed, 19 Oct 2016 16:43:04 +0000 (12:43 -0400)]
conf: eliminate concept of "reserveEntireSlot"

setting reserveEntireSlot really accomplishes nothing - instead of
going to the trouble of computing the value for reserveEntireSlot and
then possibly setting *all* functions of the slot as in-use, we can
just set the in-use bit only for the specific function being used by a
device.  Later we will know from the context (the PCI connect flags,
and whether we are reserving a specific address or asking for "the
next available") whether or not it is okay to allocate other functions
on the same slot.

Although it's not used yet, we allow specifying "-1" for the function
number when looking for the "next available slot" - this is going to
end up meaning "return the lowest available function in the slot, but
since we currently only provide a function from an otherwise unused
slot, "-1" ends up meaning "0".

8 years agoconf: use struct instead of int for each slot in virDomainPCIAddressBus
Laine Stump [Sun, 16 Oct 2016 21:14:25 +0000 (17:14 -0400)]
conf: use struct instead of int for each slot in virDomainPCIAddressBus

When keeping track of which functions of which slots are allocated, we
will need to have more information than just the current bitmap with a
bit for each function that is currently stored for each slot in a
virDomainPCIAddressBus. To prepare for adding more per-slot info, this
patch changes "uint8_t slots" into "virDomainPCIAddressSlot slot", which
currently has a single member named "functions" that serves the same
purpose previously served directly by "slots".

8 years agolibxl: define a per-domain logger.
Cédric Bosdonnat [Mon, 9 Jan 2017 15:20:50 +0000 (16:20 +0100)]
libxl: define a per-domain logger.

libxl doesn't provide a way to write one log for each domain. Thus
we need to demux the messages. If our logger doesn't know to which
domain to attribute a message, then it will write it to the default
log file.

Starting with Xen 4.9 (commit f9858025 and following), libxl will
write the domain ID in an easy to grab manner. The logger introduced
by this commit will use it to demux the libxl log messages.

Thanks to the default log file, this logger will also work with older
versions of Xen.

8 years agovirsh: pool-info: introduce option --bytes
Chen Hanxiao [Wed, 4 Jan 2017 01:01:21 +0000 (09:01 +0800)]
virsh: pool-info: introduce option --bytes

By default, pool-info will convert sizes to human friendly units.

This patch will introduce option [--bytes].
If specified, the raw sizes will be in the output.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agodocs: add news entry in improvements section.
Dawid Zamirski [Wed, 11 Jan 2017 00:05:13 +0000 (19:05 -0500)]
docs: add news entry in improvements section.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agovbox: consolidate vbox IID structures.
Dawid Zamirski [Thu, 29 Dec 2016 20:34:32 +0000 (15:34 -0500)]
vbox: consolidate vbox IID structures.

* remove _vboxIID_v2_x and _vboxIID_v3_x structs and repalce with one
  _vboxIID as all supprted vbox versions have the same IID structure.
* remove vboxIIDUnion that was used to abstract version depended IID
  differences.
* remove IID_MEMBER macro and use the new vboxIID directly.

8 years agovbox: fix _displayTakeScreenShotPNGToArray
Dawid Zamirski [Thu, 29 Dec 2016 20:34:31 +0000 (15:34 -0500)]
vbox: fix _displayTakeScreenShotPNGToArray

This function was not implemented for vbox 5+ which removed
TakeScreenShotPNGToArray but provides TakeScreenShotToArray with
BitmapFormat_PNG argument which is the same thing.

8 years agovbox: IVRDxServer to IVRDEServer.
Dawid Zamirski [Thu, 29 Dec 2016 20:34:30 +0000 (15:34 -0500)]
vbox: IVRDxServer to IVRDEServer.

The IVRDxServer was used because vbox < 4 used to have IVRDPServer
whereas vbox >= 4 has IVRDEServer. Now that support for legacy
versions is being removed, we can use IVRDEServer.

8 years agovbox: remove code dealing with oldMediumInterface
Dawid Zamirski [Thu, 29 Dec 2016 20:34:29 +0000 (15:34 -0500)]
vbox: remove code dealing with oldMediumInterface

* removed oldMediumInterface flag and related code that was used for
  vbox 2.x
* remove accelerate2DVideo and networkRemoveInterface flags which were
  also conditionals for handling legacy vbox versions.

8 years agovbox: remove domain events support.
Dawid Zamirski [Thu, 29 Dec 2016 20:34:28 +0000 (15:34 -0500)]
vbox: remove domain events support.

this was implemented only for vbox 3 series and was mostly stubs
anyway.

8 years agovbox: remove getMachineForSession flag.
Dawid Zamirski [Thu, 29 Dec 2016 20:34:27 +0000 (15:34 -0500)]
vbox: remove getMachineForSession flag.

* the getMachineForSession is always true for 4.0+. This also means that
  checkflag argument in openSessionForMachine no longer has any meaning
  because it was or'ed with getMachineForSession (always true)
* remove supportScreenshot flag - vbox 4.0+ supports it
* remove detachDevicesExplicitly flag only relevant for < 4.0

8 years agovbox: do not use IHardDisk anymore.
Dawid Zamirski [Thu, 29 Dec 2016 20:34:26 +0000 (15:34 -0500)]
vbox: do not use IHardDisk anymore.

VirtualBox 4.0+ uses IMedium and IHardDisk is no longer used, so

* remove typef IMedium IHardDisk
* merge UIHardDisk into UIMedium
* update all references accordingly

8 years agovbox: remove _vboxAttachDrivesOld
Dawid Zamirski [Thu, 29 Dec 2016 20:34:25 +0000 (15:34 -0500)]
vbox: remove _vboxAttachDrivesOld

and fold vboxAttachDrivesNew into vboxAttachDrives

8 years agovbox: remove code for old API versions.
Dawid Zamirski [Thu, 29 Dec 2016 20:34:24 +0000 (15:34 -0500)]
vbox: remove code for old API versions.

This removes most of the code wrapped in VBOX_API_VERSION < 4000000
preprocessor checks. Those are the ones that can be safely removed
without needing to update driver code to accomodate it.

8 years agovbox: remove calls to *InstallUniformedAPI macros.
Dawid Zamirski [Thu, 29 Dec 2016 20:34:23 +0000 (15:34 -0500)]
vbox: remove calls to *InstallUniformedAPI macros.

That is, for versions older than 4.0. Also do not try to include
headers for those old versions.