]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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>
8 years agoqemu: Prepare chardevs when starting a domain
Michal Privoznik [Tue, 15 Nov 2016 14:17:05 +0000 (15:17 +0100)]
qemu: Prepare chardevs 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 hostdevs when starting a domain
Michal Privoznik [Tue, 15 Nov 2016 13:37:52 +0000 (14:37 +0100)]
qemu: Prepare hostdevs 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 disks when starting a domain
Michal Privoznik [Mon, 14 Nov 2016 16:36:45 +0000 (17:36 +0100)]
qemu: Prepare disks 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: Spawn qemu under mount namespace
Michal Privoznik [Tue, 15 Nov 2016 10:30:18 +0000 (11:30 +0100)]
qemu: Spawn qemu under mount namespace

Prime time. When it comes to spawning qemu process and
relabelling all the devices it's going to touch, there's inherent
race with other applications in the system (e.g. udev). Instead
of trying convincing udev to not touch libvirt managed devices,
we can create a separate mount namespace for the qemu, and mount
our own /dev there. Of course this puts more work onto us as we
have to maintain /dev files on each domain start and device
hot(un-)plug. On the other hand, this enhances security also.

From technical POV, on domain startup process the parent
(libvirtd) creates:

  /var/lib/libvirt/qemu/$domain.dev
  /var/lib/libvirt/qemu/$domain.devpts

The child (which is going to be qemu eventually) calls unshare()
to create new mount namespace. From now on anything that child
does is invisible to the parent. Child then mounts tmpfs on
$domain.dev (so that it still sees original /dev from the host)
and creates some devices (as explained in one of the previous
patches). The devices have to be created exactly as they are in
the host (including perms, seclabels, ACLs, ...). After that it
moves $domain.dev mount to /dev.

What's the $domain.devpts mount there for then you ask? QEMU can
create PTYs for some chardevs. And historically we exposed the
host ends in our domain XML allowing users to connect to them.
Therefore we must preserve devpts mount to be shared with the
host's one.

To make this patch as small as possible, creating of devices
configured for domain in question is implemented in next patches.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu_cgroup: Expose defaultDeviceACL
Michal Privoznik [Tue, 15 Nov 2016 10:28:51 +0000 (11:28 +0100)]
qemu_cgroup: Expose defaultDeviceACL

This is a list of devices that qemu needs for its run (apart from
what's configured for domain). The devices on the list are
enabled in the CGroups by default so they will be good candidates
for initial /dev for new qemu.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirscsivhost: Introduce virSCSIVHostDeviceGetPath
Michal Privoznik [Tue, 6 Dec 2016 15:06:02 +0000 (16:06 +0100)]
virscsivhost: Introduce virSCSIVHostDeviceGetPath

We will need this function in near future so that we know what
/dev device corresponds to the SCSI device.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirscsi: Introduce virSCSIDeviceGetPath
Michal Privoznik [Wed, 16 Nov 2016 14:27:20 +0000 (15:27 +0100)]
virscsi: Introduce virSCSIDeviceGetPath

We will need this function in near future so that we know what
/dev device corresponds to the SCSI device.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirusb: Introduce virUSBDeviceGetPath
Michal Privoznik [Wed, 16 Nov 2016 14:26:59 +0000 (15:26 +0100)]
virusb: Introduce virUSBDeviceGetPath

We will need this function in near future so that we know what
/dev device corresponds to the USB device.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirfile: Introduce ACL helpers
Michal Privoznik [Tue, 22 Nov 2016 10:14:08 +0000 (11:14 +0100)]
virfile: Introduce ACL helpers

Namely, virFileGetACLs, virFileSetACLs, virFileFreeACLs and
virFileCopyACLs. These functions are going to be required when we
are creating /dev for qemu. We have copy anything that's in
host's /dev exactly as is. Including ACLs.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirfile: Introduce virFileSetupDev
Michal Privoznik [Thu, 10 Nov 2016 15:17:48 +0000 (16:17 +0100)]
virfile: Introduce virFileSetupDev

This part of code that LXC currently uses will be reused so move
to a generic function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirprocess: Introduce virProcessSetupPrivateMountNS
Michal Privoznik [Thu, 10 Nov 2016 13:55:48 +0000 (14:55 +0100)]
virprocess: Introduce virProcessSetupPrivateMountNS

This part of code that LXC currently uses will be reused so move
to a generic function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agolibxl: reverse defaults on HVM net device attach
Joao Martins [Wed, 14 Dec 2016 10:53:32 +0000 (10:53 +0000)]
libxl: reverse defaults on HVM net device attach

libvirt libxl picks its own default with respect to the default NIC
to use. libxlMakeNic is the one responsible for this and on boot it
picks LIBXL_NIC_TYPE_VIF_IOEMU for HVM domains such that it accomodates
both PV and emulated one. The good behaving guest at boot will then
select the pv and unplug the emulated device.

Now, on HVM when attaching an interface it will pick the same default
that is LIBXL_NIC_TYPE_VIF_IOEMU which as a result will fail the attach
(see xen commit 32e9d0f ("libxl: nic type defaults to vif in hotplug for
hvm guest"). Xen doesn't yet support the hotplug of emulated devices,
but we don't want to rule out that case either, which might get support
in the future. Hence we simply reverse the defaults when we are
attaching the interface which allows libvirt to prefer the PV nic first
without adding "model='netfront'" following the same pattern as above
commit. Also to avoid ruling out the emulated one we set to
LIBXL_NIC_TYPE_IOEMU when setting a model type that is not 'netfront'.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agolibxl: add QED disk format support
Cédric Bosdonnat [Mon, 14 Nov 2016 15:00:02 +0000 (16:00 +0100)]
libxl: add QED disk format support

If libxl has QED disk format support, then pass the feature
over to the user.

8 years agoxenconfig: add default in xenParseXLDisk()'s switches
Cédric Bosdonnat [Wed, 14 Dec 2016 16:06:26 +0000 (17:06 +0100)]
xenconfig: add default in xenParseXLDisk()'s switches

Without a default: case in the switches in xenParseXLDisk(), build
would fail with every new disk backend or image format added in libxl,
as this is the case in this error:

http://logs.test-lab.xenproject.org/osstest/logs/103325/build-amd64-libvirt/5.ts-libvirt-build.log

8 years agoRemove reference to enum that never existed
Daniel P. Berrange [Wed, 14 Dec 2016 16:41:32 +0000 (16:41 +0000)]
Remove reference to enum that never existed

The virDomainSendProcessSignal method says the flags values
come from virDomainProcessSignalFlag, but this enum has
never existed. No flags are needed for this method.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirjson: Remove const from virJSONValueObjectForeachKeyValue
Jiri Denemark [Wed, 14 Dec 2016 14:25:31 +0000 (15:25 +0100)]
virjson: Remove const from virJSONValueObjectForeachKeyValue

Almost none of our virJSONValue*Get* functions accept const virJSONValue
pointers and it wouldn't even make sense since we sometimes modify what
we get. And because there is no reason for preventing callers of
virJSONValueObjectForeachKeyValue from modifying the values they get in
each iteration we can just stop doing it.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoschema: Let elements in /network/ip be specified in any order
Jiri Denemark [Tue, 13 Dec 2016 13:45:21 +0000 (14:45 +0100)]
schema: Let elements in /network/ip be specified in any order

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoAvoid variable named 'stat'
Daniel P. Berrange [Wed, 14 Dec 2016 12:17:08 +0000 (12:17 +0000)]
Avoid variable named 'stat'

Using a variable named 'stat' clashes with the system function
'stat()' causing compiler warnings on some platforms

cc1: warnings being treated as errors
../../src/qemu/qemu_monitor_text.c: In function 'parseMemoryStat':
../../src/qemu/qemu_monitor_text.c:604: error: declaration of 'stat' shadows a global declaration [-Wshadow]
/usr/include/sys/stat.h:455: error: shadowed declaration is here [-Wshadow]

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agotests: Check more network XMLs for schema compliance
Jiri Denemark [Tue, 13 Dec 2016 12:45:50 +0000 (13:45 +0100)]
tests: Check more network XMLs for schema compliance

This revealed bugs in RNG schema for /network/dns/srv.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agolog: Fix loading of conf file for log daemon
Peter Krempa [Tue, 13 Dec 2016 17:34:14 +0000 (18:34 +0100)]
log: Fix loading of conf file for log daemon

'log_outputs' would be read into the variable for log_filters

8 years agolock: Fix loading of config file for the lock daemon
Peter Krempa [Tue, 13 Dec 2016 17:33:27 +0000 (18:33 +0100)]
lock: Fix loading of config file for the lock daemon

'log_outputs' would be read into the variable for log_filters

8 years agoqemu: Allow use of hot plugged host CPUs if no affinity set
Viktor Mihajlovski [Fri, 25 Nov 2016 13:57:05 +0000 (14:57 +0100)]
qemu: Allow use of hot plugged host CPUs if no affinity set

If the cpuset cgroup controller is disabled in /etc/libvirt/qemu.conf
QEMU virtual machines can in principle use all host CPUs, even if they
are hot plugged, if they have no explicit CPU affinity defined.

However, there's libvirt code supposed to handle the situation where
the libvirt daemon itself is not using all host CPUs. The code in
qemuProcessInitCpuAffinity attempts to set an affinity mask including
all defined host CPUs. Unfortunately, the resulting affinity mask for
the process will not contain the offline CPUs. See also the
sched_setaffinity(2) man page.

That means that even if the host CPUs come online again, they won't be
used by the QEMU process anymore. The same is true for newly hot
plugged CPUs. So we are effectively preventing that QEMU uses all
processors instead of enabling it to use them.

It only makes sense to set the QEMU process affinity if we're able
to actually grow the set of usable CPUs, i.e. if the process affinity
is a subset of the online host CPUs.

There's still the chance that for some reason the deliberately chosen
libvirtd affinity matches the online host CPU mask by accident. In this
case the behavior remains as it was before (CPUs offline while setting
the affinity will not be used if they show up later on).

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Tested-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
8 years agoutil: Allow to query the presence of host CPU bitmaps
Viktor Mihajlovski [Fri, 25 Nov 2016 13:57:04 +0000 (14:57 +0100)]
util: Allow to query the presence of host CPU bitmaps

The functions to retrieve online and present host CPU information
are only supported on Linux for the time being.

This leads to runtime errors if these function are used on other
platforms. To avoid that, code in higher levels using the functions
must replicate the conditional compilation in higher level which
is error prone (and is plainly spoken ugly).

Adding a function virHostCPUHasBitmap that can be used to check
for host CPU bitmap support.

NB: There are other functions including the host CPU count that
are lacking support on all platforms, but they are too essential
in order to be bypassed.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
8 years agoqemu: Fix virQEMUCapsFindTarget on ppc64le
Jiri Denemark [Tue, 13 Dec 2016 15:58:41 +0000 (16:58 +0100)]
qemu: Fix virQEMUCapsFindTarget on ppc64le

virQEMUCapsFindTarget is supposed to find an alternative QEMU binary if
qemu-system-$GUEST_ARCH doesn't exist. The alternative is using host
architecture when it is compatible with $GUEST_ARCH. But a special
treatment has to be applied for ppc64le since the QEMU binary is always
called qemu-system-ppc64.

Broken by me in v2.2.0-171-gf2e71550d.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agodocs: Update formatstorage to match code for pool path
John Ferlan [Sat, 3 Dec 2016 12:53:15 +0000 (07:53 -0500)]
docs: Update formatstorage to match code for pool path

Seems commit id '0257d06b' forgot to include formatstorage when updating
the docs to describe allowing zfs as a pool type and to furthermore note
that the pool's target path element will be generated rather than read.

Similarly commit id 'efab27afb' neglected to indicate that the target path
for a logical pool will now be generated by libvirt.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoformatnetwork: Cleanup /network/ip documentation
Jiri Denemark [Fri, 9 Dec 2016 15:26:12 +0000 (16:26 +0100)]
formatnetwork: Cleanup /network/ip documentation

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoformatnetwork: Properly mark attributes of /network/dns/srv
Jiri Denemark [Fri, 2 Dec 2016 18:50:11 +0000 (19:50 +0100)]
formatnetwork: Properly mark attributes of /network/dns/srv

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoformatnetwork: Remove extra white space in examples
Jiri Denemark [Fri, 2 Dec 2016 17:40:40 +0000 (18:40 +0100)]
formatnetwork: Remove extra white space in examples

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoformatnetwork: Split long lines
Jiri Denemark [Fri, 2 Dec 2016 17:38:20 +0000 (18:38 +0100)]
formatnetwork: Split long lines

Let's make sure all examples fit into their grey boxes.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoformatnetwork: Remove useless </route>
Jiri Denemark [Fri, 2 Dec 2016 17:36:31 +0000 (18:36 +0100)]
formatnetwork: Remove useless </route>

Almost all XML examples use <tag .../> rather than <tag ...></tag> if
the element is empty. Let's remove the two instances of the latter.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoperf: add branch_misses perf event support
Nitesh Konkar [Sun, 11 Dec 2016 13:30:11 +0000 (19:00 +0530)]
perf: add branch_misses perf event support

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

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agoqemu: agent: take monitor lock in qemuAgentNotifyEvent
Nikolay Shirokovskiy [Mon, 12 Dec 2016 09:13:44 +0000 (12:13 +0300)]
qemu: agent: take monitor lock in qemuAgentNotifyEvent

qemuAgentNotifyEvent accesses monitor structure and is called on qemu
reset/shutdown/suspend events under domain lock. Other monitor
functions on the other hand take monitor lock and don't hold domain lock.
Thus it is possible to have risky simultaneous access to the structure
from 2 threads. Let's take monitor lock here to make access exclusive.

8 years agoqemu: don't use vm when lock is dropped in qemuDomainGetFSInfo
Nikolay Shirokovskiy [Mon, 12 Dec 2016 09:13:43 +0000 (12:13 +0300)]
qemu: don't use vm when lock is dropped in qemuDomainGetFSInfo

Current call to qemuAgentGetFSInfo in qemuDomainGetFSInfo is
unsafe. Domain lock is dropped and we use vm->def. Let's make
def copy to fix that.

8 years agoqemu: agent: fix uninitialized var case in qemuAgentGetFSInfo
Nikolay Shirokovskiy [Mon, 12 Dec 2016 09:13:42 +0000 (12:13 +0300)]
qemu: agent: fix uninitialized var case in qemuAgentGetFSInfo

In case of 0 filesystems *info is not set while according
to virDomainGetFSInfo contract user should call free on it even
in case of 0 filesystems. Thus we need to properly set
it. NULL will be enough as free eats NULLs ok.

8 years agonews: Add news entry for qemuDomainGetBlockInfo adjustments
John Ferlan [Mon, 12 Dec 2016 21:03:29 +0000 (16:03 -0500)]
news: Add news entry for qemuDomainGetBlockInfo adjustments

8 years agoqemu: Fix GetBlockInfo setting allocation from wr_highest_offset
John Ferlan [Wed, 30 Nov 2016 13:50:54 +0000 (08:50 -0500)]
qemu: Fix GetBlockInfo setting allocation from wr_highest_offset

The libvirt-domain.h documentation indicates that for a qcow2 file
in a filesystem being used for a backing store should report the disk
space occupied by a file; however, commit id '15fa84ac' altered the
code to trust that the wr_highest_offset should be used whenever
wr_highest_offset_valid was set.

As it turns out this will lead to indeterminite results. For an active
domain when qemu hasn't yet had the need to find the wr_highest_offset
value, qemu will report 0 even though qemu-img will report the proper
disk size. This causes reporting of the following XML:

  <disk type='file' device='disk'>
    <driver name='qemu' type='qcow2'/>
    <source file='/path/to/test-1g.qcow2'/>

to be as follows:

Capacity:       1073741824
Allocation:     0
Physical:       1074139136

with qemu-img indicating:

image: /path/to/test-1g.qcow2
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 1.0G

Once the backing source file is opened on the guest, then wr_highest_offset
is updated, but only to the high water mark and not the size of the file.

This patch will adjust the logic to check for the file backed qcow2 image
and enforce setting the allocation to the returned 'physical' value, which
is the 'actual-size' value from a 'query-block' operation.

NB: The other consumer of the wr_highest_offset output (GetAllDomainStats)
has a contract that indicates 'allocation' is the offset of the highest
written sector, so it doesn't need adjustment.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoutil: Introduce virStorageSourceUpdateCapacity
John Ferlan [Thu, 1 Dec 2016 21:23:58 +0000 (16:23 -0500)]
util: Introduce virStorageSourceUpdateCapacity

Instead of having duplicated code in qemuStorageLimitsRefresh and
virStorageBackendUpdateVolTargetInfo to get capacity specific data
about the storage backing source or volume -- create a common API
to handle the details for both.

As a side effect, virStorageFileProbeFormatFromBuf returns to being
a local/static helper to virstoragefile.c

For the QEMU code - if the probe is done, then the format is saved so
as to avoid future such probes.

For the storage backend code, there is no need to deal with the probe
since we cannot call the new API if target->format == NONE.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoutil: Introduce virStorageSourceUpdateBackingSizes
John Ferlan [Thu, 1 Dec 2016 21:39:36 +0000 (16:39 -0500)]
util: Introduce virStorageSourceUpdateBackingSizes

Instead of having duplicated code in qemuStorageLimitsRefresh and
virStorageBackendUpdateVolTargetInfoFD to fill in the storage backing
source or volume allocation, capacity, and physical values - create a
common API that will handle the details for both.

The common API will fill in "default" capacity values as well - although
those more than likely will be overridden by subsequent code. Having just
one place to make the determination of what the values should be will
make things be more consistent.

For the QEMU code - the data filled in will be for inactive domains
for the GetBlockInfo and DomainGetStatsOneBlock API's. For the storage
backend code - the data will be filled in during the volume updates.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoutil: Introduce virStorageSourceUpdatePhysicalSize
John Ferlan [Thu, 1 Dec 2016 21:19:26 +0000 (16:19 -0500)]
util: Introduce virStorageSourceUpdatePhysicalSize

Commit id '8dc27259' introduced virStorageSourceUpdateBlockPhysicalSize
in order to retrieve the physical size for a block backed source device
for an active domain since commit id '15fa84ac' changed to use the
qemuMonitorGetAllBlockStatsInfo and qemuMonitorBlockStatsUpdateCapacity
API's to (essentially) retrieve the "actual-size" from a 'query-block'
operation for the source device.

However, the code only was made functional for a BLOCK backing type
and it neglected to use qemuOpenFile, instead using just open. After
the open the block lseek would find the end of the block and set the
physical value, close the fd and return.

Since the code would return 0 immediately if the source device wasn't
a BLOCK backed device, the physical would be displayed incorrectly,
such as follows in domblkinfo for a file backed source device:

Capacity:       1073741824
Allocation:     0
Physical:       0

This patch will modify the algorithm to get the physical size for other
backing types and it will make use of the qemuDomainStorageOpenStat
helper in order to open/stat the source file depending on its type.
The qemuDomainGetStatsOneBlock will no longer inhibit printing errors,
but it will still ignore them leaving the physical value set to 0.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: Introduce helper qemuDomainStorageUpdatePhysical
John Ferlan [Thu, 1 Dec 2016 16:41:34 +0000 (11:41 -0500)]
qemu: Introduce helper qemuDomainStorageUpdatePhysical

Currently just a shim to call virStorageSourceUpdateBlockPhysicalSize

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: Add helpers to handle stat data for qemuStorageLimitsRefresh
John Ferlan [Thu, 1 Dec 2016 16:10:06 +0000 (11:10 -0500)]
qemu: Add helpers to handle stat data for qemuStorageLimitsRefresh

Split out the opening of the file and fetch of the stat buffer into a
helper qemuDomainStorageOpenStat. This will handle either opening the
local or remote storage.

Additionally split out the cleanup of that into a separate helper
qemuDomainStorageCloseStat which will either close the file or
call the virStorageFileDeinit function.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: Clean up description for qemuStorageLimitsRefresh
John Ferlan [Thu, 1 Dec 2016 12:13:15 +0000 (07:13 -0500)]
qemu: Clean up description for qemuStorageLimitsRefresh

Originally added by commit id '89646e69' prior to commit id '15fa84ac'
and '71d2c172' which ensured that qemuStorageLimitsRefresh was only called
for inactive domains.

Adjust the comment describing the need for FIXME and move all the text
to the function description.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoAppArmor: allow QEMU to set_process_name.
intrigeri [Mon, 12 Dec 2016 10:59:32 +0000 (10:59 +0000)]
AppArmor: allow QEMU to set_process_name.

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

Acked-by: Christian Ehrhardt <christian.ehrhardt@canonical.co>
8 years agoAppArmor policy: support merged-/usr.
intrigeri [Sat, 3 Dec 2016 18:32:48 +0000 (18:32 +0000)]
AppArmor policy: support merged-/usr.

Acked-by: Christian Ehrhardt <christian.ehrhardt@canonical.co>
8 years agodocs: Adjust pool/vol target output
John Ferlan [Wed, 7 Dec 2016 15:12:50 +0000 (10:12 -0500)]
docs: Adjust pool/vol target output

Looks like the <timestamps> and <encryption> were put in the wrong
place... They're not <pool> elements, rather they are <volume> elements

8 years agodocs: Replace missing description for perf.cpu_cycles
John Ferlan [Sun, 11 Dec 2016 12:56:53 +0000 (07:56 -0500)]
docs: Replace missing description for perf.cpu_cycles

Lost during merge of commit id '8546adf80' and '585ad00b5'

8 years agovirsh: maxvcpus: Always fall back to the old command if domain caps fail
Peter Krempa [Thu, 8 Dec 2016 08:36:43 +0000 (09:36 +0100)]
virsh: maxvcpus: Always fall back to the old command if domain caps fail

1ec22be5 added code that detects the maximum cpu count according to
domain capabilities. The code fell back to the old command only if the
API was not supported. If the API fails for other reasons the command
would fail. There's no point in not trying the old API in such case.

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

8 years agovz: added VIR_MIGRATE_NON_SHARED_INC migration flag support
Pavel Glushchak [Thu, 8 Dec 2016 08:49:16 +0000 (11:49 +0300)]
vz: added VIR_MIGRATE_NON_SHARED_INC migration flag support

This flag is used in Virtuozzo backend implicitly, thus
we need to support it and don't fail if it's set.

Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
8 years agovz: set PVMT_DONT_CREATE_DISK migration flag
Pavel Glushchak [Thu, 8 Dec 2016 08:49:15 +0000 (11:49 +0300)]
vz: set PVMT_DONT_CREATE_DISK migration flag

This flag tells backend not to create instance
disks making behavior the same as in qemu driver.
Disk files have to be created beforehand on target
host manually or by upper management layer i.e.
OpenStack Nova.

Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
8 years agoqemu: Fix xml dump of autogenerated websocket
Nikolay Shirokovskiy [Tue, 22 Nov 2016 11:09:33 +0000 (14:09 +0300)]
qemu: Fix xml dump of autogenerated websocket

When save/migrate a domain and we autogenerated a port, then if we
print the inactive domain config, write out a -1 for the socket value;
otherwise, it's possible that the subsequent start will fail if the
autogenerated websocket used conflicts with an existing running config
that also used autogenerated websockets.

Examples:

== A. Can not restore domain with autoconfigured websocket.

domain 1 and 2 have autoconfigured websocket.

1. domain 1 is started then, saved
2. domain 2 is started
3. domain 1 restoration is failed:

error: internal error: qemu unexpectedly closed the monitor: 2016-11-21T10:23:11.356687Z
qemu-kvm: -vnc 0.0.0.0:2,websocket=5700: Failed to start VNC server on `(null)':
Failed to bind socket: Address already in use

== B. Can not migrate domain with autoconfigured websocket.

domain 1 on host A, domain 2 on host B, both have autoconfigured websocket

1. domain 1 started, domain 2 started
2. domain 1 migration to host B is failed with the above error.

8 years agoqemu: mark user defined websocket as used
Nikolay Shirokovskiy [Tue, 22 Nov 2016 11:09:32 +0000 (14:09 +0300)]
qemu: mark user defined websocket as used

We need extra state variable to distinguish between autogenerated
and user defined cases after auto generation is done.

8 years agoqemu: Refactor qemuProcessGraphicsReservePorts
Nikolay Shirokovskiy [Tue, 22 Nov 2016 11:09:31 +0000 (14:09 +0300)]
qemu: Refactor qemuProcessGraphicsReservePorts

Use switch for enums rather than if/else conditions.