Commit Graph

4274 Commits

Author SHA1 Message Date
Jiri Denemark
03edcd0752 qemu: Move migration capabilities JSON formatting
We want to have all migration capabilities parsing and formatting at one
place, i.e., in qemu_migration_params.c. The parsing is already there in
qemuMigrationCapsCheck.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-04-17 10:46:23 +02:00
Jiri Denemark
dacf2a6bbc qemumonitorjsontest: Drop migration params test
The test is mostly useless and we want to refactor migration parameters
even further. The refactoring will allow us to introduce enhanced tests
for migration parameters.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-04-17 10:46:23 +02:00
Jiri Denemark
323567a6fa qemu: Add support for xbzrle-cache-size migration parameter
Originally QEMU provided query-migrate-cache-size and
migrate-set-cache-size QMP commands for querying/setting XBZRLE cache
size. In version 2.11 QEMU added support for XBZRLE cache size to the
general migration paramaters commands.

This patch adds support for this parameter to libvirt to make sure it is
properly restored to its original value after a failed or aborted
migration.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-04-17 10:46:23 +02:00
Jiri Denemark
1f8a1a9511 qemu: Do not use qemuMonitorSetMigrationCapability
Rework all remaining callers of qemuMonitorSetMigrationCapability to use
the new qemuMonitorSetMigrationCapabilities API.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-04-17 10:46:23 +02:00
Ján Tomko
5b2c3d404e qemu: deprecate QEMU_CAPS_DRIVE_CACHE_UNSAFE
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 20:32:26 +02:00
Ján Tomko
fe35b1ad64 qemu: deprecate QEMU_CAPS_NO_SHUTDOWN
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 20:31:42 +02:00
Ján Tomko
53f9437748 qemu: deprecate QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 17:12:06 +02:00
Ján Tomko
bdd92827d3 qemu: deprecate QEMU_CAPS_DEVICE_SPICEVMC
The (now assumed) QEMU_CAPS_CHARDEV_SPICEVMC is preferred.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 17:11:49 +02:00
Ján Tomko
c3eaccfa60 qemu: deprecate QEMU_CAPS_CHARDEV_SPICEVMC
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 17:11:26 +02:00
Ján Tomko
0bfb93fff2 qemu: deprecate QEMU_CAPS_DRIVE_AIO
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 16:35:55 +02:00
Ján Tomko
3ebce7450a qemu: deprecate QEMU_CAPS_VGA_NONE
Last use was removed by commit 0586cf98 deprecating
QEMU_CAPS_DEVICE.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 16:31:56 +02:00
Ján Tomko
e3746addde qemu: deprecate QEMU_CAPS_SMBIOS_TYPE
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 16:31:36 +02:00
Ján Tomko
3a066efe7c qemu: deprecate QEMU_CAPS_NAME_PROCESS
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 16:28:40 +02:00
Ján Tomko
e559bf3826 qemu: deprecate QEMU_CAPS_FSDEV
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 16:27:54 +02:00
Ján Tomko
8b66c1bc85 qemu: deprecate QEMU_CAPS_BOOT_MENU
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 16:26:13 +02:00
Ján Tomko
61623e42bc qemu: deprecate QEMU_CAPS_NODEFCONFIG
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixed-up-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 16:16:16 +02:00
Ján Tomko
c1f684eac1 qemu: deprecate QEMU_CAPS_VHOST_NET
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 15:00:26 +02:00
Ján Tomko
470c3827cf qemu: deprecate QEMU_CAPS_RTC
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 14:55:55 +02:00
Ján Tomko
649a9dd7a4 qemu: deprecate QEMU_CAPS_SDL
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 14:54:58 +02:00
Ján Tomko
ebc0b50e9f qemu: deprecate QEMU_CAPS_DRIVE_SERIAL
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-12 17:17:17 +02:00
Ján Tomko
cc77a2b785 qemu: deprecate QEMU_CAPS_MEM_PATH
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-12 17:17:17 +02:00
Ján Tomko
cc32731a3c qemu: deprecate QEMU_CAPS_NO_USER_CONFIG
Implied by QEMU >= 1.2.0.

Delete this one first, because QEMU_CAPS_NODEFCONFIG is only used
when QEMU_CAPS_NO_USER_CONFIG is unsupported.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-12 17:17:17 +02:00
Ján Tomko
a32539dea1 qemu: deprecate QEMU_CAPS_MONITOR_JSON
We require QEMU >= 1.5.0, assume every QEMU supports it.
Sadly that does not let us trivially drop qemuMonitor's
priv->monJSON bool, because of qemuDomainQemuAttach.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-12 17:17:17 +02:00
Ján Tomko
ad8a7c4f85 qemu: deprecate QEMU_CAPS_NETDEV
This makes qemuDomainSupportsNetdev identical to
qemuDomainSupportsNicdev and leaves some code in
qemuDomainAttachNetDevice to be cleaned up later.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-12 17:17:16 +02:00
Ján Tomko
6826c99ac1 qemu: deprecate QEMU_CAPS_PCI_MULTIFUNCTION
Supported since QEMU 0.13, but we require QEMU 1.5.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-12 17:17:16 +02:00
Ján Tomko
103fa937a1 tests: remove FLAG_JSON from xml2argvtest
Unused as of commit <1e9a083>.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-04-12 17:17:16 +02:00
Jim Fehlig
dffe584aa4 libxl: add support for memballoon device
All Xen PV and HVM with PV driver support a memory balloon device,
which cannot be disabled through the toolstack. Model the device
in the libxl driver, similar to the recently removed xend-based
driver.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-11 11:47:33 -06:00
Andrea Bolognani
550950e5b3 qemu: Format gic-version=2 on the command line
Up until now we have only formatted non-default GIC versions on
the command line, in order to maintain compatibility with older
QEMU versions that didn't implement the gic-version option to
begin with; however, doing so is entirely unnecessary for newer
QEMU versions, where the option is available. Moreover, having
the GIC version formatted on the command line at all times
ensures that QEMU changing its own defaults doesn't affect the
ABI of libvirt guests.

A few test cases are removed to avoid extra churn. It doesn't
matter for coverage, as those scenarios are already covered by
other parts of the test suite.

This patch is better viewed with 'git show -w'.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-04-11 15:56:11 +02:00
Vincent Bernat
4d7384eb9d util: don't check for parallel iteration in hash-related functions
This is the responsability of the caller to apply the correct lock
before using these functions. Moreover, the use of a simple boolean
was still racy: two threads may check the boolean and "lock" it
simultaneously.

Users of functions from src/util/virhash.c have to be checked for
correctness. Lookups and iteration should hold a RO
lock. Modifications should hold a RW lock.

Most important uses seem to be covered. Callers have now a greater
responsability, notably the ability to execute some operations while
iterating were reliably forbidden before are now accepted.

Signed-off-by: Vincent Bernat <vincent@bernat.im>
2018-04-11 11:18:37 +02:00
Wim ten Have
c9ec7088c7 storage: extend preallocation flags support for qemu-img
This patch adds support to qcow2 formatted filesystem object storage by
instructing qemu-img to build them with preallocation=falloc whenever the
XML described storage <allocation> matches its <capacity>.  For all other
cases the filesystem stored objects are built with preallocation=metadata.

Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-04-11 10:15:58 +02:00
Ján Tomko
c1bc9c662b Require QEMU 1.5.0
According to the policy described on https://libvirt.org/platforms.html
the QEMU versions in the oldest relevant releses are:

  SLES 12: 2.0.0
  RHEL 7: 1.5.3
  Ubuntu 14.04: 2.0.0

Set the minimum to 1.5.0 and drop support for RHEL 6.

This will let us assume lots of capabilities.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-10 15:16:44 +02:00
Ján Tomko
a7424faff0 Force QMP capability probing
Remove the qmpOnly argument of virQEMUCapsNewForBinaryInternal
and instead always assume it's true.

This effectively sets the minimum QEMU version to 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-10 15:16:23 +02:00
Ján Tomko
ea8ff2eb64 Delete bogus cpu-host-passthrough test
We test the same XML for a type='kvm' domain twice, once with
QEMU_CAPS_KVM (expecting success), once without (expecting failure).

The failure case relies on QEMU_CAPS_MACHINE_OPT not being set,
failing in qemuBuildObsoleteAccelArg.

Checking a domain-type error message in a cpu test is strange.
Delete the negative test to allow assuming QEMU_CAPS_MACHINE_OPT by
default.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-10 12:22:53 +02:00
Ján Tomko
1ff74d67b1 qemuxml2argvtest: Fix q35-virt-manager capabilities
Use QEMU_CAPS_MACHINE_OPT and QEMU_CAPS_MACHINE_VMPORT_OPT
since it specifies <vmport state=off/>.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-10 12:22:31 +02:00
Jim Fehlig
4392d2d49b Remove xencaps tests and data files
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-09 11:37:15 -06:00
Jim Fehlig
8ee83ea875 tests: move xmconfig tests to WITH_LIBXL
In preparation of removing the legacy Xen driver, move the
xmconfig tests from WITH_XEN to WITH_LIBXL. Even though the
legacy driver will be removed, we'll want to maintain the ability
to convert xm config to XML. Requires fixing up the tests to account
for different behavior of Xen vs libxl post parse functions. For
consistency with other Xen config tests, change the <os> arch to
x86_64.

There is some test file fallout due to differences in handling of
default values between xend and libxl.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-09 11:36:17 -06:00
Jim Fehlig
212da33f81 tests: move sexpr2xml tests to WITH_LIBXL
In preparation of removing the legacy Xen driver, move the
sexpr2xml tests from WITH_XEN to WITH_LIBXL. Even though the
legacy driver will be removed, we'll want to maintain the ability
to convert sexpr to XML. Requires fixing up the tests to account
for different behavior of Xen vs libxl post parse functions.

There is some test file fallout due to differences in handling
of default values between xend and libxl.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-09 11:34:35 -06:00
Jim Fehlig
2ea9d403ff tests: move xml2sexpr tests to WITH_LIBXL
In preparation of removing the legacy Xen driver, move the
xml2sexpr tests from WITH_XEN to WITH_LIBXL. Even though the
legacy driver will be removed, we'll want to maintain the ability
to convert sexpr <-> XML.

There is some test file fallout due to differences in handling
of default values between xend and libxl.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-09 11:33:30 -06:00
John Ferlan
d4aaa1651b conf: Fix virDomainObjParseFile object handling
When virDomainObjParseFile runs, it returns a locked @obj with
one reference. Rather than just use virObjectUnref to clean that
up, use virObjectEndAPI.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-04-06 14:14:37 -04:00
Andrea Bolognani
8238b04405 tests: Use pcie-to-pci-bridge for aarch64-traditional-pci
Now that support for the pcie-to-pci-bridge controller has
been implemented, adding the QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE
capability to the existing test is enough to cause the guest
to use pcie-to-pci-bridge instead of dmi-to-pci-bridge.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-04-06 14:12:25 +02:00
Andrea Bolognani
1764a51b95 qemu: Add QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE
This capability will be set when the pcie-pci-bridge device
is available in the QEMU binary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-04-06 14:12:15 +02:00
Andrea Bolognani
d47de9e698 tests: Add aarch64-traditional-pci test
This test shows what happens when you add a traditional PCI
device such as pci-serial to a pure PCIe machine type such
as aarch64/virt.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-04-06 14:12:11 +02:00
Ján Tomko
3487973ee0 virjsontest: Use a more stable floating point number for testing
We store all JSON numbers as strings. To allow using json libraries
that store them in numeric types, use a more predictable and normalized
value.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-04-04 15:08:32 +02:00
Peter Krempa
9c75425aa2 tests: utils: Fix out-of-bounds access to memory in virTestCompareToFile
Similarly to 3506f1ecfd, the contents of 'cmpcontent' may be an empty
string so the following code would access memory out of the array.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-04-04 12:04:21 +02:00
Peter Krempa
a801f0e79b qemu: domain: Move initialization of disk cachemode for <shareable> disks
The qemu command line generator code set disk caching of shareable disks
to 'none' when formatting the command line silently. Move this code to a
common place when preparing the domain definition for startup so that it
does not have to be duplicated.

The new test case shows that the actual cache mode will now be recorded
in the live XML definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-04-03 15:48:38 +02:00
Peter Krempa
f0a528ce06 tests: qemuxml2argv: Allow testing of config processed at startup
Add a new kind of XML output test for the files in qemuxml2argvtest
where we can validate setup and defaults applied when starting up the
VM.

This is achieved by formatting of the definition processed by the
qemuxml2argvtest into a XML and it's compared against files in
qemuxml2startupxmloutdata. This test is automatically executed if the
output file is present and it's skipped otherwise.

The first example test case is created from 'disk-drive-shared' test
case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-04-03 15:48:38 +02:00
Peter Krempa
6227c8ae5d tests: qemu: Test QCOW2 + LUKS support
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-04-03 15:48:38 +02:00
Peter Krempa
b874e297b2 qemu: caps: Add capability for LUKS encrypted qcow2 image support
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-04-03 15:48:38 +02:00
Peter Krempa
2d12d9482e qemu: domain: Forbid VIR_STORAGE_FILE_ISO as a disk format
This format is used by the storage driver and other hypervisors but qemu
does not have notion of the 'iso' format and libvirt does not translate
it to anything useful, so it would not work anyways. Users should use
'raw' instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-04-03 15:48:38 +02:00
Peter Krempa
d9833497a4 qemu: domain: Forbid VIR_STORAGE_FILE_DIR as a disk format
This is a storage driver type, which is not handled in qemu driver
properly. For accessing directories, disk type 'dir' is used instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-04-03 15:48:38 +02:00