Commit Graph

527 Commits

Author SHA1 Message Date
Ján Tomko
b564113d56 tests: add parseFlags to qemuxml2argvtest 2016-02-26 09:47:46 +01:00
Paolo Bonzini
fc922eb208 qemu: add support for LSI SAS1068 (aka MPT Fusion) SCSI controller
This does nothing more than adding the new device and capability.
The device is present since QEMU 2.6.0.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-02-22 10:10:52 +00:00
Andrea Bolognani
b6c40bd5e1 test: qemuxml2argv: Drop QEMU_CAPS_DEVICE uses
Since commit 51045df01b, the QEMU_CAPS_DEVICE capability is enabled
automatically and shouldn't be passed as an argument to DO_TEST();
however, commit 998a936c4c accidentally introduced few such uses.
2016-02-19 14:10:44 +01:00
John Ferlan
de71e0e500 qemu: Move qemuAssign*Alias* API's into their own module
Create a new module qemu_alias.c to handle the qemuAssign*Alias* APIs
and the qemuDomainDeviceAliasIndex
2016-02-16 11:07:48 -05:00
Andrea Bolognani
998a936c4c tests: Add more GIC test cases
Test all kinds of scenarios, including guests asking for GIC but
failing to specify a version, guests specifying an invalid version
and guests trying to use GIC with non-virt or even non-ARM machines.
2016-02-16 15:42:20 +01:00
Andrea Bolognani
161a341850 tests: Reorganize and simplify GIC test cases
Unify the naming to prepare for new test cases that will be added
later on.

Convert a couple of output XML files for the qemuxml2xml test to
symlinks while at it, since they were identical to the corresponding
input XML files anyways.

Moreover, since we're only interested in testing GIC support here,
simplify XML files by getting rid of the unrelevant bits.
2016-02-16 15:39:57 +01:00
Cole Robinson
5a1ccaeb00 tests: qemu: More aarch64 virtio and pci tests
Clarify the point of some of the test cases by renaming them. Add more
xml2xml tests.
2016-02-09 16:09:01 -05:00
Cole Robinson
51045df01b tests: Unconditionally enable QEMU_CAPS_DEVICE
QEMU_CAPS_DEVICE is always enabled for qemu binaries we support.
Sync qemuxml2* to match, and regenerate all test output.
2016-02-09 13:42:23 -05:00
Cole Robinson
e9394d699c tests: qemuxml2argv: remove some QEMU_CAPS_DEVICE problem cases
When we unconditionally enable QEMU_CAPS_DEVICE, these tests need
some massaging, so do it ahead of time to not mix it in with the
big test refresh.

- minimal-s390 is not a real world working config, so drop it
- disk-usb was testing for an old code path that will be removed.
  instead use it to test lack of USB disk support, and rename it
  to disk-usb-nosupport. Switch xml2xml to use disk-usb-device for
  input.
- cputune-numatune was needlessly using q35, switch it to an older
  machine type
2016-02-09 13:42:23 -05:00
Peter Krempa
6d04f0592e tests: Integrate startup checks to qemuxml2argvtest
Some of the tests that are not a part of qemuBuildCommandLine were not
executed in the test suite. We can now reuse qemuProcessStartValidate to
integrate these tests.
2016-02-08 09:24:49 +01:00
Pavel Hrdina
2686e44e05 tests: add some missing tests to qemuxml2xmltest
Those tests are in qemuargv2xmltest and it makes sense to include them
also in qemuxml2xmltest and qemuxml2argvtest.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-01-26 17:53:33 +01:00
Dmitry Andreev
981c01d419 qemu: add support of optional 'autodeflate' attribute
Autodeflate can be enabled/disabled for memballon device
of model 'virtio'.

xml:
<devices>
  <memballoon model='virtio' autodeflate='on'/>
</devices>

qemu:
qemu -device virtio-balloon-pci,...,deflate-on-oom=on

Autodeflate cannot be enabled/disabled for running domain.
2016-01-12 10:48:21 -05:00
Laine Stump
bd04ad42e7 qemu: auto-add a USB2 controller set for Q35 machines
Use virDomainDefAddUSBController() to add an EHCI1+UHCI1+UHCI2+UHCI3
controller set to newly defined Q35 domains that don't have any USB
controllers defined.
2016-01-11 13:21:10 -05:00
Laine Stump
163338ec28 qemu: prefer 00:1D.x and 00:1A.x for USB2 controllers on Q35
The real Q35 machine puts the first USB controller set (EHCI+(UHCIx4))
on bus 0 slot 0x1D, and the 2nd USB controller set on bus 0 slot 0x1A,
so let's attempt to make the virtual machine match that for
controllers with auto-assigned addresses when possible.

Three test cases were added to assure that the proper addresses are
assigned - one with a single set of unaddressed USB controllers, one
with 3 (to grab both preferred slots plus one more), and one with the
order of the controller definitions reordered, to assure that the
auto-assignment isn't mixed up by order.
2016-01-11 13:04:17 -05:00
Cole Robinson
fde937bda0 qemu: command: wire up usage of q35/ich9 disable s3/s4
If the q35 specific disable s3/s4 setting isn't supported, fallback to
specifying the PIIX setting, which is the previous behavior. It doesn't
have any effect, but qemu will just warn about it rather than error:

  qemu-system-x86_64: Warning: global PIIX4_PM.disable_s3=1 not used
  qemu-system-x86_64: Warning: global PIIX4_PM.disable_s4=1 not used

Since it doesn't error, I don't think we should either, since there
may be configs in the wild that already have q35 + disable_s3/4 (via
virt-manager)
2016-01-10 15:16:38 -05:00
Cole Robinson
5900356efb qemu: caps: Rename CAPS_DISABLE_S[34] to CAPS_PIIX_DISABLE_S[34]
These settings are specific to PIIX, so clarify it
2016-01-10 14:59:53 -05:00
Martin Kletzander
8156493d8d Fix USB model defaults for ppc64
The condition was checking for UHCI (and OHCI for ppc64) availability so
that it can specify the proper device instead of legacy usb.  However,
for ppc64, we don't need to check both OHCI and UHCI, but only OHCI as
that is the legacy default.  The condition is so big that it was just a
matter of time when someone will make a mistake there, so let's use more
lines so that it is visible what the condition checks for.

This fixes usage of -device instead of -usb for ppc64 that supports
pci-usb-ohci and does not support piix3-usb-uhci.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-09 18:39:17 +01:00
Andrea Bolognani
117375ca49 tests: qemuxml2argv: Add tests for USB controller on q35 2016-01-08 19:46:43 +01:00
Dmitry Mishin
53a15aed39 qemu: Process new 'append' attribute for char dev with output to a file
By default, QEMU truncates serial file on open. Sometimes, it could be weird -
for example, when we are trying to investigate some event, which occured several
restarts ago. This patch adds an ability to preserve previous content.

Signed-off-by: Dmitry Mishin <dim@virtuozzo.com>
2015-12-24 14:50:33 +00:00
Peter Krempa
645881139b qemu: domain: Prevent overflows in memory alignment code
Since libvirt for dubious historical reasons stores memory size as
kibibytes, it's possible that the alignments done in the qemu code
overflow the the maximum representable size in bytes. The XML parser
code handles them in bytes in some stages. Prevent this by doing
overflow checks when alinging the size and add a test case.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1260576
2015-12-04 15:21:20 +01:00
Ján Tomko
971f5f229d qemu: build command line for virtio-input-host device
<input type='passthrough' bus='virtio'>
  <source evdev='/dev/input/event1234'/>
</input>

results in:

-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234

https://bugzilla.redhat.com/show_bug.cgi?id=1231114
2015-11-30 13:00:04 +01:00
Ján Tomko
7210cef452 qemu: build command line for virtio input devices
Add support for these qemu devices:
virtio-mouse-{pci,device}
virtio-keyboard-{pci,device}
virtio-tablet-{pci,device}

https://bugzilla.redhat.com/show_bug.cgi?id=1231114
2015-11-30 12:25:36 +01:00
Marc-André Lureau
06198b9c73 qemu: add virtio-gpu virgl support
Check if virtio-gpu provides virgl option, and add qemu command line
formatter.

It is enabled with the existing accel3d attribute:
<model type='virtio' heads='1'>
 <acceleration accel3d='yes'/>
</model>

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-11-27 16:48:53 +01:00
Marc-André Lureau
21373feb4e qemu: add virtio video device
qemu 2.5 provides virtio video device.  It can be used with -device
virtio-vga for primary devices, or -device virtio-gpu for non-vga
devices. However, only the primary device (VGA) is supported with this
patch.

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

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-11-27 16:48:53 +01:00
Dmitry Andreev
59fc0d0609 Allow multiple panic devices
'model' attribute was added to a panic device but only one panic
device is allowed. This patch changes panic device presence
from 'optional' to 'zeroOrMore'.
2015-11-25 14:46:21 +01:00
Dmitry Andreev
ca6ddffe2c qemu: add support for hv_crash feature as a panic device
Panic device type used depends on 'model' attribute.

If no model is specified then device type depends on hypervisor
and guest arch. 'pseries' model is used for pSeries guest and
'isa' model is used in other cases.

XML:
<devices>
  <panic model='hyperv'/>
</devices>

QEMU command line:
qemu -cpu <cpu_model>,hv_crash
2015-11-25 14:46:20 +01:00
Jiri Denemark
34b9fe6101 qemu: Move incoming URI code to qemu_migration
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-19 09:41:23 +01:00
Jiri Denemark
08600de376 qemu: Don't generate migration URI in qemuBuildCommandLine
Make callers of qemuBuildCommandLine responsible for providing the URI
which should be passed as a parameter for -incoming.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-19 09:41:23 +01:00
Peter Krempa
4ad31f8f65 qemu: ppc64: Support memory hotplug without NUMA enabled
ppc64 guests don't require adding a NUMA node for hotplug memory to
work. Lift the requirement and add test cases.
2015-11-18 10:32:18 +01:00
Jiri Denemark
3c7059528d tests: Remove qemuxmlnstest
It's just a copy&paste of qemuxml2argv test anyway. We can test most of
them (except for qemuxmlns-qemu-ns-domain.xml which fails to validate
against our schema) by qemuxml2argv test.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-11 17:02:53 +01:00
Daniel P. Berrange
4e8993a250 qemu: assume various QEMU 0.10 features are always available
The -sdl and -net ...name=XXX arguments were both introduced
in QEMU 0.10, so the QEMU driver can assume they are always
available.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:18 +00:00
Daniel P. Berrange
72edc90a65 qemu: assume -vga is always available
As of QEMU 0.10.0 the -vga argument was introduced, so the
QEMU driver can assume it is always available.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:17 +00:00
Daniel P. Berrange
f81e0d480e qemu: assume -drive format is always available
As of QEMU 0.10.0 the -drive format= parameter was added,
so the QEMU driver can assume it is always available.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:17 +00:00
Daniel P. Berrange
468273a69c qemu: assume -drive cache always uses v2 option names
As of QEMU 0.10.0, the -drive cache option stopped using
the on/off value names, so the QEMU driver can assume
use of the new value names.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:17 +00:00
Daniel P. Berrange
2e90c9daf9 qemu: assume support for all migration protocols except rdma
Since we require QEMU 0.12.0, we can assume that QEMU supports
all of the fd, tcp, unix and exec migration protocols.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:17 +00:00
Daniel P. Berrange
257e2056e7 qemu: really remove last traces of Xenner support
We have twice previously attempted to remove Xenner
support

  commit de9be0ab4d
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Wed Aug 22 17:29:01 2012 +0100

    Remove xenner support

  commit 92572c3d71
  Author: Ján Tomko <jtomko@redhat.com>
  Date:   Wed Feb 18 16:33:50 2015 +0100

    Remove code handling the QEMU_CAPS_DOMID capability

This change really does remove the last traces of it
in the capabilities handling code

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:15 +00:00
Daniel P. Berrange
dc7f6c3d30 qemu: assume -uuid is always available
The -uuid arg was added in QEMU 0.10.0, so the QEMU driver can
assume it is always available.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:02 +00:00
Daniel P. Berrange
4588c2ce97 qemu: assume -name is always available
The -name arg was added in QEMU 0.9.1, so the QEMU driver can
assume it is always available.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:02 +00:00
Daniel P. Berrange
f78610038d qemu: assume -drive argument is always available
As of QEMU 0.9.1 the -drive argument can be used to configure
all disks, so the QEMU driver can assume it is always available
and drop support for -hda/-cdrom/etc.

Many of the tests need updating because a great many were
running without CAPS_DRIVE set, so using the -hda legacy
syntax.

Fixing the tests uncovered a bug in the argv -> xml
convertor which failed to handle disk with if=floppy.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:01 +00:00
Daniel P. Berrange
f7ee34114d qemu: assume -no-reboot is always available
The -no-reboot arg was added in QEMU 0.9.0, so the QEMU driver
can now assume it is always present.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:01 +00:00
Daniel P. Berrange
9cd0fe69cd qemu: assume -vnc arg always takes a ':'
As of QEMU 0.9.0 the -vnc option accepts a ':' to separate port
from listen address, so the QEMU driver can assume that support
for listen addresses is always available.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:01 +00:00
John Ferlan
cc2d49f9be qemu: Fix qemu startup check for QEMU_CAPS_OBJECT_IOTHREAD
https://bugzilla.redhat.com/show_bug.cgi?id=1249981

When qemuDomainPinIOThread was added in commit id 'fb562614', a check
for the IOThread capability was not needed since a check for iothreadpids
covered the condition where the support for IOThreads was not present.
The iothreadpids array was only created if qemuProcessDetectIOThreadPIDs
was able to query the monitor for IOThreads. It would only do that if
the QEMU_CAPS_OBJECT_IOTHREAD capability was set.

However, when iothreadids were added in commit id '8d4614a5' and the
check for iothreadpids was replaced by a search through the iothreadids[]
array for the matching iothread_id that left open the possibility that
an iothreadids[] array was defined, but the entries essentially pointed
to elements with only the 'iothread_id' defined leaving the 'thread_id'
value of 0 and eventually the cpumap entry of NULL.

This was because, the original IOThreads commit id '72edaae7' only
checked if IOThreads were defined and if the emulator had the IOThreads
capability, then IOThread objects were added at startup. The "capability
failure" check was only done when a disk was assigned to an IOThread in
qemuCheckIOThreads. This was because the initial implementation had no way
to dynamically add IOThreads, but it was possible to dynamically add a
disk to the domain. So the decision was if the domain supported it, then
add the IOThread objects. Then if a disk with an IOThread defined was
added, it could check the capability and fail to add if not there. This
just meant the 'iothreads' value was essentially ignored.

Eventually commit id 'a27ed6e7' allowed for the dynamic addition and
deletion of IOThread objects. So it was no longer necessary to generate
IOThread objects to dynamically attach a disk to. However, the startup
and disk check code was not modified to reflect this.

This patch will move the capability failure check to when IOThread
objects are being added to the command line. Thus a domain that has
IOThreads defined will not be started if the emulator doesn't support
the capability. This means when qemuCheckIOThreads is called to add
a disk, it's no longer necessary to check the capability. Instead the
code can use the IOThreadFind call to indicate that the IOThread
doesn't exist.

Finally because it could be possible to have a domain running with the
iothreadids[] defined prior to this change if libvirtd is restarted each
having mostly empty elements, qemuProcessDetectIOThreadPIDs will check
if there are niothreadids when the QEMU_CAPS_OBJECT_IOTHREAD capability
check fails and remove the elements and array if it exists.

With these changes in place, it turns out the cputune-numatune test
was failing because the right bit wasn't set in the test. So used the
opportunity to fix that and create a test that would expect to fail
with some sort of iothreads defined and used, but not having the
correct capability.
2015-10-16 06:55:45 -04:00
Cole Robinson
1a83a068e4 tests: qemu: Add aarch64 virtio pci tests
- qemuxml2argv-aarch64-mmio-default-pci: Verify that we still default
  to virtio-mmio even if qemu is new enough to support PCI
- qemuxml2argv-aarch64-virtio-pci: Check generated arm virtio PCI args
2015-10-06 10:27:10 -04:00
Pavel Fedin
12a73cf14a qemu: Add test cases for gic-version option
These tests make sure that we can use this option only when the capability is
set.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
2015-10-02 16:14:26 +02:00
Peter Krempa
3b2db51430 test: Add test to validate that memory sizes don't get updated on migration 2015-09-22 16:09:28 +02:00
Pavel Fedin
0636c4a8f6 tests: use mockup cache
Use the new API in order to correctly add capability sets to the cache
before parsing XML files

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2015-09-22 13:56:59 +02:00
Pavel Fedin
5b7bf20877 tests: split out common qemu driver initialization
Two utility functions are introduced for proper initialization and
cleanup of the driver.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2015-09-22 13:56:59 +02:00
Jonathan Toppins
5c668a78d8 qemu: add udp interface support
Adds a new interface type using UDP sockets, this seems only applicable
to QEMU but have edited tree-wide to support the new interface type.

The interface type required the addition of a "localaddr" (local
address), this then maps into the following xml and qemu call.

<interface type='udp'>
  <mac address='52:54:00:5c:67:56'/>
  <source address='127.0.0.1' port='11112'>
    <local address='127.0.0.1' port='22222'/>
  </source>
  <model type='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</interface>

QEMU call:
	-net socket,udp=127.0.0.1:11112,localaddr=127.0.0.1:22222

Notice the xml "local" entry becomes the "localaddr" for the qemu call.

reference:
http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg00629.html

Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2015-09-02 10:17:50 +02:00
Martin Kletzander
cf0404455c qemu: Enable ioeventfd usage for virtio-scsi controllers
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1150484

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-08-10 15:05:34 +02:00
Laine Stump
7d69387cd6 qemu: support new pci controller model "pcie-switch-downstream-port"
This is backed by the qemu device xio3130-downstream. It can only be
connected to a pcie-switch-upstream-port (x3130-upstream) on the
upstream side.
2015-08-09 22:32:00 -04:00