Commit Graph

31933 Commits

Author SHA1 Message Date
Peter Krempa
eaaecd9f55 tests: qemuhotplug: Use DEVICE_DELETED event in all hotunplug tests
Currently all supported qemu versions now have support for the
DEVICE_DELETED event. This means that testing the old approach is a
waste of time.

Always add the QEMU_CAPS_DEVICE_DEL_EVENT capability in the hotplug test
and fix existing test cases.

The 'disk-virtio', 'disk-usb', 'disk-scsi', and 'disk-scsi-2' already
had variants that used the event, so the non-event variants will be
removed.

For all other cases the QMP_DEVICE_DELETED macro is used to add the
correct reply.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 10:11:20 +01:00
Peter Krempa
e29ae70ba7 tests: qemuhotplug: Remove unused test macro DO_TEST_DETACH_EVENT
This variant is unused as we create the object including capabilities
with DO_TEST_ATTACH_EVENT, which is then reused.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 10:11:20 +01:00
Peter Krempa
ea34af1f35 qemu: caps: Always assume QEMU_CAPS_SEAMLESS_MIGRATION
The event was added by qemu commit 2fdd16e239c2a2 released in v1.3.0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 10:11:20 +01:00
Peter Krempa
3b0856c4ba qemu: Clean up usage of qemuDomainUpdateCurrentMemorySize
Remove the uneeded attribute and return value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 10:11:20 +01:00
Peter Krempa
3f2fa8f303 qemu: caps: Always assume QEMU_CAPS_BALLOON_EVENT
The event was added to qemu by commit 973603a813c5d60 which is contained
in the 1.2.0 release.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 10:11:19 +01:00
Peter Krempa
6d3c96f0d9 qemu: caps: Add lockout for -blockdev if QEMU_CAPS_SCSI_DISK_DEVICE_ID is not present
Avoid regressions by disallowing the BLOCKDEV capability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 10:11:19 +01:00
Peter Krempa
a1dce96236 qemu: Use the 'device_id' property of SCSI disks to avoid regressing
QEMU accidentally exposed the id of -drive (or same value as disk
serial, if provided) in one of the identifiers visible from the guest.

To avoid regression in case when -blockdev will be used we need to
always specify it ourselves.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 10:11:12 +01:00
Peter Krempa
85a8e364f3 qemu: caps: Introduce capability for 'device_id' property of 'scsi-disk'
The property allows to control the guest-visible content of the vendor
specific designator of the 'Device Identification' page of a SCSI
device's VPD (vital product data).

QEMU was leaking the id string of -drive as the value if the 'serial' of
the disk was not specified. Switching to -blockdev would impose an ABI
change.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:48:33 +01:00
Peter Krempa
8440f83529 test: qemucaps: Update caps with scsi 'device_id' property
Based on qemu commit 'v3.1.0-1445-ga61faa3d02'. Will allow checking
for the scsi 'device_id' property.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:48:33 +01:00
Peter Krempa
9222b402e5 tests: qemuxml2argv: Add a 'serial' value for a SCSI disk
Upcoming addition of a new field will need to make sure that SCSI disk
serial is tested as well. Add a case to one of the existing tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:48:33 +01:00
Peter Krempa
1328a830ce qemu: command: Drop formatting of 'media=cdrom' from -drive
For SCSI, IDE, and AHCI cdroms the appropriate device types which select
the correct media are used. In qemu there's one other code path that
looks at -drive media=cdrom in the XEN pv code. Thankfully we don't
support it with qemu (see qemuBuildDiskDeviceStr). All other devices
ignore it as the comment states, thus we can drop that code.

The test fallout is expectedly only in the test added for uncommon cdrom
types.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:48:33 +01:00
Peter Krempa
ea13c12940 tests: qemuxml2argv: Add CDROM disks for all untested buses
Add full and empty cdroms on 'usb' and 'sd' bus to have test
coverage. Note that this does not guarantee that qemu will accept them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:48:11 +01:00
Peter Krempa
5d884f3d3c qemu: Forbid cdroms on virtio bus
Attempting to create an empty virtio-blk drive results into:
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0xc,drive=drive-virtio-disk1,id=virtio-disk1: Device needs media, but drive is empty

Attempting to eject media from virtio-blk based drive results into:
error: internal error: unable to execute QEMU command 'eject': Device 'drive-virtio-disk0' is not removable

Forbid configurations where users would attempt to use cdroms in virtio
bus.

Fix few wrong examples which are not really relevant to the tested code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:41:40 +01:00
Peter Krempa
6b67eeef8c qemu: command: Use correct type for switch in qemuBuildDiskDeviceStr
Cast disk->bus to proper type and add missing values to the enum so it's
more obvious what types are supported.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:34:26 +01:00
Peter Krempa
1dcba456fa qemu: caps: Always assume presence of 'ide-hd' and 'ide-cd' devices
The split of ide-disk into the two separate devices was introduced by
qemu commit 1f56e32a7f4b3 released in qemu v0.15.

Note that when compared to the previous commit which made sure that no
disk related tests were touched, in this case it's not as careful.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:34:17 +01:00
Peter Krempa
4bf49bc566 qemu: caps: Always assume presence of 'scsi-hd' and 'scsi-cd' device
The split of scsi-disk into the two separate devices was introduced by
qemu commit b443ae67 released in qemu v0.15.

All changes to test files are not really related to disk testing thanks
to previous refactors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:34:17 +01:00
Peter Krempa
12116c018d tests: qemuxml2argv: Remove 'disk-virtio-scsi-ccw' test
It's a subset of 'iothreads-virtio-scsi-ccw'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:34:17 +01:00
Peter Krempa
76709a76ba tests: qemuxml2argv: Modernize virtio-scsi iothread tests
Use DO_TEST_CAPS_LATEST to obtain modern results.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:34:04 +01:00
Peter Krempa
253ddf5a75 tests: qemuxml2argv: Use 1.5.3 version for the oldest case of 'disk-cache'
Rather than testing random set of flags add a case also for the oldest
supported qemu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:33:10 +01:00
Peter Krempa
61900c4cda tests: qemu: Merge 'disk-scsi-vscsi' test into 'disk-scsi'
As we support multiple scsi controllers there's no need to have a
special test for this controller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:32:40 +01:00
Peter Krempa
ee39011a09 tests: qemu: Merge 'disk-scsi-mptsas1068' test into 'disk-scsi'
As we support multiple scsi controllers there's no need to have a
special test for this controller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:32:40 +01:00
Peter Krempa
a11e333779 tests: qemu: Merge 'disk-scsi-megasas' test into 'disk-scsi'
As we support multiple scsi controllers there's no need to have a
special test for this controller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:32:40 +01:00
Peter Krempa
7523e60a94 tests: qemuxml2argv: Modernize 'disk-scsi' test
Use DO_TEST_CAPS_LATEST rather than a predetermined set of caps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:32:40 +01:00
Peter Krempa
566ada91d5 tests: qemu: Rename 'disk-scsi-device' to 'disk-scsi'
Drop the 'device' suffix which is quite pointless.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:32:40 +01:00
Peter Krempa
43620843fc tests: qemuxml2argv: Move cases from 'disk-shared-locking' into 'disk-shared'
The tests are for the same feature. Move all the cases to 'disk-shared'
case as it's already using DO_TEST_CAPS_LATEST

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:32:40 +01:00
Peter Krempa
fea4cdd2d2 tests: qemuxml2argv: Remove the 'after startup XML' testing machinery
A lot of code with no real impact and popularity. Remove all the helpers
now that the only test case is gone.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:32:40 +01:00
Peter Krempa
ee498250e7 tests: qemuxml2argv: Remove testing of post startup change to 'cachemode' for shared disks
Testing that the cachemode is properly recorded to the configuration
after startup does not add much value and overcomplicates the xml2argv
test.

Remove the 'disk-shared' test with old capabilities as the test with
real capabilities covers the code sufficiently.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:31:34 +01:00
Peter Krempa
98c128fd99 tests: qemuxml2argv: Use real caps when auto-generating SCSI controller type
Using an old strict set of capabilities is not of much use if a code
path would select a more modern controller by accident.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:31:15 +01:00
Peter Krempa
3eff4bc2c5 tests: qemuxml: Merge 'ioeventfd' variant of 'virtio-scsi' test into the common file
We don't need separate files for this test. Also modernize it in the
process.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:31:15 +01:00
Peter Krempa
7d1fc9f8d6 tests: qemuxml: Merge 'max_sectors' variant of 'virtio-scsi' test into the common file
We don't need separate files for this test. Also modernize it in the
process.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:31:15 +01:00
Peter Krempa
74a7d6fb2b tests: qemuxml: Merge 'cmd_per_lun' variant of 'virtio-scsi' test into the common file
We don't need separate files for this test. Also modernize it in the
process.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:31:15 +01:00
Peter Krempa
ab5c7dbee3 tests: qemuxml: Merge 'num-queues' variant of 'virtio-scsi' test into the common file
We don't need separate files for this test. Also modernize it in the
process.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:31:15 +01:00
Peter Krempa
6d8be31f2a tests: qemu: Remove 'disk-scsi-virtio-scsi' test
Now that we have a specific test for testing the 'virtio-scsi'
controller and other tests which test a combination of scsi and non-scsi
devices this test no longer makes sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:31:15 +01:00
Peter Krempa
7a22fa7dce tests: qemuxml: Add a common test file for the 'virtio-scsi' controller
Add a file to aggregate testing for 'virtio-scsi' based on the modern
framework.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:31:02 +01:00
Peter Krempa
e67b6dcf36 qemu: capabilities: Probe caps for 'ide-hd' instead of 'ide-drive'
Since commit a4cda054e7 we are using 'ide-hd' and 'ide-cd' instead of
'ide-drive'. We also should probe capabilities for 'ide-hd' instead of
'ide-drive'. It is safe to do as 'ide-drive' is the common denominator
of both 'ide-hd' and 'ide-cd' so all the properties were common.

For now the test data are modified by just changing the appropriate type
when probing for caps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:30:38 +01:00
Peter Krempa
7d114e1b72 qemu: capabilities: Probe caps for 'scsi-hd' instead of 'scsi-disk'
Since commit 02e8d0cfdf we are using 'scsi-hd' and 'scsi-cd' instead of
'scsi-disk'. We also should probe capabilities for 'scsi-hd' instead of
'scsi-disk'. It is safe to do as 'scsi-disk' is the common denominator
of both 'scsi-hd' and 'scsi-cd' so all the properties were common.

For now the test data are modified by just changing the appropriate type
when probing for caps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:23:26 +01:00
Peter Krempa
aedd20386d tests: qemucaps: Make fake 'microcodeVersion' depend on filename instead of length
To avoid changes to the filled in microcode in case we change the caps
replies file for any reason make the number depend on the filename.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:23:26 +01:00
Jiri Denemark
f15789ecac virsh: Add support for setting post-copy migration bandwidth
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-07 16:25:59 +01:00
Jiri Denemark
12977fba8b qemu: Implement VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY flag
This flag tells virDomainMigrateSetMaxSpeed and
virDomainMigrateGetMaxSpeed APIs to work on post-copy migration
bandwidth.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-07 16:25:59 +01:00
Jiri Denemark
c830187a01 qemu: Implement VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY
This typed parameter for virDomainMigrate3 and virDomainMigrateToURI3
APIs may be used for setting maximum post-copy migration bandwidth.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-07 16:25:59 +01:00
Jiri Denemark
cdc1b1d71b Public API for post-copy migration bandwidth
This patch adds a new VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY typed
parameter for virDomainMigrate3 and virDomainMigrateToURI3 for setting
maximum post-copy migration bandwidth.

In case the initial VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY value turns out
to be suboptimal a new VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY flag for
virDomainMigrateSetMaxSpeed and virDomainMigrateGetMaxSpeed may be used
to set/get the maximum post-copy migration bandwidth while migration is
already running.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-07 16:25:59 +01:00
Jiri Denemark
08d44263c8 qemu: Make migration params usable outside migration
So far migration parameters were changed only at the beginning of
migration mostly via an automatic translation from flags and typed
parameters. We need to export a few more functions to support APIs which
may set migration parameters while migration is already running.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-07 16:25:59 +01:00
Jiri Denemark
54e969c538 qemu: Rework qemuDomainMigrateSetMaxSpeed
Let's make the code flow easier to follow and get rid of the ugly endjob
label inside if branch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-07 16:25:59 +01:00
Jiri Denemark
c160275d9c qemu: Add optional unit to qemuMigrationParamsTPMapItem
Some migration parameters supported by libvirt may use units that differ
from the units used by QEMU for the corresponding parameters. For
example, libvirt defines migration bandwidth in MiB/s while QEMU expects
B/s. Let's add a unit field to qemuMigrationParamsTPMapItem for
automatic conversion when translating between libvirt's migration typed
parameters and QEMU's migration paramteres.

This patch is a preparation for future parameters as the existing
VIR_MIGRATE_PARAM_BANDWIDTH parameter is set using "migrate_set_speed"
QMP command rather than "migrate-set-parameters" for backward
compatibility.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-07 16:25:59 +01:00
Jiri Denemark
9e7a163b13 qemu: Use C99 initializers for qemuMigrationParamsTPMap
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-07 16:25:59 +01:00
Michal Privoznik
988a0e0e38 virinitctl: Provide a stub list of init fifos for non-Linux
The virInitctlFifos list is exported, but lacks definition for
non-Linux and/or non-BSD case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2019-02-07 16:17:56 +01:00
Peter Krempa
b9e8a6f7e5 qemu: Use data in qemuBlockJobDataPtr instead of re-generating job name
qemuDomainBlockPivot and qemuDomainBlockJobAbort need the job name for
cancelling or pivoting but were generating it locally instead of
accessing the existing copy in the job data structure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-07 14:32:32 +01:00
Peter Krempa
a26cc472ff qemu: Remove unused 'cfg' qemuDomainBlockPivot
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-07 14:32:32 +01:00
Peter Krempa
023d69dfc8 qemu: Move shareable disk check for block copy
The writing to an image actually starts when the copy job is initiated,
so checking this at the time of the pivot operation is too late.

Move the check to qemuDomainBlockCopyCommon. Note that modern qemu would
have prevented two writers with qcow2 so the slim possibility of a job
started with libvirtd without this patch missing the check is not really
worth worrying about.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-07 14:32:32 +01:00
Peter Krempa
ef8a87a09d qemu: Always save status XML in qemuDomainBlockJobAbort
For copy and active commit jobs we record the state of the mirror so
that we can recover. The status XML was not saved in case of
qemuDomainBlockPivot due to an oversight.

Save the XML always when invoking qemuDomainBlockJobAbort even if
the job is not currently tracking any state. This will change later and
also this is not a particularly hot code path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-07 14:32:32 +01:00