]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agoapi: disallow virConnect*HypervisorCPU on read-only connections
Ján Tomko [Fri, 14 Jun 2019 07:17:39 +0000 (09:17 +0200)]
api: disallow virConnect*HypervisorCPU on read-only connections

These APIs can be used to execute arbitrary emulators.
Forbid them on read-only connections.

Fixes: CVE-2019-10168
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoapi: disallow virConnectGetDomainCapabilities on read-only connections
Ján Tomko [Fri, 14 Jun 2019 07:16:14 +0000 (09:16 +0200)]
api: disallow virConnectGetDomainCapabilities on read-only connections

This API can be used to execute arbitrary emulators.
Forbid it on read-only connections.

Fixes: CVE-2019-10167
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoapi: disallow virDomainManagedSaveDefineXML on read-only connections
Ján Tomko [Fri, 14 Jun 2019 07:14:53 +0000 (09:14 +0200)]
api: disallow virDomainManagedSaveDefineXML on read-only connections

The virDomainManagedSaveDefineXML can be used to alter the domain's
config used for managedsave or even execute arbitrary emulator binaries.
Forbid it on read-only connections.

Fixes: CVE-2019-10166
Reported-by: Matthias Gerstner <mgerstner@suse.de>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoapi: disallow virDomainSaveImageGetXMLDesc on read-only connections
Ján Tomko [Fri, 14 Jun 2019 06:47:42 +0000 (08:47 +0200)]
api: disallow virDomainSaveImageGetXMLDesc on read-only connections

The virDomainSaveImageGetXMLDesc API is taking a path parameter,
which can point to any path on the system. This file will then be
read and parsed by libvirtd running with root privileges.

Forbid it on read-only connections.

Fixes: CVE-2019-10161
Reported-by: Matthias Gerstner <mgerstner@suse.de>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: monitor: s/ret/rc/ in UpdateVideoSize functions
Ján Tomko [Fri, 14 Jun 2019 19:40:19 +0000 (21:40 +0200)]
qemu: monitor: s/ret/rc/ in UpdateVideoSize functions

Use 'rc' to temporarily store the subfunction return values,
instead of ret.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: monitor: use VIR_AUTOFREE in qemuMonitor*VideoSize
Ján Tomko [Fri, 14 Jun 2019 19:38:40 +0000 (21:38 +0200)]
qemu: monitor: use VIR_AUTOFREE in qemuMonitor*VideoSize

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: monitor: remove the json field
Ján Tomko [Fri, 14 Jun 2019 18:05:26 +0000 (20:05 +0200)]
qemu: monitor: remove the json field

Now that it is no longer used, remove it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: monitor: remove mon->json checks
Ján Tomko [Fri, 14 Jun 2019 18:06:48 +0000 (20:06 +0200)]
qemu: monitor: remove mon->json checks

Remove all the mon->json checks in qemuMonitor functions.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: monitor: assume JSON in QEMU_CHECK_MONITOR macro
Ján Tomko [Fri, 14 Jun 2019 18:05:44 +0000 (20:05 +0200)]
qemu: monitor: assume JSON in QEMU_CHECK_MONITOR macro

In preparation to removing the json field from qemuMonitor,
stop checking for it in QEMU_CHECK_MONITOR.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: remove json argument from qemuMonitorOpen
Ján Tomko [Fri, 14 Jun 2019 18:08:00 +0000 (20:08 +0200)]
qemu: remove json argument from qemuMonitorOpen

Always assume JSON monitor was requested, since all the callers
pass true anyway.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: domain: remove monJSON field
Ján Tomko [Fri, 14 Jun 2019 19:14:42 +0000 (21:14 +0200)]
qemu: domain: remove monJSON field

If we have a monitor, it is a JSON monitor.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: assume monJSON is always true
Ján Tomko [Fri, 14 Jun 2019 19:13:58 +0000 (21:13 +0200)]
qemu: assume monJSON is always true

Now that we no longer support the HMP monitor, remove some dead code.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agonews: Document removal of qemu commandline parsing
Peter Krempa [Mon, 17 Jun 2019 12:12:46 +0000 (14:12 +0200)]
news: Document removal of qemu commandline parsing

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agodocs: Update documentation for spapr-vio addresses
Andrea Bolognani [Fri, 14 Jun 2019 11:19:49 +0000 (13:19 +0200)]
docs: Update documentation for spapr-vio addresses

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: Format spapr-vio addresses as 32-bit
Andrea Bolognani [Fri, 14 Jun 2019 10:46:15 +0000 (12:46 +0200)]
qemu: Format spapr-vio addresses as 32-bit

No reason not to be consistent with the user-visible value.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoconf: Format spapr-vio addresses as 32-bit
Andrea Bolognani [Fri, 14 Jun 2019 10:46:05 +0000 (12:46 +0200)]
conf: Format spapr-vio addresses as 32-bit

Using 8 hex digits all the time, regardless of whether the
actual value can fit in fewer, makes it more obvious to the
user what the limits are.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotests: Add pseries-spaprvio-invalid
Andrea Bolognani [Fri, 14 Jun 2019 10:50:43 +0000 (12:50 +0200)]
tests: Add pseries-spaprvio-invalid

This test case shows that we now reject invalid spapr-vio
addresses.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: Validate spapr-vio addresses
Andrea Bolognani [Fri, 14 Jun 2019 10:50:22 +0000 (12:50 +0200)]
qemu: Validate spapr-vio addresses

According to sPAPR, addresses are 32-bit rather than 64-bit.
Update qemuDomainDeviceDefValidateAddress() accordingly.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: Rework qemuDomainDeviceDefValidateAddress()
Andrea Bolognani [Wed, 12 Jun 2019 11:05:24 +0000 (13:05 +0200)]
qemu: Rework qemuDomainDeviceDefValidateAddress()

Introduce a switch() statement and prepare for validating
more address types than just PCI.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: Fix validation of spapr-vio addresses
Andrea Bolognani [Fri, 14 Jun 2019 10:50:32 +0000 (12:50 +0200)]
docs: Fix validation of spapr-vio addresses

According to sPAPR, addresses are 32-bit (8 hex digits) rather
than 64-bit (16 hex digits). Update the schema accordingly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: also delete qemuProcessAttach
Ján Tomko [Fri, 14 Jun 2019 18:59:32 +0000 (20:59 +0200)]
qemu: also delete qemuProcessAttach

Now that the virDomainQemuAttach API returns an error, we can remove the
unused qemuProcessAttach function as well, deleting the only user
that possibly could have requested to open a non-JSON monitor.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agodocs: drvqemu: Drop old example for domxml-to-native
Peter Krempa [Tue, 18 Jun 2019 11:33:52 +0000 (13:33 +0200)]
docs: drvqemu: Drop old example for domxml-to-native

The example is very outdated and we dropped the support for it anyways.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodocs: drvqemu: Add note about deprecation of domxml-from-native
Peter Krempa [Tue, 18 Jun 2019 11:32:57 +0000 (13:32 +0200)]
docs: drvqemu: Add note about deprecation of domxml-from-native

Add a warning that the operation will no longer work.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodocs: css: Add style for <span class='deprecated'> ...
Peter Krempa [Tue, 18 Jun 2019 11:32:04 +0000 (13:32 +0200)]
docs: css: Add style for <span class='deprecated'> ...

Allow marking of the deprecation of features similarly how we mark
introduction of features.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodocs: drvqemu: Remove outdated example of virsh domxml-from-native
Peter Krempa [Tue, 18 Jun 2019 11:26:54 +0000 (13:26 +0200)]
docs: drvqemu: Remove outdated example of virsh domxml-from-native

The current version will definitely not provide such a neat commandline.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodocs: drvqemu: Clarify caveats of domxml-to-native
Peter Krempa [Tue, 18 Jun 2019 11:25:20 +0000 (13:25 +0200)]
docs: drvqemu: Clarify caveats of domxml-to-native

Explicitly state that the conversion nowadays produces results which
aren't really usable manually as it requires all the stuff which is
usually prepared by libvirtd.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Move qemuParseKeywords(Free) to the monitor code
Peter Krempa [Mon, 17 Jun 2019 12:18:51 +0000 (14:18 +0200)]
qemu: Move qemuParseKeywords(Free) to the monitor code

The only user is now in qemu_monitor_json.c to re-parse the command line
format into keyvalue pairs for use in QMP command construction.

Move and rename the functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemu: Move QEMU_QXL_VGAMEM_DEFAULT macro
Peter Krempa [Mon, 17 Jun 2019 07:50:08 +0000 (09:50 +0200)]
qemu: Move QEMU_QXL_VGAMEM_DEFAULT macro

qemu_domain.c is now the only place that uses it, so we can move it from
qemu_parse_command.h

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemu: parse: Drop unused qemu command line parsing infrastructure
Peter Krempa [Fri, 14 Jun 2019 13:17:26 +0000 (15:17 +0200)]
qemu: parse: Drop unused qemu command line parsing infrastructure

It's now unused and utterly obsolete.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agotests: Drop qemuargv2xmltest
Peter Krempa [Fri, 14 Jun 2019 13:03:04 +0000 (15:03 +0200)]
tests: Drop qemuargv2xmltest

Now that we no longer use that functionality we can also drop the tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agonews: Document removal of qemu commandline parsing
Peter Krempa [Mon, 17 Jun 2019 12:12:46 +0000 (14:12 +0200)]
news: Document removal of qemu commandline parsing

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemu: driver: Remove support for native->XML conversion
Peter Krempa [Fri, 14 Jun 2019 12:56:35 +0000 (14:56 +0200)]
qemu: driver: Remove support for native->XML conversion

This code is really neglected and does not at all work reliably. It
can't even be used for converting our own commandline back.

Since this was mostly useful for aiding migration from manually run qemu
to libvirt and will not work for this puspose in many cases it's not
worth having.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemu: parse: Drop qemuParseCommandLinePid and friends
Peter Krempa [Fri, 14 Jun 2019 12:43:14 +0000 (14:43 +0200)]
qemu: parse: Drop qemuParseCommandLinePid and friends

Now that we no longer support attaching to a live QEMU process not
managed by libvirt we can drop the backend functions as well.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemu: driver: Drop support for qemu-attach
Peter Krempa [Fri, 14 Jun 2019 12:33:52 +0000 (14:33 +0200)]
qemu: driver: Drop support for qemu-attach

Attaching to modern qemu will not work with all this code and attempting
to ressurect it would be mostly pointless.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: hvsupport: Add support for deprecating hypervisor implementations
Peter Krempa [Mon, 17 Jun 2019 11:59:31 +0000 (13:59 +0200)]
docs: hvsupport: Add support for deprecating hypervisor implementations

Allow expressing that a hypervisor implementation was deleted by adding
a end-version when the implementation was removed to our hypervisor
support matrix.

This patch hacks the perl script that generates the support matrix to
support comments like:

.domainQemuAttach = qemuDomainQemuAttach, /* 0.8.3 (deprecated: 5.5.0) */

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agotests: qemuMonitorTest: drop the JSON field
Ján Tomko [Wed, 19 Jun 2019 20:41:55 +0000 (22:41 +0200)]
tests: qemuMonitorTest: drop the JSON field

Now that we no longer support testing HMP monitor,
the json field is pointless.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agotests: qemuMonitorTestProcessCommandDefaultValidate: simplify condition
Ján Tomko [Sat, 15 Jun 2019 09:47:34 +0000 (11:47 +0200)]
tests: qemuMonitorTestProcessCommandDefaultValidate: simplify condition

We return success when running this function for either non-JSON monitor
testing or guest agent testing.

However we no longer test HMP monitor and we do not try to validate
the guest agent interaction.

Drop the test->json check and report a proper error if someone tries
to run this function for the guest agent without properly wiring it up.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agotests: assume JSON in qemuMonitorTestIO
Ján Tomko [Fri, 14 Jun 2019 18:39:24 +0000 (20:39 +0200)]
tests: assume JSON in qemuMonitorTestIO

The QMP monitor only uses a newline to separate lines,
while HMP and the guest agent also use a carriage return.

In preparation to dropping support for testing HMP interaction,
only skip the carriage return if we're dealing with the guest agent,
removing the need to check the 'json' field.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agovirhostdev: Use VIR_AUTOPTR more
Michal Privoznik [Sat, 15 Jun 2019 07:56:59 +0000 (09:56 +0200)]
virhostdev: Use VIR_AUTOPTR more

There are couple of functions which get shorter after the
treatment.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovirHostdevPrepareSCSIVHostDevices: Simplify logic
Michal Privoznik [Sat, 15 Jun 2019 07:37:18 +0000 (09:37 +0200)]
virHostdevPrepareSCSIVHostDevices: Simplify logic

Couple of things happening in this patch:

1) We can mark the device we're adding onto active list as used
   way before - when adding it onto temporary list.

2) When actually moving device from a temporary helper list onto
   the list of active devices we check if the device isn't
   already there. The same check is performed by
   virSCSIVHostDeviceListAdd() later. Drop this duplicity.

3) The 'error' label is renamed to 'rollback' to reflect what it
   is actually doing. While in the rest of the code we don't
   allow random label names, this source file is different.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovirHostdevFindUSBDevice: Simplify flow a bit
Michal Privoznik [Sat, 15 Jun 2019 07:22:12 +0000 (09:22 +0200)]
virHostdevFindUSBDevice: Simplify flow a bit

When looking up a USB device by vendor the
virUSBDeviceFindByVendor() is used. The function returns number
of items found. But the logic in caller to process it is
needlessly complicated.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovirhostdev: Use VIR_AUTOUNREF more
Michal Privoznik [Sat, 15 Jun 2019 07:03:47 +0000 (09:03 +0200)]
virhostdev: Use VIR_AUTOUNREF more

There are couple of functions which get shorter after the
treatment.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovirHostdevReAttachPCIDevices: Construct pcidevs list earlier
Michal Privoznik [Mon, 10 Jun 2019 15:19:01 +0000 (17:19 +0200)]
virHostdevReAttachPCIDevices: Construct pcidevs list earlier

There's no need to translate virDomainHostdevDef-s into
virPCIDevice-s with locked list of PCI devices.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovirHostdevPreparePCIDevices: Construct pcidevs list earlier
Michal Privoznik [Fri, 7 Jun 2019 11:56:46 +0000 (13:56 +0200)]
virHostdevPreparePCIDevices: Construct pcidevs list earlier

There's no need to translate virDomainHostdevDef-s into
virPCIDevice-s with locked list of PCI devices.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovirHostdevGetPCIHostDeviceList: Use VIR_AUTOPTR for virPCIDevice
Michal Privoznik [Sat, 15 Jun 2019 06:28:05 +0000 (08:28 +0200)]
virHostdevGetPCIHostDeviceList: Use VIR_AUTOPTR for virPCIDevice

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovirHostdevGetPCIHostDeviceList: Add @pci a bit later
Michal Privoznik [Sat, 15 Jun 2019 06:25:33 +0000 (08:25 +0200)]
virHostdevGetPCIHostDeviceList: Add @pci a bit later

This function is a good candidate for VIR_AUTOPTR() conversion.
But this conversion will be easier if we only add @pci device
onto @pcidevs list after it was all set up.

This is no functional change.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuProcessLaunch: Return earlier if spawning qemu failed
Michal Privoznik [Thu, 23 May 2019 09:00:27 +0000 (11:00 +0200)]
qemuProcessLaunch: Return earlier if spawning qemu failed

If spawning qemu fails then we report an error and proceed to
writing status XML onto the disk. This is unnecessary as we are
sure that the domain is not running.

At the same time, if virPidFileReadPath() fails it returns
-errno. Use it in the error message. It may explain what went
wrong.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodocs: Advertise pcie-to-pci-bridge for use on q35
Andrea Bolognani [Fri, 7 Jun 2019 08:27:43 +0000 (10:27 +0200)]
docs: Advertise pcie-to-pci-bridge for use on q35

We support pcie-to-pci-bridge, and prefer it to
dmi-to-pci-bridge, since libvirt 4.3.0, but we didn't
update all the documentation accordingly at the time.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: qapi: Implement support for 'features'
Peter Krempa [Wed, 10 Apr 2019 12:52:48 +0000 (14:52 +0200)]
qemu: qapi: Implement support for 'features'

Starting from version 4.1 qemu allows reporting 'features' for a given
QAPI type object. This allows reporting support of fixes and additions
which are otherwise invisible in the QAPI schema.

Implement a possibility to query 'features' in the QAPI query strings.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agotests: qemucaps: Update 4.1.0 capabilities to a more recent version
Peter Krempa [Thu, 20 Jun 2019 05:47:43 +0000 (07:47 +0200)]
tests: qemucaps: Update 4.1.0 capabilities to a more recent version

Update the capabilities from a non-upstream version (9c70209b63 is not
in qemu.git) to qemu upstream commit 33d6099906 (2019/06/18) so that we
get the QMP schema 'features' field support and are able to detect that
the 'file' block backend supports dynamic auto-read-only.

Note that I've rebuilt this on a machine with a more modern kernel and
microcode which exposes e.g. the recent CPU bug mitigations, thus I
opted to keep the CPU changes rather than trying to do a franken-caps
by updating only the output of query-qmp-schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agosyntax check: update header guard check
Jonathon Jongsma [Wed, 19 Jun 2019 19:48:36 +0000 (14:48 -0500)]
syntax check: update header guard check

Internal headers should use #pragma once instead of the standard #ifndef
guard. Public headers still require the existing header guard.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu_process: Prefer generic qemuMonitorGetGuestCPU
Jiri Denemark [Mon, 17 Jun 2019 21:38:46 +0000 (23:38 +0200)]
qemu_process: Prefer generic qemuMonitorGetGuestCPU

When updating guest CPU definition according to the vCPU actually
created by QEMU, we want to use the generic qemuMonitorGetGuestCPU to
get both CPUID and MSR features.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Introduce generic qemuMonitorGetGuestCPU
Jiri Denemark [Mon, 17 Jun 2019 21:36:53 +0000 (23:36 +0200)]
qemu: Introduce generic qemuMonitorGetGuestCPU

Unlike the old version (which is now called qemuMonitorGetGuestCPUx86),
this monitor API checks for individual features by their names rather
than processing CPUID bits. Thus we can get the list of enabled and
disabled features for both CPUID and MSR features.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Add type filter to qemuMonitorJSONParsePropsList
Jiri Denemark [Mon, 17 Jun 2019 19:51:20 +0000 (21:51 +0200)]
qemu: Add type filter to qemuMonitorJSONParsePropsList

The function converts a list of QOM properties into a NULL-terminated
array of property names. The new type parameter may be used to limit the
result to properties of a specific type.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu: Introduce virCPUDataAddFeature
Jiri Denemark [Tue, 18 Jun 2019 08:09:31 +0000 (10:09 +0200)]
cpu: Introduce virCPUDataAddFeature

This is a generic replacement for the former virCPUx86DataAddFeature,
which worked on the generic virCPUDataPtr anyway.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Make qemuMonitorGetGuestCPU usable on x86 only
Jiri Denemark [Mon, 17 Jun 2019 14:56:32 +0000 (16:56 +0200)]
qemu: Make qemuMonitorGetGuestCPU usable on x86 only

It was never implemented or used for anything else anyway. Mainly
because it uses CPUID features bits. The function is renamed as
qemuMonitorGetGuestCPUx86 to make this explicit.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Don't use full CPU model expansion
Jiri Denemark [Wed, 12 Jun 2019 11:54:27 +0000 (13:54 +0200)]
qemu: Don't use full CPU model expansion

We used type=full expansion on the result of previous type=static
expansion to get all possible spellings of CPU features. Since we can
now translate the QEMU's canonical names to our names, we can drop this
magic and do only type=static CPU model expansion.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Translate feature names from query-cpu-model-expansion
Jiri Denemark [Mon, 17 Jun 2019 11:54:53 +0000 (13:54 +0200)]
qemu: Translate feature names from query-cpu-model-expansion

By default query-cpu-model-expansion only reports canonical names of all
CPU features. We do some magic and call the command twice to get all
possible spellings of the features, but being able to consume canonical
names will allow us to drop this magic.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu_command: Use canonical names of CPU features
Jiri Denemark [Fri, 7 Jun 2019 13:00:28 +0000 (15:00 +0200)]
qemu_command: Use canonical names of CPU features

When building QEMU command line, we should use the preferred spelling of
each CPU feature without relying on compatibility aliases (which may be
removed at some point).

The "unavailable-features" CPU property is used as a witness for the
correct names of the features in our translation table.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Probe host CPU after capabilities
Jiri Denemark [Mon, 17 Jun 2019 11:16:51 +0000 (13:16 +0200)]
qemu: Probe host CPU after capabilities

The way we call query-cpu-model-expansion will rely on some capabilities
bits. Let's make sure all capabilities are set before probing host CPU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Probe for "unavailable-features" CPU property
Jiri Denemark [Mon, 10 Jun 2019 14:49:22 +0000 (16:49 +0200)]
qemu: Probe for "unavailable-features" CPU property

It is similar to "filtered-features" property, which reports CPUID bits
corresponding to disabled features, but more general. The
"unavailable-features" property supports both CPUID and MSR features by
listing their names.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Probe for max-x86_64-cpu type
Jiri Denemark [Mon, 10 Jun 2019 14:46:10 +0000 (16:46 +0200)]
qemu: Probe for max-x86_64-cpu type

We will use it to check whether QEMU supports a specific CPU property.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Add APIs for translating CPU features
Jiri Denemark [Thu, 6 Jun 2019 07:27:18 +0000 (09:27 +0200)]
qemu: Add APIs for translating CPU features

So far we always used libvirt's name of each CPU feature relying on
backward compatible aliases in QEMU. The new translation table can be
used whenever QEMU mandates or prefers canonical feature names.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuxml2argvtest: Add test for CPU features translation
Jiri Denemark [Tue, 11 Jun 2019 15:14:27 +0000 (17:14 +0200)]
qemuxml2argvtest: Add test for CPU features translation

This should cover all CPU features for which QEMU prefers spelling that
differs from the one used by libvirt.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuxml2argvtest: Add 4.0.0 cases for kvm features tests
Jiri Denemark [Tue, 11 Jun 2019 14:44:36 +0000 (16:44 +0200)]
qemuxml2argvtest: Add 4.0.0 cases for kvm features tests

Newer QEMU will translate the feature names to their canonical names so
4.0.0 is the last one which produces the results we currently have in
*-latest.args.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotests: Add domain capabilities case for QEMU 4.1.0
Jiri Denemark [Mon, 17 Jun 2019 11:39:41 +0000 (13:39 +0200)]
tests: Add domain capabilities case for QEMU 4.1.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotests: Add QEMU caps data for future 4.1.0
Jiri Denemark [Tue, 11 Jun 2019 10:52:01 +0000 (12:52 +0200)]
tests: Add QEMU caps data for future 4.1.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu_command: Use consistent syntax for CPU features
Jiri Denemark [Tue, 11 Jun 2019 12:47:46 +0000 (14:47 +0200)]
qemu_command: Use consistent syntax for CPU features

Normal CPU features use modern -cpu ...,feature=on|off syntax when
available, but kvm features kept using the old +feature or -feature.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuxml2argvtest: Switch some tests to DO_TEST_CAPS_*
Jiri Denemark [Wed, 12 Jun 2019 10:08:06 +0000 (12:08 +0200)]
qemuxml2argvtest: Switch some tests to DO_TEST_CAPS_*

These test check all kvm CPU features that could be passed to the -cpu
option by libvirt.

The 2.7.0 version is the last one for which we use +|-feature syntax for
CPU features, while feature=on|off is used with newer versions. This
is visible in the following patch which changes only the *-latest.args
files.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Filter CPU features in active XML
Jiri Denemark [Thu, 6 Jun 2019 12:51:14 +0000 (14:51 +0200)]
qemu: Filter CPU features in active XML

Properly filter features which should not be passed to QEMU because they
were never supported by QEMU or they did nothing and QEMU dropped them.

Currently they are just silently ignored by the command line generator.
Let's make this process more visible and clean by dropping the features
from the domain's active definition in qemuProcessUpdateGuestCPU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_conf: Introduce virCPUDefFilterFeatures
Jiri Denemark [Fri, 7 Jun 2019 12:07:10 +0000 (14:07 +0200)]
cpu_conf: Introduce virCPUDefFilterFeatures

This new internal API can be used for in place filtering of CPU features
in virCPUDef.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu_process: Drop cleanup label from qemuProcessUpdateGuestCPU
Jiri Denemark [Thu, 6 Jun 2019 10:33:43 +0000 (12:33 +0200)]
qemu_process: Drop cleanup label from qemuProcessUpdateGuestCPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Drop qemuFeatureNoEffect
Jiri Denemark [Thu, 6 Jun 2019 12:39:52 +0000 (14:39 +0200)]
qemu: Drop qemuFeatureNoEffect

We already have virQEMUCapsCPUFilterFeatures for filtering features
which QEMU does not know about. Let's move osxsave and ospke from
qemuFeatureNoEffect there.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodocs: use case sensitive javascript
Martin Kletzander [Wed, 19 Jun 2019 14:48:21 +0000 (16:48 +0200)]
docs: use case sensitive javascript

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
5 years agotools: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:13:15 +0000 (11:13 -0500)]
tools: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agotests: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:13:14 +0000 (11:13 -0500)]
tests: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoxen: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:13:13 +0000 (11:13 -0500)]
xen: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agosrc/vz: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:13:12 +0000 (11:13 -0500)]
src/vz: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agosrc/vmx: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:13:11 +0000 (11:13 -0500)]
src/vmx: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agosrc/vmware: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:13:10 +0000 (11:13 -0500)]
src/vmware: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agosrc/vbox: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:13:09 +0000 (11:13 -0500)]
src/vbox: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: misc: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:13:08 +0000 (11:13 -0500)]
util: misc: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: scsi: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:13:07 +0000 (11:13 -0500)]
util: scsi: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: xml: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:13:06 +0000 (11:13 -0500)]
util: xml: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: netlink: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:13:05 +0000 (11:13 -0500)]
util: netlink: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: sysinfo: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:13:04 +0000 (11:13 -0500)]
util: sysinfo: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: socketaddr: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:13:03 +0000 (11:13 -0500)]
util: socketaddr: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: string: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:13:02 +0000 (11:13 -0500)]
util: string: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: object: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:13:01 +0000 (11:13 -0500)]
util: object: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: mac: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:13:00 +0000 (11:13 -0500)]
util: mac: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: hash: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:12:59 +0000 (11:12 -0500)]
util: hash: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: command: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:12:58 +0000 (11:12 -0500)]
util: command: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: dbus: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:12:57 +0000 (11:12 -0500)]
util: dbus: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: virprobe.h: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:12:56 +0000 (11:12 -0500)]
util: virprobe.h: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: error: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:12:55 +0000 (11:12 -0500)]
util: error: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: cgroup: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:12:54 +0000 (11:12 -0500)]
util: cgroup: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: log: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:12:53 +0000 (11:12 -0500)]
util: log: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: host: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:12:52 +0000 (11:12 -0500)]
util: host: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: firewall: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:12:51 +0000 (11:12 -0500)]
util: firewall: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: file: use #pragma once in headers
Jonathon Jongsma [Tue, 18 Jun 2019 16:12:50 +0000 (11:12 -0500)]
util: file: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>