]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
6 years agoconf: Introduce virDomainGraphics-related helpers
Erik Skultety [Mon, 26 Nov 2018 10:07:42 +0000 (11:07 +0100)]
conf: Introduce virDomainGraphics-related helpers

A few simple helpers that allow us to determine whether a graphics can
and will need to make use of a DRM render node.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Introduce virHostGetDRMRenderNode helper
Erik Skultety [Thu, 8 Nov 2018 10:47:09 +0000 (11:47 +0100)]
util: Introduce virHostGetDRMRenderNode helper

This is the first step towards libvirt picking the first available
render node instead of QEMU. It also makes sense for us to be able to do
that, since we allow specifying the node directly for SPICE, so if
there's no render node specified by the user, we should pick the first
available one. The algorithm used for that is essentially the same as
the one QEMU uses.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: handle multicast overflow on macvtap NIC_RX_FILTER_CHANGED
Jason Baron [Fri, 30 Nov 2018 17:50:26 +0000 (12:50 -0500)]
qemu: handle multicast overflow on macvtap NIC_RX_FILTER_CHANGED

Guest network devices can set 'overflow' when there are a number of multicast
ips configured. For virtio_net, the limit is only 64. In this case, the list
of mac addresses is empty and the 'overflow' condition is set. Thus, the guest
will currently receive no multicast traffic in this state.

When 'overflow' is set in the guest, let's turn this into ALLMULTI on the host.

Signed-off-by: Jason Baron <jbaron@akamai.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoNews: Add armv6l Support as guest
Stefan Schallenberg [Wed, 28 Nov 2018 21:45:16 +0000 (21:45 +0000)]
News: Add armv6l Support as guest

Signed-off-by: Stefan Schallenberg <infos@nafets.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Add Default PCI Device for armv6l versatilepb guests
Stefan Schallenberg [Wed, 28 Nov 2018 21:45:15 +0000 (21:45 +0000)]
qemu: Add Default PCI Device for armv6l versatilepb guests

Signed-off-by: Stefan Schallenberg <infos@nafets.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoAdd armv6l Support as guest
Stefan Schallenberg [Wed, 28 Nov 2018 21:45:14 +0000 (21:45 +0000)]
Add armv6l Support as guest

Support for armv6l qemu guests has been added.
Tested with arm1176 CPU on x86.

Signed-off-by: Stefan Schallenberg <infos@nafets.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agonews: Fix version number
Andrea Bolognani [Mon, 3 Dec 2018 13:17:41 +0000 (14:17 +0100)]
news: Fix version number

The schema expects it to match the pattern

  v[0-9]+\.[0-9]+\.[0-9]+

which "5.0.0" clearly doesn't, causing the build to fail.

Reported-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agomaint: Post-release version bump to 5.0.0
Andrea Bolognani [Mon, 3 Dec 2018 13:12:59 +0000 (14:12 +0100)]
maint: Post-release version bump to 5.0.0

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoRelease of libvirt-4.10.0
Daniel Veillard [Mon, 3 Dec 2018 12:15:36 +0000 (13:15 +0100)]
Release of libvirt-4.10.0

* docs/news.xml: updated for release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
6 years agotests: Sync qemucaps2xml with qemucapabilities
Andrea Bolognani [Thu, 29 Nov 2018 13:29:51 +0000 (14:29 +0100)]
tests: Sync qemucaps2xml with qemucapabilities

Commits d7434ae8009f and 9c4afbda3456 added replies files for
QEMU 3.0.0 on s390x and QEMU 3.1.0 on x86_64 respectively, but
only enabled the corresponding test in qemucapabilities and not
in qemucaps2xml.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agovirsh: Strip XML declaration when extracting CPU XMLs
Jiri Denemark [Thu, 22 Nov 2018 15:28:56 +0000 (16:28 +0100)]
virsh: Strip XML declaration when extracting CPU XMLs

Since commit v4.3.0-336-gc84726fbdd all
{hypervisor-,}cpu-{baseline,compare} commands use a generic
vshExtractCPUDefXMLs helper for extracting individual CPU definitions
from the provided input file. The helper wraps the input file in a
<container> element so that several independent elements can be easily
parsed from the file. This works fine except when the file starts with
XML declaration (<?xml version="1.0" ... ?>) because the XML declaration
cannot be put inside any element. In fact it has to be at the very
beginning of the XML document without any preceding white space
characters. We can just simply skip the XML declaration.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Fix post-copy migration on the source
Jiri Denemark [Thu, 15 Nov 2018 10:16:43 +0000 (11:16 +0100)]
qemu: Fix post-copy migration on the source

Post-copy migration has been broken on the source since commit
v3.8.0-245-g32c29f10db which implemented support for
pause-before-switchover QEMU migration capability.

Even though the migration itself went well, the source did not really
know when it switched to the post-copy mode despite the messages logged
by MIGRATION event handler. As a result of this, the events emitted by
source libvirtd were not accurate and statistics of the completed
migration would cover only the pre-copy part of migration. Moreover, if
migration failed during the post-copy phase for some reason, the source
libvirtd would just happily resume the domain, which could lead to disk
corruption.

With the pause-before-switchover capability enabled, the order of events
emitted by QEMU changed:

                    pause-before-switchover
           disabled                        enabled
    MIGRATION, postcopy-active      STOP
    STOP                            MIGRATION, pre-switchover
                                    MIGRATION, postcopy-active

The STOP even handler checks the migration status (postcopy-active) and
sets the domain state accordingly. Which is sufficient when
pause-before-switchover is disabled, but once we enable it, the
migration status is still active when we get STOP from QEMU. Thus the
domain state set in the STOP handler has to be corrected once we are
notified that migration changed to postcopy-active.

This results in two SUSPENDED events to be emitted by the source
libvirtd during post-copy migration. The first one with
VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED detail, while the second one reports
the corrected VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY detail. This is
inevitable because we don't know whether migration will eventually
switch to post-copy at the time we emit the first event.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotest: caps: Add capabilities for QEMU 3.1.0
Erik Skultety [Wed, 28 Nov 2018 11:14:20 +0000 (12:14 +0100)]
test: caps: Add capabilities for QEMU 3.1.0

These are based on QEMU v3.1.0-rc2-41-g4822f1ee9e.

Acked-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6 years agoRefresh translations from zanata
Daniel P. Berrangé [Wed, 28 Nov 2018 17:25:02 +0000 (17:25 +0000)]
Refresh translations from zanata

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agovsh-table: Get rid of trailing spaces
Simon Kobyda [Tue, 27 Nov 2018 09:07:32 +0000 (10:07 +0100)]
vsh-table: Get rid of trailing spaces

Get rid of trailing spaces which can be found after last column in tables.

Signed-off-by: Simon Kobyda <skobyda@redhat.com>
6 years agonews: Document nested-hv feature
Andrea Bolognani [Tue, 20 Nov 2018 16:35:36 +0000 (17:35 +0100)]
news: Document nested-hv feature

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Format nested-hv feature on the command line
Andrea Bolognani [Tue, 20 Nov 2018 16:23:09 +0000 (17:23 +0100)]
qemu: Format nested-hv feature on the command line

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoconf: Parse and format nested-hv feature
Andrea Bolognani [Tue, 20 Nov 2018 13:57:27 +0000 (14:57 +0100)]
conf: Parse and format nested-hv feature

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Introduce QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV
Andrea Bolognani [Tue, 20 Nov 2018 12:56:38 +0000 (13:56 +0100)]
qemu: Introduce QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agotests: Add capabilities data for QEMU 3.1.0 on ppc64
Andrea Bolognani [Tue, 20 Nov 2018 13:00:09 +0000 (14:00 +0100)]
tests: Add capabilities data for QEMU 3.1.0 on ppc64

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Drop duplicated code from qemuDomainDefValidateFeatures()
Andrea Bolognani [Tue, 20 Nov 2018 14:15:54 +0000 (15:15 +0100)]
qemu: Drop duplicated code from qemuDomainDefValidateFeatures()

Both VIR_DOMAIN_FEATURE_HPT and VIR_DOMAIN_FEATURE_HTM are
handled in the exact same way, so we can remove some duplicated
code without losing any functionality.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agodocs: Updated news.xml for CMT
Wang Huaqiang [Mon, 26 Nov 2018 17:56:17 +0000 (01:56 +0800)]
docs: Updated news.xml for CMT

Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Report cache occupancy (CMT) with domstats
Wang Huaqiang [Mon, 26 Nov 2018 17:56:16 +0000 (01:56 +0800)]
qemu: Report cache occupancy (CMT) with domstats

Adding the interface in qemu to report CMT statistic information
through command 'virsh domstats --cpu-total'.

Below is a typical output:

         # virsh domstats 1 --cpu-total
         Domain: 'ubuntu16.04-base'
           ...
           cpu.cache.monitor.count=2
           cpu.cache.monitor.0.name=vcpus_1
           cpu.cache.monitor.0.vcpus=1
           cpu.cache.monitor.0.bank.count=2
           cpu.cache.monitor.0.bank.0.id=0
           cpu.cache.monitor.0.bank.0.bytes=4505600
           cpu.cache.monitor.0.bank.1.id=1
           cpu.cache.monitor.0.bank.1.bytes=5586944
           cpu.cache.monitor.1.name=vcpus_4-6
           cpu.cache.monitor.1.vcpus=4,5,6
           cpu.cache.monitor.1.bank.count=2
           cpu.cache.monitor.1.bank.0.id=0
           cpu.cache.monitor.1.bank.0.bytes=17571840
           cpu.cache.monitor.1.bank.1.id=1
           cpu.cache.monitor.1.bank.1.bytes=29106176

Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoutil: Introduce virResctrlMonitorFreeStats
Wang Huaqiang [Mon, 26 Nov 2018 17:56:15 +0000 (01:56 +0800)]
util: Introduce virResctrlMonitorFreeStats

The call of virResctrlMonitorGetStats will allocate the memory for
holding cache occupancy or memory bandwidth statistics.

This patch adds the function virResctrlMonitorFreeStats as the
opposing action of virResctrlMonitorGetStats to free the memory.

Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoutil: Return a list of pointer in virResctrlMonitorGetStats
Wang Huaqiang [Mon, 26 Nov 2018 17:56:14 +0000 (01:56 +0800)]
util: Return a list of pointer in virResctrlMonitorGetStats

Return a list of virResctrlMonitorStatsPtr instead of
a virResctrlMonitorStats array in virResctrlMonitorGetStats.

Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agonews: Mention support for Xen's PVH machine type
Marek Marczykowski-Górecki [Mon, 26 Nov 2018 19:34:41 +0000 (20:34 +0100)]
news: Mention support for Xen's PVH machine type

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
6 years agoxenconfig: add support for type="pvh"
Marek Marczykowski-Górecki [Mon, 26 Nov 2018 19:34:40 +0000 (20:34 +0100)]
xenconfig: add support for type="pvh"

Handle PVH domain type in both directions (xen-xl->xml, xml->xen-xl).
And add a test for it.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
6 years agoxenconfig: add support for parsing type= xl config entry
Marek Marczykowski-Górecki [Mon, 26 Nov 2018 19:34:39 +0000 (20:34 +0100)]
xenconfig: add support for parsing type= xl config entry

builder="hvm" is deprecated since Xen 4.10, new syntax is type="hvm" (or
type="pv", which is default). Since the old one is still supported,
still use it when writing native config, so the config will work on
older Xen too (and will also not complicate tests).

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
6 years agotests: add basic Xen PVH test
Marek Marczykowski-Górecki [Mon, 26 Nov 2018 19:34:38 +0000 (20:34 +0100)]
tests: add basic Xen PVH test

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
6 years agolibxl: add support for PVH
Marek Marczykowski-Górecki [Mon, 26 Nov 2018 19:34:37 +0000 (20:34 +0100)]
libxl: add support for PVH

Since this is something between PV and HVM, it makes sense to put the
setting in place where domain type is specified.
To enable it, use <os><type machine="xenpvh">xenpvh</type></os>. It is
also included in capabilities.xml, for every supported HVM guest type - it
doesn't seems to be any other requirement (besides new enough Xen).

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
6 years agolibxl: reorder libxlMakeDomBuildInfo for upcoming PVH support
Marek Marczykowski-Górecki [Mon, 26 Nov 2018 19:34:36 +0000 (20:34 +0100)]
libxl: reorder libxlMakeDomBuildInfo for upcoming PVH support

Make it easier to share HVM and PVH code where relevant. No functional
change.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
6 years agotest: Convert testDriver to virObjectLockable
Marc Hartmayer [Tue, 20 Nov 2018 13:54:16 +0000 (14:54 +0100)]
test: Convert testDriver to virObjectLockable

The test driver state (@testDriver) uses it's own reference counting
and locking implementation. Instead of doing that, convert @testDriver
into a virObjectLockable and use the provided functionalities.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
6 years agoutil: netdevbridge: fall back to ioctl from sysfs
Christian Ehrhardt [Tue, 20 Nov 2018 07:55:49 +0000 (08:55 +0100)]
util: netdevbridge: fall back to ioctl from sysfs

There are certain cases e.g. containers where the sysfs path might
exists, but might fail. Unfortunately the exact restrictions are only
known to libvirt when trying to write to it so we need to try it.

But in case it fails there is no need to fully abort, in those cases try
to fall back to the older ioctl interface which can still work.

That makes setting up a bridge in unprivileged LXD containers work.

Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1802906
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
Reported-by: Brian Candler <b.candler@pobox.com>
6 years agoqemuMigrationSrcConfirm: Don't remove domain config if confirm phase fails
Michal Privoznik [Thu, 22 Nov 2018 13:12:14 +0000 (14:12 +0100)]
qemuMigrationSrcConfirm: Don't remove domain config if confirm phase fails

If migration is cancelled or confirm phase fails the domain
should be kept on the source even if VIR_MIGRATE_UNDEFINE_SOURCE
was requested.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agoqemuMigrationDstPrepareAny: Parse cookie before adding domain onto list
Michal Privoznik [Thu, 22 Nov 2018 10:31:00 +0000 (11:31 +0100)]
qemuMigrationDstPrepareAny: Parse cookie before adding domain onto list

There are some checks done when parsing a migration cookie. For
instance, one of the checks ensures that the domain is not being
migrated onto the same host. If that is the case, then we are in
big trouble because the @vm is the same domain object used by
source and it has some jobs sets and everything so recovering
from failed cookie parsing would be needlessly hard.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agoqemuMigrationEatCookie: Pass virDomainDef instead of virDomainObj
Michal Privoznik [Thu, 22 Nov 2018 10:24:03 +0000 (11:24 +0100)]
qemuMigrationEatCookie: Pass virDomainDef instead of virDomainObj

The function currently takes virDomainObjPtr because it's using
both: the domain definition and domain private data.
Unfortunately, this means that in prepare phase we can't parse
migration cookie before putting incoming domain def onto domain
objects list (addressed in the very next commit). Change the
arguments so that virDomainDef and private data are passed
instead of virDomainObjPtr.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agoqemuMigrationDstPrepareAny: Don't overwrite error in cleanup path
Michal Privoznik [Wed, 21 Nov 2018 08:01:59 +0000 (09:01 +0100)]
qemuMigrationDstPrepareAny: Don't overwrite error in cleanup path

There are several functions called in the cleanup path. Some of
them do report error (e.g. qemuDomainRemoveInactiveJob()) which
may result in overwriting an error reported earlier with some
less useful message.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agosecurity: aa-helper: Fix static defined vfio MDEVs
Christian Ehrhardt [Thu, 22 Nov 2018 12:55:02 +0000 (13:55 +0100)]
security: aa-helper: Fix static defined vfio MDEVs

virt-aa-helper needs to grant QEMU access to VFIO MDEV devices.

This extends commit 74e86b6b which only covered PCI hostdevs for VFIO-PCI
assignment by now also covering vfio MDEVs.
It has still the same limitations regarding the device lifecycle, IOW we're
unable to predict the actual VFIO device being created, thus we need
wildcards.

Also note that the hotplug case, where apparmor is able to detect the actual
VFIO device during runtime, is already covered by commit 606afafb.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
6 years agoutil: Fix a bug in virResctrlMonitorGetStats
Wang Huaqiang [Tue, 20 Nov 2018 02:10:39 +0000 (10:10 +0800)]
util: Fix a bug in virResctrlMonitorGetStats

The path argument of virFileIsDir should be a full name
of file, pathname and filename. Fixed it by passing the
full path name to virFileIsDir.

Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoutil: Fix virDoes*Exist return type
Martin Kletzander [Mon, 19 Nov 2018 21:31:01 +0000 (22:31 +0100)]
util: Fix virDoes*Exist return type

Since the functions only return 0 or 1, they should return bool.  I missed the
change when "refactoring" the first commit.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
6 years agoqemu: Fix virDoes*Exist usage
Martin Kletzander [Mon, 19 Nov 2018 21:25:21 +0000 (22:25 +0100)]
qemu: Fix virDoes*Exist usage

The virGet*ID() functions should be called only if the user exists not when it
doesn't.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
6 years agodocs: Add news article for IOThread polling
John Ferlan [Fri, 19 Oct 2018 14:17:32 +0000 (10:17 -0400)]
docs: Add news article for IOThread polling

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agotools: Add virsh iothreadset command
John Ferlan [Fri, 5 Oct 2018 12:53:09 +0000 (08:53 -0400)]
tools: Add virsh iothreadset command

Add a command to allow for setting various dynamic IOThread polling
interval scope (poll-max-ns, poll-grow, and poll-shrink). Describe
the values in the virsh.pod in as generic terms as possible. The
more specific QEMU algorithm has been divulged in the previous patch.

Based heavily on code originally posted by Pavel Hrdina
<phrdina@redhat.com>, but altered to only provide one command
and to not managed a poll disabled state.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Introduce qemuDomainSetIOThreadParams
John Ferlan [Wed, 3 Oct 2018 22:32:23 +0000 (18:32 -0400)]
qemu: Introduce qemuDomainSetIOThreadParams

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

Implement the QEMU driver mechanism in order to set the polling
parameters for an IOThread within the bounds specified by the
QEMU qapi parameter passing.

Based heavily on patches originally posted by Pavel Hrdina
<phrdina@redhat.com>, but modified to only handle alterations
for a running guest. For the most part the API names changed,
the typed parameters removed the poll enabled value, and the
capabilities check was moved to just before the live attempt
to set. Since changes are only supported for a running guest,
no guest XML alterations were kept.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Detect whether iothread polling is supported
John Ferlan [Fri, 5 Oct 2018 19:59:49 +0000 (15:59 -0400)]
qemu: Detect whether iothread polling is supported

Add a capability check for IOThread polling (all were added at the
same time, so only one check is necessary).

Based on code originally posted by Pavel Hrdina <phrdina@redhat.com>
with the only changes to include the more recent QEMU releases.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Alter qemuDomainChgIOThread to take qemuMonitorIOThreadInfo
John Ferlan [Thu, 4 Oct 2018 13:20:47 +0000 (09:20 -0400)]
qemu: Alter qemuDomainChgIOThread to take qemuMonitorIOThreadInfo

Rather than passing an iothread_id, let's pass a qemuMonitorIOThreadInfo
structure so that a subsequent change to modify the iothread info can
just generate and pass one.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Alter qemuDomainChgIOThread to take enum instead of bool
John Ferlan [Wed, 3 Oct 2018 22:46:05 +0000 (18:46 -0400)]
qemu: Alter qemuDomainChgIOThread to take enum instead of bool

We're about to add a new state "modify" and thus the function
goes from just Add/Del. Use an enum to manage.

Extracted from code originally posted by Pavel Hrdina
<phrdina@redhat.com>, but placed into a separate patch.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Add monitor functions to set IOThread params
John Ferlan [Wed, 3 Oct 2018 22:13:14 +0000 (18:13 -0400)]
qemu: Add monitor functions to set IOThread params

Add functions to set the IOThreadInfo param data for the live guest.
Modify the _qemuMonitorIOThreadInfo to have a flag to indicate when
a value was set so that we don't set a value unless it was desired
to be set.

Based on code originally posted by Pavel Hrdina <phrdina@redhat.com>,
but extracted into a separate patch. Note that qapi expects to receive
integer parameters rather than unsigned long long or unsigned int's.
QEMU does save the value in larger signed 64 bit values eventually.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agolib: Introduce virDomainSetIOThreadParams
John Ferlan [Wed, 3 Oct 2018 21:57:56 +0000 (17:57 -0400)]
lib: Introduce virDomainSetIOThreadParams

Create a new API that will allow an adjustment of IOThread
polling parameters for the specified IOThread. These parameters
will not be saved in the guest XML. Currently the only parameters
supported will allow the hypervisor to adjust the parameters used
to limit and alter the scope of the polling interval. The polling
interval allows the IOThread to spend more or less time processing
in the guest.

Based on code originally posted by Pavel Hrdina <phrdina@redhat.com>
to add virDomainAddIOThreadParams and virDomainModIOThreadParams.
Modification of those changes to use virDomainSetIOThreadParams
instead and remove concepts related to saving the data in guest
XML as well as the way to specifically enable the polling parameters.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agovirsh: Add ability to display IOThread stats
John Ferlan [Wed, 3 Oct 2018 19:04:14 +0000 (15:04 -0400)]
virsh: Add ability to display IOThread stats

Add an --iothread qualifier to domstats and an explanation in
the man page. Describe the values in as generic terms as possible
allowing each hypervisor to provide a specific algorithm to utilize
the values as it sees fit.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Implement the ability to return IOThread stats
John Ferlan [Wed, 3 Oct 2018 12:26:13 +0000 (08:26 -0400)]
qemu: Implement the ability to return IOThread stats

Process the IOThreads polling stats if available. Generate the
output params record to be returned to the caller with the three
values - poll-max-ns, poll-grow, and poll-shrink.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Split qemuDomainGetIOThreadsLive
John Ferlan [Wed, 3 Oct 2018 12:48:30 +0000 (08:48 -0400)]
qemu: Split qemuDomainGetIOThreadsLive

Separate out the fetch of the IOThread monitor call into a separate
helper so that a subsequent domain statistics change can fetch the raw
IOThread data and parse it as it sees fit.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Check for and return IOThread polling values if available
John Ferlan [Wed, 3 Oct 2018 11:38:34 +0000 (07:38 -0400)]
qemu: Check for and return IOThread polling values if available

If there are IOThread polling values in the query-iothreads return
buffer, then fill them in and set a bool indicating their presence.
This will allow for displaying in a domain stats output eventually.

Note that the QEMU values are managed a bit differently (as int's
stored in int64_t's) than we will manage them (as unsigned long and
int values). This is intentional to allow for value validation
checking when it comes time to provide the values to QEMU.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agodocs: Fix some minor issues with formatdomain docs
ZhiPeng Lu [Fri, 16 Nov 2018 01:29:29 +0000 (09:29 +0800)]
docs: Fix some minor issues with formatdomain docs

Item redundancy, some forgotten extra blank lines, etc.

Signed-off-by: ZhiPeng Lu <luzhipeng@uniudc.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoconf: fix build by using ret variable when returning from functions
Pavel Hrdina [Sun, 18 Nov 2018 12:41:54 +0000 (13:41 +0100)]
conf: fix build by using ret variable when returning from functions

Introduced-by: c3a208af0d894daaa840177b749a0ecf35445a4b
Reported-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agoconf: Perform error checking in virDomainDeviceInfoFormat()
Andrea Bolognani [Fri, 16 Nov 2018 15:16:26 +0000 (16:16 +0100)]
conf: Perform error checking in virDomainDeviceInfoFormat()

virXMLFormatElement() might fail, but we were not checking
its return value.

Fixing this requires us to change virDomainDeviceInfoFormat()
so that it can report an error back to the caller.

Introduced-by: 0d6b87335c00451b0923ecc91d617f71e4135bf8
Spotted-by: Coverity
Reported-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
6 years agoconf: Add several cleanup paths
Andrea Bolognani [Fri, 16 Nov 2018 15:08:03 +0000 (16:08 +0100)]
conf: Add several cleanup paths

In many cases, an early exit from a function would cause
memory allocated by local virBuffer instances not to be
released.

Provide proper cleanup paths to solve the issue.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
6 years agoconf: Fix error flow in virDomainPCIAddressEnsureAddr()
Andrea Bolognani [Fri, 16 Nov 2018 14:04:07 +0000 (15:04 +0100)]
conf: Fix error flow in virDomainPCIAddressEnsureAddr()

This avoids setting 'ret' multiple times, which will result
in errors being masked if the first operation fails but the
second one succeeds.

Introduced-by: f183b87fc1dbcc6446ac3c1cef9cdd345b9725fb
Spotted-by: Coverity
Reported-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
6 years agoRevert "virlockspace: Allow caller to specify start and length offset in virLockSpace...
Michal Privoznik [Tue, 2 Oct 2018 13:10:22 +0000 (15:10 +0200)]
Revert "virlockspace: Allow caller to specify start and length offset in virLockSpaceAcquireResource"

This reverts commit afd5a27575e8b6a494d2728552fe0e89c71e32b4.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoRevert "lock_driver_lockd: Introduce VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_METADAT...
Michal Privoznik [Tue, 2 Oct 2018 13:10:18 +0000 (15:10 +0200)]
Revert "lock_driver_lockd: Introduce VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_METADATA flag"

This reverts commit 21c34b86be5233634eb38f77be64e2263bfc4e48.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoRevert "lock_driver: Introduce new VIR_LOCK_MANAGER_OBJECT_TYPE_DAEMON"
Michal Privoznik [Tue, 2 Oct 2018 13:10:11 +0000 (15:10 +0200)]
Revert "lock_driver: Introduce new VIR_LOCK_MANAGER_OBJECT_TYPE_DAEMON"

This reverts commit 22baf6e08c65d9174b24f66370724ce961ce9576.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoRevert "_virLockManagerLockDaemonPrivate: Move @hasRWDisks into dom union"
Michal Privoznik [Tue, 2 Oct 2018 13:10:03 +0000 (15:10 +0200)]
Revert "_virLockManagerLockDaemonPrivate: Move @hasRWDisks into dom union"

This reverts commit aaf34cb9013d6d746f4edf9807408cb9dfbcf01d.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoRevert "lock_driver: Introduce VIR_LOCK_MANAGER_RESOURCE_TYPE_METADATA"
Michal Privoznik [Tue, 2 Oct 2018 13:09:58 +0000 (15:09 +0200)]
Revert "lock_driver: Introduce VIR_LOCK_MANAGER_RESOURCE_TYPE_METADATA"

This reverts commit 997283b54b0e1f599aed3085ceba027eb8110acb.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoRevert "lock_driver: Introduce VIR_LOCK_MANAGER_ACQUIRE_ROLLBACK"
Michal Privoznik [Tue, 2 Oct 2018 13:09:53 +0000 (15:09 +0200)]
Revert "lock_driver: Introduce VIR_LOCK_MANAGER_ACQUIRE_ROLLBACK"

This reverts commit 385eb8399bdb1610447c2857abfe99cee4a9fb9e.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoRevert "lock_manager: Allow disabling configFile for virLockManagerPluginNew"
Michal Privoznik [Tue, 2 Oct 2018 13:09:45 +0000 (15:09 +0200)]
Revert "lock_manager: Allow disabling configFile for virLockManagerPluginNew"

This reverts commit 35b5b244da825fb41e35e4dc62e740d716214ec9.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoRevert "qemu_conf: Introduce metadata_lock_manager"
Michal Privoznik [Tue, 2 Oct 2018 13:09:30 +0000 (15:09 +0200)]
Revert "qemu_conf: Introduce metadata_lock_manager"

This reverts commit 8b8aefb3d6ae2139ea3d4ef6d7dd2c06f57f6075.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoRevert "security_manager: Load lock plugin on init"
Michal Privoznik [Tue, 2 Oct 2018 13:08:28 +0000 (15:08 +0200)]
Revert "security_manager: Load lock plugin on init"

This reverts commit 3e26b476b5f322353bf0dcd8e3f037ca672b8c62.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agosecurity_manager: Rework metadata locking
Michal Privoznik [Tue, 2 Oct 2018 12:47:20 +0000 (14:47 +0200)]
security_manager: Rework metadata locking

Trying to use virlockd to lock metadata turns out to be too big
gun. Since we will always spawn a separate process for relabeling
we are safe to use thread unsafe POSIX locks and take out
virtlockd completely out of the picture.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovirSecurityManagerTransactionCommit: Do metadata locking iff enabled in config
Michal Privoznik [Tue, 13 Nov 2018 09:57:25 +0000 (10:57 +0100)]
virSecurityManagerTransactionCommit: Do metadata locking iff enabled in config

When metadata locking is enabled that means the security commit
processing will be run in a fork similar to how namespaces use fork()'s
for processing. This is done to ensure libvirt can properly and
synchronously modify the metadata to store the original owner data.

Since fork()'s (e.g. virFork) have been seen as a performance bottleneck
being able to disable them allows the admin to choose whether the
performance 'hit' is worth the extra 'security' of being able to
remember the original owner of a lock.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu_domain: Track if domain remembers original owner
Michal Privoznik [Tue, 13 Nov 2018 11:50:41 +0000 (12:50 +0100)]
qemu_domain: Track if domain remembers original owner

For metadata locking we might need an extra fork() which given
latest attempts to do fewer fork()-s is suboptimal. Therefore,
there will be a qemu.conf knob to {en|dis}able this feature. But
since the feature is actually not metadata locking itself rather
than remembering of the original owner of the file this is named
as 'rememberOwner'. But patches for that feature are not even
posted yet so there is actually no qemu.conf entry in this patch
nor a way to enable this feature.

Even though this is effectively a dead code for now it is still
desired.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu_tpm: Pass virDomainObjPtr instead of virDomainDefPtr
Michal Privoznik [Tue, 13 Nov 2018 14:14:43 +0000 (15:14 +0100)]
qemu_tpm: Pass virDomainObjPtr instead of virDomainDefPtr

The TPM code currently accepts pointer to a domain definition.
This is okay for now, but in near future the security driver APIs
it calls will require domain object. Therefore, change the TPM
code to accept the domain object pointer.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovirprocess: Make virProcessRunInMountNamespace use virProcessRunInFork
Michal Privoznik [Tue, 16 Oct 2018 09:24:39 +0000 (11:24 +0200)]
virprocess: Make virProcessRunInMountNamespace use virProcessRunInFork

Both virProcessRunInMountNamespace() and virProcessRunInFork()
look very similar. De-duplicate the code and make
virProcessRunInMountNamespace() call virProcessRunInFork().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovirprocess: Introduce virProcessRunInFork
Michal Privoznik [Tue, 16 Oct 2018 08:50:33 +0000 (10:50 +0200)]
virprocess: Introduce virProcessRunInFork

This new helper can be used to spawn a child process and run
passed callback from it. This will come handy esp. if the
callback is not thread safe.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: add memfd source type
Marc-André Lureau [Thu, 15 Nov 2018 11:55:53 +0000 (15:55 +0400)]
qemu: add memfd source type

Add a new memoryBacking source type "memfd", supported by QEMU (when
the capability is available).

A memfd is a specialized anonymous memory kind. As such, an anonymous
source type could be automatically using a memfd. However, there are
some complications when migrating from different memory backends in
qemu (mainly due to the internal object naming at this point, but
there could be more). For now, it is simpler and safer to simply
introduce a new source type "memfd". Eventually, the "anonymous" type
could learn to use memfd transparently in a separate change.

The main benefits are that it doesn't need to create filesystem files,
and it also enforces sealing, providing a bit more safety.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: check memory-backend-memfd.hugetlb capability
Marc-André Lureau [Thu, 15 Nov 2018 11:55:52 +0000 (15:55 +0400)]
qemu: check memory-backend-memfd.hugetlb capability

QEMU 3.1 should only expose the property if the host is actually
capable of creating hugetable-backed memfd. However, it may fail
at runtime depending on requested "hugetlbsize".

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: add memory-backend-memfd capability check
Marc-André Lureau [Thu, 15 Nov 2018 11:55:51 +0000 (15:55 +0400)]
qemu: add memory-backend-memfd capability check

Check availability of "-object memory-backend-memfd".

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu_process.c: removing qemuProcessStartValidateXML
Daniel Henrique Barboza [Wed, 14 Nov 2018 19:52:07 +0000 (17:52 -0200)]
qemu_process.c: removing qemuProcessStartValidateXML

Commit ("qemu_domain.c: moving maxCpu validation to
qemuDomainDefValidate") shortened the code of qemuProcessStartValidateXML.
The function is called only by qemuProcessStartValidate, in the
same file, and its code is now a single check that calls virDomainDefValidate.

Instead of leaving a function call just to execute a single check,
this patch puts the check in the body of qemuProcessStartValidate in the
place where qemuProcessStartValidateXML was being called. The function can
now be removed.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu_process.c: moving qemuValidateCpuCount to qemu_domain.c
Daniel Henrique Barboza [Wed, 14 Nov 2018 19:52:06 +0000 (17:52 -0200)]
qemu_process.c: moving qemuValidateCpuCount to qemu_domain.c

Previous patch removed the call to qemuProcessValidateCpuCount
from qemuProcessStartValidateXML, in qemu_process.c. The only
caller left is qemuDomainDefValidate, in qemu_domain.c.

Instead of having a public function declared inside qemu_process.c
that isn't used in that file, this patch moves the function to
qemu_domain.c, making in static and renaming it to
qemuDomainValidateCpuCount to be compliant with other static
functions names in the file.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu_domain.c: moving maxCpu validation to qemuDomainDefValidate
Daniel Henrique Barboza [Wed, 14 Nov 2018 19:52:05 +0000 (17:52 -0200)]
qemu_domain.c: moving maxCpu validation to qemuDomainDefValidate

Adding maxCpu validation in qemuDomainDefValidate allows the user to
spot over the board maxCpus counts at editing time, instead of
facing a runtime error when starting the domain. This check is also
arch independent.

This leaves us with 2 calls to qemuProcessValidateCpuCount: one in
qemuProcessStartValidateXML and the new one at qemuDomainDefValidate.

The call in qemuProcessStartValidateXML is redundant. Following
up in that code, there is a call to virDomainDefValidate, which
in turn will call config.domainValidateCallback. In this case, the
callback function is qemuDomainDefValidate. This means that, on startup
time, qemuProcessValidateCpuCount will be called twice.

To avoid that, let's also remove the qemuProcessValidateCpuCount call
from qemuProcessStartValidateXML.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu_process.c: make qemuValidateCpuCount public
Daniel Henrique Barboza [Wed, 14 Nov 2018 19:52:04 +0000 (17:52 -0200)]
qemu_process.c: make qemuValidateCpuCount public

qemuValidateCpuCount validates the maxCpus value of a domain at
startup time, preventing it to start if the value exceeds a maximum.

This checking is also done at qemu_domain.c, qemuDomainDefValidate.
However, it is done only for x86 (and even then, in a specific
scenario). We want this check to be done for all archs.

To accomplish this, let's first make qemuValidateCpuCount public so
it can be used inside qemuDomainDefValidate. The function was renamed
to qemuProcessValidateCpuCount to be compliant with the other public
methods at qemu_process.h. The method signature was slightly adapted
to fit the const 'def' variable used in qemuDomainDefValidate. This
change has no downside in in its original usage at
qemuProcessStartValidateXML.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu_process.c: adding maxCpus value to error message
Daniel Henrique Barboza [Wed, 14 Nov 2018 19:52:03 +0000 (17:52 -0200)]
qemu_process.c: adding maxCpus value to error message

Adding the maxCpus value in the error message of qemuValidateCpuCount
allows the user to set an acceptable maxCpus count without knowing
QEMU internals.

x86 guests, that might have been created prior to the x86
qemuDomainDefValidate maxCpus check code (that validates the maxCpus value
in editing time), will also benefit from this change.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: agent: Avoid agentError when closing the QEMU agent
Wang Yechao [Fri, 12 Oct 2018 02:19:28 +0000 (10:19 +0800)]
qemu: agent: Avoid agentError when closing the QEMU agent

The commit 89563efc0209b854d2b2e554423423d7602acdbd fix the
monitor error when closing the QEMU monitor. The QEMU agent
has a problem similar to QEMU monitor. So fix the QEMU agent
with the same method.

Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoutil: Fix virpci compilation on non-Linux
Andrea Bolognani [Thu, 15 Nov 2018 14:50:21 +0000 (15:50 +0100)]
util: Fix virpci compilation on non-Linux

We were mistakenly skipping virZPCIDeviceAddressIsEmpty() and
virZPCIDeviceAddressIsValid() when compiling on non-Linux,
which unsurprisingly ended up causing linking failures later
in the build process.

Clue-stick-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agonews: Update news for PCI address extension attributes
Yi Min Zhao [Thu, 8 Nov 2018 11:00:32 +0000 (19:00 +0800)]
news: Update news for PCI address extension attributes

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Add hotpluging support for PCI devices on S390 guests
Yi Min Zhao [Thu, 8 Nov 2018 11:00:30 +0000 (19:00 +0800)]
qemu: Add hotpluging support for PCI devices on S390 guests

This commit adds hotplug support for PCI devices on S390 guests.
There's no need to implement hot unplug for zPCI as QEMU implements
an unplug callback which will unplug both PCI and zPCI device in a
cascaded way.
Currently, the following PCI devices are supported:
  virtio-blk-pci
  virtio-net-pci
  virtio-rng-pci
  virtio-input-host-pci
  virtio-keyboard-pci
  virtio-mouse-pci
  virtio-tablet-pci
  vfio-pci
  SCSIVhost device

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Generate and use zPCI device in QEMU command line
Yi Min Zhao [Thu, 8 Nov 2018 11:00:29 +0000 (19:00 +0800)]
qemu: Generate and use zPCI device in QEMU command line

Add new functions to generate zPCI command string and append it to
QEMU command line. And the related tests are added.

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agodocs: Add 'uid' and 'fid' information
Yi Min Zhao [Thu, 8 Nov 2018 11:00:31 +0000 (19:00 +0800)]
docs: Add 'uid' and 'fid' information

Update 'Device address' section to describe 'zpci' element and
its two attributes 'uid' and 'fid'.

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoconf: Allocate/release 'uid' and 'fid' in PCI address
Yi Min Zhao [Thu, 8 Nov 2018 11:00:28 +0000 (19:00 +0800)]
conf: Allocate/release 'uid' and 'fid' in PCI address

This patch adds new functions for reservation, assignment and release
to handle the uid/fid. If the uid/fid is defined in the domain XML,
they will be reserved directly in the collecting phase. If any of them
is not defined, we will find out an available value for them from the
zPCI address hashtable, and reserve them. For the hotplug case there
might not be a zPCI definition. So allocate and reserve uid/fid the
case. Assign if needed and reserve uid/fid for the defined case.

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Add zPCI address definition check
Yi Min Zhao [Thu, 8 Nov 2018 11:00:27 +0000 (19:00 +0800)]
qemu: Add zPCI address definition check

We should ensure that QEMU supports zPCI when a zPCI address is defined
in XML and otherwise report an error. This patch introduces a generic
validation function qemuDomainDeviceDefValidateAddress() which calls
qemuDomainDeviceDefValidateZPCIAddress() if address type is PCI address.

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoconf: Introduce parser, formatter for uid and fid
Yi Min Zhao [Thu, 8 Nov 2018 11:00:26 +0000 (19:00 +0800)]
conf: Introduce parser, formatter for uid and fid

This patch introduces new XML parser/formatter functions. Uid is
16-bit and non-zero. Fid is 32-bit. They are the two attributes of zpci
which is introduced as PCI address element. Zpci element is parsed and
formatted along with PCI address. And add the related test cases.

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoconf: use virXMLFormatElement() in virDomainDeviceInfoFormat()
Yi Min Zhao [Thu, 8 Nov 2018 11:00:25 +0000 (19:00 +0800)]
conf: use virXMLFormatElement() in virDomainDeviceInfoFormat()

In order to add zPCI child element for PCI address, we update
virDomainDeviceInfoFormat() to format device info by helper function
virXMLFormatElement(). Then we could simply format zPCI address into
child buffer later.

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Auto add pci-root for s390/s390x guests
Yi Min Zhao [Thu, 8 Nov 2018 11:00:23 +0000 (19:00 +0800)]
qemu: Auto add pci-root for s390/s390x guests

The pci-root depends on zpci capability. So autogenerate pci-root if
zpci exists.

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoconf: Introduce address caching for PCI extensions
Yi Min Zhao [Thu, 8 Nov 2018 11:00:24 +0000 (19:00 +0800)]
conf: Introduce address caching for PCI extensions

This patch provides a caching mechanism for the device address
extensions uid and fid on S390. For efficient sparse address allocation,
we introduce two hash tables for uid/fid which hold the address set
information per domain. Also in order to improve performance of
searching available value, we introduce our own callbacks for the two
hashtables. In this way, uid/fid is saved in hash key and hash value
could be any non-NULL pointer due to no operation on hash value. That is
also the reason why we don't introduce hash value free callback.

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoconf: Introduce extension flag and zPCI member for PCI address
Yi Min Zhao [Thu, 8 Nov 2018 11:00:21 +0000 (19:00 +0800)]
conf: Introduce extension flag and zPCI member for PCI address

This patch introduces PCI address extension flag for virDomainDeviceInfo
and virPCIDeviceAddress. The extension flag in virDomainDeviceInfo is
used internally during calculating PCI extension flag. The one in
virPCIDeviceAddress is the duplicate to indicate extension address is
being used. Currently only zPCI extension address is introduced to deal
with 'uid' and 'fid' on the S390 platform.

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Enable PCI multi bus for S390 guests
Yi Min Zhao [Thu, 8 Nov 2018 11:00:22 +0000 (19:00 +0800)]
qemu: Enable PCI multi bus for S390 guests

QEMU on s390 supports PCI multibus since forever.

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Introduce zPCI capability
Yi Min Zhao [Thu, 8 Nov 2018 11:00:20 +0000 (19:00 +0800)]
qemu: Introduce zPCI capability

Let's introduce zPCI capability.

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoconf: Add definitions for 'uid' and 'fid' PCI address attributes
Yi Min Zhao [Thu, 8 Nov 2018 11:00:19 +0000 (19:00 +0800)]
conf: Add definitions for 'uid' and 'fid' PCI address attributes

Add zPCI definitions in preparation of extending the PCI address
with parameters uid (user-defined identifier) and fid (PCI function
identifier).

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agonews: mention Hyper-V PV IPI and Enlightened VMCS support
Vitaly Kuznetsov [Wed, 14 Nov 2018 22:46:08 +0000 (23:46 +0100)]
news: mention Hyper-V PV IPI and Enlightened VMCS support

The QEMU driver now has support for Hyper-V PV IPI and Enlightened VMCS
for Windows and Hyper-V guests.

Suggested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
6 years agoqemu: add support for Hyper-V Enlightened VMCS
Vitaly Kuznetsov [Wed, 14 Nov 2018 22:46:07 +0000 (23:46 +0100)]
qemu: add support for Hyper-V Enlightened VMCS

QEMU 3.1 supports Hyper-V Enlightened VMCS feature which significantly
speeds up nested Hyper-V on KVM environments.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
6 years agoconf: add support for Hyper-V Enlightened VMCS
Vitaly Kuznetsov [Wed, 14 Nov 2018 22:46:06 +0000 (23:46 +0100)]
conf: add support for Hyper-V Enlightened VMCS

Support Hyper-V Enlightened VMCS in domain config. QEMU support will
be implemented in the next patch, adding interim VIR_DOMAIN_HYPERV_EVMCS
cases to src/qemu/* for now.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>