Commit Graph

33535 Commits

Author SHA1 Message Date
Peter Krempa
215d9393bb 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>
2019-06-20 12:15:05 +02:00
Peter Krempa
fd14dfec88 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>
2019-06-20 12:15:05 +02:00
Ján Tomko
2545f61e95 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>
2019-06-20 12:12:34 +02:00
Ján Tomko
f5e275c6e2 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>
2019-06-20 12:12:34 +02:00
Ján Tomko
1c4246102a 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>
2019-06-20 12:12:34 +02:00
Michal Privoznik
27f866ba8a 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>
2019-06-20 10:29:54 +02:00
Michal Privoznik
df07ccc6e1 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>
2019-06-20 10:29:54 +02:00
Michal Privoznik
35d61939bc 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>
2019-06-20 10:29:54 +02:00
Michal Privoznik
f08e6883cb 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>
2019-06-20 10:29:54 +02:00
Michal Privoznik
b2985cfe33 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>
2019-06-20 10:29:54 +02:00
Michal Privoznik
bf450f5b3d 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>
2019-06-20 10:29:54 +02:00
Michal Privoznik
11fa712c26 virHostdevGetPCIHostDeviceList: Use VIR_AUTOPTR for virPCIDevice
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-06-20 10:29:54 +02:00
Michal Privoznik
7cf2963017 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>
2019-06-20 10:29:54 +02:00
Michal Privoznik
7979066b69 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>
2019-06-20 10:29:54 +02:00
Andrea Bolognani
73713a54a8 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>
2019-06-20 10:03:22 +02:00
Peter Krempa
7684e54ee9 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>
2019-06-20 09:20:04 +02:00
Peter Krempa
4586b11bed 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>
2019-06-20 09:13:37 +02:00
Jonathon Jongsma
34c9a5fc06 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>
2019-06-20 09:01:07 +02:00
Jiri Denemark
63acb7bfd5 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>
2019-06-20 00:22:39 +02:00
Jiri Denemark
cc6d6b3cb9 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>
2019-06-20 00:22:39 +02:00
Jiri Denemark
430023e5ee 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>
2019-06-20 00:22:39 +02:00
Jiri Denemark
df73078c61 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>
2019-06-20 00:22:39 +02:00
Jiri Denemark
055f8f6bb9 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>
2019-06-20 00:22:39 +02:00
Jiri Denemark
a3f2c802d2 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>
2019-06-20 00:22:39 +02:00
Jiri Denemark
ec232c5ddc 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>
2019-06-20 00:22:39 +02:00
Jiri Denemark
5030a7450b 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>
2019-06-20 00:22:39 +02:00
Jiri Denemark
6f6401fbae 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>
2019-06-20 00:22:38 +02:00
Jiri Denemark
0d254bce4e 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>
2019-06-20 00:22:38 +02:00
Jiri Denemark
2a4c232106 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>
2019-06-20 00:22:38 +02:00
Jiri Denemark
61ee757e20 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>
2019-06-20 00:22:38 +02:00
Jiri Denemark
24aa210d90 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>
2019-06-20 00:22:38 +02:00
Jiri Denemark
fb973cfbb4 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>
2019-06-20 00:22:38 +02:00
Jiri Denemark
9ceee2f4bb 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>
2019-06-20 00:22:38 +02:00
Jiri Denemark
fb5bde121f 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>
2019-06-20 00:22:38 +02:00
Jiri Denemark
e1ba407396 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>
2019-06-20 00:22:38 +02:00
Jiri Denemark
4c402598de 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>
2019-06-20 00:22:38 +02:00
Jiri Denemark
0b763774a5 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>
2019-06-20 00:22:37 +02:00
Jiri Denemark
c145b660b8 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>
2019-06-20 00:22:37 +02:00
Jiri Denemark
955fd6e7a2 qemu_process: Drop cleanup label from qemuProcessUpdateGuestCPU
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-06-20 00:22:37 +02:00
Jiri Denemark
b12865260a 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>
2019-06-20 00:22:37 +02:00
Martin Kletzander
2699e63fc0 docs: use case sensitive javascript
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2019-06-19 18:45:59 +02:00
Jonathon Jongsma
a325763ff1 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>
2019-06-19 17:12:34 +02:00
Jonathon Jongsma
c35d8a7d5e 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>
2019-06-19 17:12:34 +02:00
Jonathon Jongsma
78b2a03966 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>
2019-06-19 17:12:33 +02:00
Jonathon Jongsma
faceedaf71 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>
2019-06-19 17:12:33 +02:00
Jonathon Jongsma
adfe09bc05 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>
2019-06-19 17:12:33 +02:00
Jonathon Jongsma
e3331f2752 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>
2019-06-19 17:12:33 +02:00
Jonathon Jongsma
6d5e1df53f 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>
2019-06-19 17:12:33 +02:00
Jonathon Jongsma
2ad45811e2 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>
2019-06-19 17:12:33 +02:00
Jonathon Jongsma
336d682d14 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>
2019-06-19 17:12:33 +02:00