]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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.

8 years agovsh: Mark some function arguments as unused
Michal Privoznik [Fri, 9 Dec 2016 09:52:29 +0000 (10:52 +0100)]
vsh: Mark some function arguments as unused

Some arguments in vshErrorHandler, vshReadlineCompletion and
cmdSelfTest functions are not used. Mark them as such.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuGetDomainHugepagePath: Initialize @ret
Michal Privoznik [Fri, 9 Dec 2016 09:51:37 +0000 (10:51 +0100)]
qemuGetDomainHugepagePath: Initialize @ret

The variable may be used uninitialized in this function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoMove virstat.c code to virnetdevtap.c
Mehdi Abaakouk [Fri, 18 Nov 2016 22:51:15 +0000 (23:51 +0100)]
Move virstat.c code to virnetdevtap.c

This is just a code move of virstat.c to virnetdevtap.c

8 years agovirstat: fix signature of virstat helper
Mehdi Abaakouk [Fri, 18 Nov 2016 22:51:14 +0000 (23:51 +0100)]
virstat: fix signature of virstat helper

In preparation to the code move to virnetdevtap.c, this change:

* renames virNetInterfaceStats to virNetDevTapInterfaceStats
* changes 'path' to 'ifname', to use the same vocable as other
  method in virnetdevtap.c.
* Add the attributes checker

8 years agoGathering vhostuser interface stats with ovs
Mehdi Abaakouk [Fri, 18 Nov 2016 22:51:13 +0000 (23:51 +0100)]
Gathering vhostuser interface stats with ovs

When vhostuser interfaces are used, the interface statistics
are not available in /proc/net/dev.

This change looks at the openvswitch interfaces statistics
tables to provide this information for vhostuser interface.

Note that in openvswitch world drop/error doesn't always make sense
for some interface type. When these informations are not available we
set them to 0 on the virDomainInterfaceStats.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonss: Need to check error condition on virJSONValueArraySize
John Ferlan [Wed, 7 Dec 2016 13:10:30 +0000 (08:10 -0500)]
nss: Need to check error condition on virJSONValueArraySize

If the 'nleases < 0' on return, then the subsequent call to
findLeaseInJSON will not produce the expected results (passed
in as a size_t, but nleases is a ssize_t).  So check if the
returned value < 0 and if so, goto cleanup.

Found by Coverity as a NEGATIVE_RETURNS event

8 years agotests: Fix virmacmaptest when allocation fails
John Ferlan [Wed, 7 Dec 2016 13:07:54 +0000 (08:07 -0500)]
tests: Fix virmacmaptest when allocation fails

If the allocation fails in DO_TEST_FLUSH_PROLOGUE, then 'mgr == NULL',
but the code continues on - which won't be good. So modify the macro
to cause an immediate failure and jump to a cleanup label.

Found by Coverity as FORWARD_NULL event.

8 years agonews: Add description for perf.branch_instructions
John Ferlan [Thu, 8 Dec 2016 19:28:58 +0000 (14:28 -0500)]
news: Add description for perf.branch_instructions

8 years agoqemu: Don't try to find compression program for "raw" memory images
Peter Krempa [Thu, 8 Dec 2016 10:25:09 +0000 (11:25 +0100)]
qemu: Don't try to find compression program for "raw" memory images

There's nothing to compress if the requested snapshot memory format is
set to 'raw' explicitly. After commit 9e14689ea libvirt would try to
run /sbin/raw to process the memory stream if the qemu.conf option
snapshot_image_format is set.

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

8 years agolxc: monitor now holds a reference to the domain
Cédric Bosdonnat [Tue, 6 Dec 2016 13:20:13 +0000 (14:20 +0100)]
lxc: monitor now holds a reference to the domain

If the monitor doesn't hold a reference to the domain object
the object may be destroyed before the monitor actually stops.

8 years agosecurity: Drop virSecurityManagerSetHugepages
Michal Privoznik [Tue, 22 Nov 2016 12:33:02 +0000 (13:33 +0100)]
security: Drop virSecurityManagerSetHugepages

Since its introduction in 2012 this internal API did nothing.
Moreover we have the same API that does exactly the same:
virSecurityManagerDomainSetPathLabel.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Create hugepage path on per domain basis
Michal Privoznik [Tue, 22 Nov 2016 12:21:51 +0000 (13:21 +0100)]
qemu: Create hugepage path on per domain basis

If you've ever tried running a huge page backed guest under
different user than in qemu.conf, you probably failed. Problem is
even though we have corresponding APIs in the security drivers,
there's no implementation and thus we don't relabel the huge page
path. But even if we did, so far all of the domains share the
same path:

   /hugepageMount/libvirt/qemu

Our only option there would be to set 0777 mode on the qemu dir
which is totally unsafe. Therefore, we can create dir on
per-domain basis, i.e.:

   /hugepageMount/libvirt/qemu/domainName

and chown domainName dir to the user that domain is configured to
run under.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirDomainObjGetShortName: take virDomainDef
Michal Privoznik [Tue, 29 Nov 2016 07:36:30 +0000 (08:36 +0100)]
virDomainObjGetShortName: take virDomainDef

So far this function takes virDomainObjPtr which:
1) is an overkill,
2) might be not available in all the places we will use it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoconf: Make scheduler formatting simpler
Martin Kletzander [Tue, 22 Nov 2016 13:45:43 +0000 (14:45 +0100)]
conf: Make scheduler formatting simpler

Since the great rework of how we store vcpu- and iothread-related
data, we have overly complex part of code that is trying to format the
scheduler tuning data in as less lines as possible by grouping
settings for multiple threads.  That was designed as an input syntax
sugar for users, but we don't need to also use that when formatting
the XML.  Switching to simple enumeration makes the code nicer,
shorter and more welcoming to future changes.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agolibvirt.spec: Package libnss_libvirt_guest.so.2
Michal Privoznik [Thu, 8 Dec 2016 14:25:17 +0000 (15:25 +0100)]
libvirt.spec: Package libnss_libvirt_guest.so.2

In 22f7ceb695a I've introduced another NSS module
but forgot to package it in libvirt-nss.rpm.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agotest: fix screenshot API impl
Daniel P. Berrange [Tue, 6 Dec 2016 12:45:18 +0000 (12:45 +0000)]
test: fix screenshot API impl

When redoing the website we deleted the libvirtLogo.png file
not remembering that the test driver screenshot API impl
relied on it.

Rather than having the test driver use the logo as a side
effect, give it its own dedicated image to use. This is
installed in /usr/share/libvirt/test-screenshot.png and
is taken from a NeXT Cube running WorldWideWeb[1]. The
very first web browser in existance, running on the
hardware it was originally written on.

[1] https://en.wikipedia.org/wiki/WorldWideWeb

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoconfigure: sort libvirt macros
Pavel Hrdina [Thu, 10 Nov 2016 13:33:41 +0000 (14:33 +0100)]
configure: sort libvirt macros

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt-lib: properly pass header_name in LIBVIRT_CHECK_LIB(_ALT)
Pavel Hrdina [Fri, 11 Nov 2016 17:44:43 +0000 (18:44 +0100)]
m4/virt-lib: properly pass header_name in LIBVIRT_CHECK_LIB(_ALT)

The *header_name* cannot be quoted, otherwise it is not translated to
the passed argument.  Without this fix the generated configure contains
*ac_cv_header_header_name*, but there should be for example
*ac_cv_header_sals_sasl_h* for "sasl/sasl.h".

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: remove check for CPUID
Pavel Hrdina [Mon, 28 Nov 2016 08:55:52 +0000 (09:55 +0100)]
configure: remove check for CPUID

This check is not required because all i386 and x86_64 cpus have the
cpuid instruction.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: cleanup openwsman leftovers
Pavel Hrdina [Fri, 11 Nov 2016 23:19:14 +0000 (00:19 +0100)]
configure: cleanup openwsman leftovers

Commit a99bfb4b moved openwsman to its own file but forget to remove
those few lines.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu: capabilities: Add gluster.debug_level detection for 2.8.0+
Peter Krempa [Tue, 6 Dec 2016 15:59:18 +0000 (16:59 +0100)]
qemu: capabilities: Add gluster.debug_level detection for 2.8.0+

Qemu 2.8.0+ changes arguments structure for blockdev-add in the effort
to make it finally stable. Since libvirt recently added the detection of
gluster debug support relying on the old syntax we need to add the new
as well.

8 years agotest: qemucaps: Bump 2.8.0 state to current master
Peter Krempa [Wed, 7 Dec 2016 09:01:02 +0000 (10:01 +0100)]
test: qemucaps: Bump 2.8.0 state to current master

Qemu decided to change a parameter name in rc-state which was not
captured by the 2.8.0 data. Bump it to current version.

8 years agoperf: add one more perf event support
Nitesh Konkar [Wed, 7 Dec 2016 10:57:36 +0000 (16:27 +0530)]
perf: add one more perf event support

With current perf framework, this patch adds support and documentation
for the branch_instructions perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agodocs: Fix code example formatting for virDomainInterfaceAddresses
John Ferlan [Tue, 6 Dec 2016 13:50:26 +0000 (08:50 -0500)]
docs: Fix code example formatting for virDomainInterfaceAddresses

Adjust the spacing so that the code examples are display in the code/text
box rather than just as paragraph text.

8 years agodocs: Adjust formatting for virConnectGetAllDomainStats output
John Ferlan [Tue, 6 Dec 2016 13:41:42 +0000 (08:41 -0500)]
docs: Adjust formatting for virConnectGetAllDomainStats output

Adjust the spacing a bit in order to generate 'cleaner' looking output.
This matches what virDomainMemoryStats does and it creates text/code boxes
in order to list each of the stats for each category.

8 years agodocs: Rebuild apihtml docs when source changes
John Ferlan [Tue, 6 Dec 2016 13:38:46 +0000 (08:38 -0500)]
docs: Rebuild apihtml docs when source changes

When changing one of the src/libvirt-*.c files to alter the docs, the
adjusted files weren't being built.  Added them into APIBUILD_STAMP and
then added that to the html/index.html rule which is used for the
$(apihtml_generated) generated rule.

Also, for clean we can remove the html/*.html files

8 years agocgroup: Use system reported "unlimited" value for comparison
Viktor Mihajlovski [Tue, 6 Dec 2016 12:03:29 +0000 (13:03 +0100)]
cgroup: Use system reported "unlimited" value for comparison

With kernel 3.18 (since commit 3e32cb2e0a12b6915056ff04601cf1bb9b44f967)
the "unlimited" value for cgroup memory limits has changed once again as
its byte value is now computed from a page counter.
The new "unlimited" value reported by the cgroup fs is therefore 2**51-1
pages which is (VIR_DOMAIN_MEMORY_PARAM_UNLIMITED - 3072). This results
e.g. in virsh memtune displaying 9007199254740988 instead of unlimited
for the limits.

This patch uses the value of memory.limit_in_bytes from the cgroup
memory root which is the system's "real" unlimited value for comparison.

See also libvirt commit 231656bbeb9e4d3bedc44362784c35eee21cf0f4 for the
history for kernel 3.12 and before.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
8 years agonss: Introduce libvirt-guest module
Michal Privoznik [Tue, 29 Nov 2016 12:48:53 +0000 (13:48 +0100)]
nss: Introduce libvirt-guest module

So far the NSS module looks up only hostnames as provided by
guests themselves. However, there are some cases where this is
not enough: e.g. when there's a fresh new guest being installed
(with some generic hostname) say from a live ISO image; or some
(older) systems don't advertise their hostname in DHCP
transactions at all.
In cases like that it would be helpful if we translate domain
name as seen by libvirt too so that users can:

  # virsh start $dom && ssh $dom

In order to achieve that new libvirt-guest module is introduced,
while older libvirt module maintains its current behaviour (that
is translating guest provided names into IP addresses).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonss: Move address lookup code into a separate function
Michal Privoznik [Tue, 6 Dec 2016 11:54:43 +0000 (12:54 +0100)]
nss: Move address lookup code into a separate function

The part of the code that iterates over an array of JSON values
is going to be re-used. Instead of copying it over, move it to a
separate function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonss: Move address appending code into a separate function
Michal Privoznik [Sun, 4 Dec 2016 12:05:43 +0000 (13:05 +0100)]
nss: Move address appending code into a separate function

The part of the code that appends found IP address into a list is
going to be re-used. Instead of copying it over, move it to a
separate function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonss: Use macro to generate public API names
Michal Privoznik [Sun, 4 Dec 2016 10:56:44 +0000 (11:56 +0100)]
nss: Use macro to generate public API names

The name of the exported functions for an NSS module is quite
fixed, it is derived from the module name:

  _nss_$module_$function

Since we will create another NSS module with very similar
implementation we might as well generate the function names at
the compile time.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonetwork: Track MAC address map
Michal Privoznik [Mon, 28 Nov 2016 16:56:14 +0000 (17:56 +0100)]
network: Track MAC address map

Now that we have a module that's able to track
<domain, mac addres list> pairs, hook it up into
our network driver.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoutil: Introduce virMACMap module
Michal Privoznik [Fri, 25 Nov 2016 06:30:30 +0000 (07:30 +0100)]
util: Introduce virMACMap module

This module will be used to track:

  <domain, mac address list>

pairs. It will be important to know these mappings without
libvirt connection (that is from a JSON file), because NSS
module will use those to provide better host name translation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoutil: Introduce virFileRewriteStr
Michal Privoznik [Mon, 28 Nov 2016 08:00:55 +0000 (09:00 +0100)]
util: Introduce virFileRewriteStr

There are couple of places where we have a string and want to
save it to a file. Atomically. In all those places we use
virFileRewrite() but also implement the very same callback which
takes the string and write it into temp file. This makes no
sense. Unify the callbacks and move them to one place.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirstring: Introduce virStringListRemove
Michal Privoznik [Mon, 28 Nov 2016 13:38:58 +0000 (14:38 +0100)]
virstring: Introduce virStringListRemove

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirstring: Introduce virStringListAdd
Michal Privoznik [Fri, 25 Nov 2016 14:43:53 +0000 (15:43 +0100)]
virstring: Introduce virStringListAdd

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonssmock: Prefer free() over VIR_FREE()
Michal Privoznik [Tue, 29 Nov 2016 13:59:25 +0000 (14:59 +0100)]
nssmock: Prefer free() over VIR_FREE()

Problem with VIR_FREE() is that we are not linking
libvirt-utils.so to our mock libs therefore there will be an
unresolved symbol. Fortunately, nsstest that eventually links
with the nssmock links also with libvirt-utils.so and thus the
symbol is resolved after all. However, if one wants to run the
test binary under valgrind it is impossible to do so. Because of
the unresolved symbol.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonetwork: Don't unlock non-locked network driver
Michal Privoznik [Mon, 28 Nov 2016 15:45:12 +0000 (16:45 +0100)]
network: Don't unlock non-locked network driver

In dd7bfb2cdc5d I've removed locking of the network driver upon
it's allocation. However, I forgot to remove one location of the
driver unlock.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agodocs: Add NEWS description for group_name support in iotune
John Ferlan [Mon, 5 Dec 2016 23:30:10 +0000 (18:30 -0500)]
docs: Add NEWS description for group_name support in iotune

8 years agovirsh: Add group name to blkdeviotune output
John Ferlan [Sun, 2 Oct 2016 12:42:31 +0000 (08:42 -0400)]
virsh: Add group name to blkdeviotune output

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

Add the ability to set/display the group_name for block device iotune

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: Add the group name option to the iotune command line
John Ferlan [Sat, 1 Oct 2016 13:35:09 +0000 (09:35 -0400)]
qemu: Add the group name option to the iotune command line

Add in the block I/O throttling group parameter to the command line
if supported. If not supported, fail command creation.

Add the xml2argvtest for testing.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoconf: Add support for blkiotune group_name option
John Ferlan [Sat, 1 Oct 2016 13:01:06 +0000 (09:01 -0400)]
conf: Add support for blkiotune group_name option

Modify _virDomainBlockIoTuneInfo and rng schema to support the group_name
option for iotune throttling. Document the new value.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: Add support for parsing iotune group setting
John Ferlan [Mon, 31 Oct 2016 21:22:59 +0000 (17:22 -0400)]
qemu: Add support for parsing iotune group setting

Add support to read/parse the iotune group setting for qemu.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: Adjust various bool BlockIoTune set_ values into a single mask
John Ferlan [Mon, 7 Nov 2016 14:49:22 +0000 (09:49 -0500)]
qemu: Adjust various bool BlockIoTune set_ values into a single mask

Rather than have multiple bool values, create a single enum with bits
representing what fields are set. Fields are generally set in groups
of 3 (read, write, total).

8 years agoqemu: Alter qemuMonitorJSONSetBlockIoThrottle command logic
John Ferlan [Mon, 7 Nov 2016 19:46:09 +0000 (14:46 -0500)]
qemu: Alter qemuMonitorJSONSetBlockIoThrottle command logic

Currently we build the JSON object for the "block_set_io_throttle"
command using the knowledge that a NULL for a support*Options boolean
would essentially ignore the rest of the arguments.

This may not work properly if some capability was backported, plus it just
looks rather ugly. So instead, build the "base" arguments and then if
the support*Option bool capability is set, add in the arguments on the fly.

Then append those arguments to the basic command and send to qemu.

8 years agoqemu: Adjust maxparams logic for qemuDomainGetBlockIoTune
John Ferlan [Mon, 7 Nov 2016 13:43:01 +0000 (08:43 -0500)]
qemu: Adjust maxparams logic for qemuDomainGetBlockIoTune

Rather than using negative logic and setting the maxparams to a lesser
value based on which capabilities exist, alter the logic to modify the
maxparams based on a base value plus the found capabilities. Reduces the
chance that some backported feature produces an incorrect value.

8 years agocaps: Add new capability for the iotune group name
John Ferlan [Mon, 7 Nov 2016 11:19:50 +0000 (06:19 -0500)]
caps: Add new capability for the iotune group name

Add the capability to detect if the qemu binary can support the feature
to use throttling.group.

8 years agoinclude: Add new "group_name" definition for iotune throttling
John Ferlan [Mon, 31 Oct 2016 21:22:57 +0000 (17:22 -0400)]
include: Add new "group_name" definition for iotune throttling

Add the new field to support sharing I/O throttling quota between
multiple drives.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agocpu: Add support for pku and ospke Intel features for Memory Protection Keys
Lin Ma [Fri, 25 Nov 2016 08:44:30 +0000 (16:44 +0800)]
cpu: Add support for pku and ospke Intel features for Memory Protection Keys

qemu commit: f74eefe0
https://lwn.net/Articles/667156/

Signed-off-by: Lin Ma <lma@suse.com>
8 years agocpu: Add support for more AVX512 Intel features
Lin Ma [Thu, 24 Nov 2016 09:50:08 +0000 (17:50 +0800)]
cpu: Add support for more AVX512 Intel features

These features are included:
AVX512DQ, AVX512IFMA, AVX512BW, AVX512VL, AVX512VBMI, AVX512_4VNNIW and
AVX512_4FMAPS.

qemu commits: cc728d14 and 95ea69fb

Signed-off-by: Lin Ma <lma@suse.com>
8 years agostorage: Fix type PLOOP type check for storageVolUpload
John Ferlan [Fri, 2 Dec 2016 19:58:23 +0000 (14:58 -0500)]
storage: Fix type PLOOP type check for storageVolUpload

Commit id '03e750f3' added support for checking the PLOOP type; however,
it used 'target.type' which no storage code ever fills in, so it will
never be set.  Change to just vol->type (could use vol->target.format
as well).

8 years agotests: add test cases for address conflicts
Marc Hartmayer [Wed, 30 Nov 2016 11:47:05 +0000 (12:47 +0100)]
tests: add test cases for address conflicts

Add test cases for address conflicts between disks and hostdevs that are
using drive addresses.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agoconf: add global check for duplicate drive addresses
Marc Hartmayer [Wed, 30 Nov 2016 11:47:04 +0000 (12:47 +0100)]
conf: add global check for duplicate drive addresses

Add a global check for duplicate drive addresses. This will fix the
problem of duplicate disk and hostdev drive addresses.

Example for duplicate drive addresses:
<disk>
  ...
  <target name='sda'/>
</disk>
<disk>
  ...
  <target name='sdb'/>
  <address type='drive' controller=0 bus=0 target=0 unit=0/>
</disk>

Another example:
<hostdev mode='subsystem' type='scsi' managed='no'>
  <source>
  ...
  </source>
  <address type='drive' controller='0' bus='0' target='0' unit='0'/>
</hostdev>
<hostdev mode='subsystem' type='scsi' managed='no'>
  <source>
  ...
  </source>
  <address type='drive' controller='0' bus='0' target='0' unit='0'/>
</hostdev>

Unfortunately the fixes (1b08cc170a84077afd4d15f4639a9a2cf398e9a2,
8d46386bfe01b84982e25e915ad9cfbae5cf4cb1) weren't enough to catch these
cases and it isn't possible to add additional checks in
virDomainDeviceDefPostParseInternal() for SCSI hostdevs or
virDomainDiskDefAssignAddress() for SCSI/IDE/FDC/SATA disks without
adding another parse flag (virDomainDefParseFlags) to disable this
validation while updating or detaching a disk or hostdev.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agotests: don't use duplicate disk addresses
Marc Hartmayer [Wed, 30 Nov 2016 11:47:03 +0000 (12:47 +0100)]
tests: don't use duplicate disk addresses

Don't use duplicate disk addresses in test cases unless it's useful. At
least the test case will break once we have a check for uniqueness of
addresses at time of domain definition.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
8 years agoconf: virDomainDriveAddressIsUsedByDisk: Rename type to bus_type
Marc Hartmayer [Wed, 30 Nov 2016 11:47:02 +0000 (12:47 +0100)]
conf: virDomainDriveAddressIsUsedByDisk: Rename type to bus_type

Comparing the parameter 'type' against the member 'bus' instead of
against the member 'type' is quite confusing. Rename the parameter
'type' to 'bus_type' to clarify its meaning.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agoconf: simplify functions virDomainSCSIDriveAddressIsUsedBy*()
Marc Hartmayer [Wed, 30 Nov 2016 11:47:01 +0000 (12:47 +0100)]
conf: simplify functions virDomainSCSIDriveAddressIsUsedBy*()

Pass the virDomainDeviceDriveAddress as a struct instead of individual
arguments. Reworked the function descriptions.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoFix version number
Andrea Bolognani [Mon, 5 Dec 2016 07:47:50 +0000 (08:47 +0100)]
Fix version number

The next release will be the first one of 2017, so the
version number will be 3.0.0 rather than 2.6.0.

8 years agoPost-release version bump to 2.6.0
Andrea Bolognani [Mon, 5 Dec 2016 07:44:22 +0000 (08:44 +0100)]
Post-release version bump to 2.6.0

8 years agoNEWS: Add release date for 2.5.0
Andrea Bolognani [Mon, 5 Dec 2016 07:38:09 +0000 (08:38 +0100)]
NEWS: Add release date for 2.5.0

8 years agoRelease of libvirt-2.5.0
Daniel Veillard [Sun, 4 Dec 2016 21:07:38 +0000 (22:07 +0100)]
Release of libvirt-2.5.0

* po/*.po*

8 years agoFix minor typos osstest/frozen/xen-4.8-testing
Yuri Chornoivan [Thu, 1 Dec 2016 20:50:08 +0000 (22:50 +0200)]
Fix minor typos

8 years agoqemuDomainAttachNetDevice: pass mq and vectors for vhost-user with multiqueue
gaohaifeng [Thu, 1 Dec 2016 06:01:18 +0000 (14:01 +0800)]
qemuDomainAttachNetDevice: pass mq and vectors for vhost-user with multiqueue

Two reasons:
1.in none hotplug, we will pass it. We can see from libvirt function
qemuBuildVhostuserCommandLine
2.qemu will use this vetcor num to init msix table. If we don't pass, qemu
will use default value, this will cause VM can only use default value
interrupts at most.

Signed-off-by: gaohaifeng <gaohaifeng.gao@huawei.com>
8 years agonews: Remove full stop at the end of the sentence
Martin Kletzander [Thu, 1 Dec 2016 12:40:09 +0000 (13:40 +0100)]
news: Remove full stop at the end of the sentence

To stay consistent.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agonews: Add "more PCIe less legacy PCI" to list of new features
Laine Stump [Wed, 30 Nov 2016 23:00:51 +0000 (18:00 -0500)]
news: Add "more PCIe less legacy PCI" to list of new features

8 years agoRefresh translations from zanata
Daniel P. Berrange [Thu, 1 Dec 2016 11:40:04 +0000 (11:40 +0000)]
Refresh translations from zanata

8 years agoNEWS: Remove end-of-sentence period
Andrea Bolognani [Thu, 1 Dec 2016 11:23:08 +0000 (12:23 +0100)]
NEWS: Remove end-of-sentence period

None of the other sentences in the file ends with the period,
and we want to maintain a consistent style.

8 years agoqemu: Prevent detaching SCSI controller used by hostdev
Eric Farman [Tue, 29 Nov 2016 21:40:16 +0000 (22:40 +0100)]
qemu: Prevent detaching SCSI controller used by hostdev

Consider the following XML snippets:

  $ cat scsicontroller.xml
      <controller type='scsi' model='virtio-scsi' index='0'/>
  $ cat scsihostdev.xml
      <hostdev mode='subsystem' type='scsi'>
        <source>
          <adapter name='scsi_host0'/>
          <address bus='0' target='8' unit='1074151456'/>
        </source>
      </hostdev>

If we create a guest that includes the contents of scsihostdev.xml,
but forget the virtio-scsi controller described in scsicontroller.xml,
one is silently created for us.  The same holds true when attaching
a hostdev before the matching virtio-scsi controller.
(See qemuDomainFindOrCreateSCSIDiskController for context.)

Detaching the hostdev, followed by the controller, works well and the
guest behaves appropriately.

If we detach the virtio-scsi controller device first, any associated
hostdevs are detached for us by the underlying virtio-scsi code (this
is fine, since the connection is broken).  But all is not well, as the
guest is unable to receive new virtio-scsi devices (the attach commands
succeed, but devices never appear within the guest), nor even be
shutdown, after this point.

While this is not libvirt's problem, we can prevent falling into this
scenario by checking if a controller is being used by any hostdev
devices.  The same is already done for disk elements today.

Applying this patch and then using the XML snippets from earlier:

  $ virsh detach-device guest_01 scsicontroller.xml
  error: Failed to detach device from scsicontroller.xml
  error: operation failed: device cannot be detached: device is busy

  $ virsh detach-device guest_01 scsihostdev.xml
  Device detached successfully

  $ virsh detach-device guest_01 scsicontroller.xml
  Device detached successfully

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agoqemu: assign VFIO devices to PCIe addresses when appropriate
Laine Stump [Wed, 2 Nov 2016 00:40:27 +0000 (20:40 -0400)]
qemu: assign VFIO devices to PCIe addresses when appropriate

Although nearly all host devices that are assigned to guests using
VFIO ("<hostdev>" devices in libvirt) are physically PCI Express
devices, until now libvirt's PCI address assignment has always
assigned them addresses on legacy PCI controllers in the guest, even
if the guest's machinetype has a PCIe root bus (e.g. q35 and
aarch64/virt).

This patch tries to assign them to an address on a PCIe controller
instead, when appropriate. First we do some preliminary checks that
might allow setting the flags without doing any extra work, and if
those conditions aren't met (and if libvirt is running privileged so
that it has proper permissions), we perform the (relatively) time
consuming task of reading the device's PCI config to see if it is an
Express device. If this is successful, the connect flags are set based
on the result, but if we aren't able to read the PCI config (most
likely due to the device not being present on the system at the time
of the check) we assume it is (or will be) an Express device, since
that is almost always the case anyway.

8 years agoqemu: propagate virQEMUDriver object to qemuDomainDeviceCalculatePCIConnectFlags
Laine Stump [Thu, 3 Nov 2016 20:33:32 +0000 (16:33 -0400)]
qemu: propagate virQEMUDriver object to qemuDomainDeviceCalculatePCIConnectFlags

If libvirtd is running unprivileged, it can open a device's PCI config
data in sysfs, but can only read the first 64 bytes. But as part of
determining whether a device is Express or legacy PCI,
qemuDomainDeviceCalculatePCIConnectFlags() will be updated in a future
patch to call virPCIDeviceIsPCIExpress(), which tries to read beyond
the first 64 bytes of the PCI config data and fails with an error log
if the read is unsuccessful.

In order to avoid creating a parallel "quiet" version of
virPCIDeviceIsPCIExpress(), this patch passes a virQEMUDriverPtr down
through all the call chains that initialize the
qemuDomainFillDevicePCIConnectFlagsIterData, and saves the driver
pointer with the rest of the iterdata so that it can be used by
qemuDomainDeviceCalculatePCIConnectFlags(). This pointer isn't used
yet, but will be used in an upcoming patch (that detects Express vs
legacy PCI for VFIO assigned devices) to examine driver->privileged.