Commit Graph

275 Commits

Author SHA1 Message Date
Pavel Hrdina
1d9d0c9397 domain_conf: fix graphics parsing
Commit dc98a5bc refactored the code a lot and forget about checking if
listen attribute is specified.  This ensures that listen attribute and
first listen element are compared only if both exist.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-04-11 13:50:55 +02:00
Marc-André Lureau
937ebba00e qemu: add spice opengl support
Add Spice graphics gl attribute. qemu 2.6 should have -spice gl=on argument to
enable opengl rendering context (patches on the ML). This is necessary to
actually enable virgl rendering.

Add a qemuxml2argv test for virtio-gpu + spice with virgl.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-03-01 09:45:47 +01:00
Martin Kletzander
a89f05ba8d qemu: Shorten per-domain directory names
Per-domain directories were introduced in order to be able to
completely separate security labels for each domain (commit
f1f68ca334).  However when the domain
name is long (let's say a ridiculous 110 characters), we cannot
connect to the monitor socket because on length of UNIX socket address
is limited.  In order to get around this, let's shorten it in similar
fashion and in order to avoid conflicts, throw in an ID there as well.
Also save that into the status XML and load the old status XMLs
properly (to clean up after older domains).  That way we can change it
in the future.

The shortening can be seen in qemuxml2argv tests, for example in the
hugepages-pages2 case.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-03-01 07:15:29 +01:00
Ján Tomko
1d6dcec080 testCompareDomXML2XMLFiles: add parseFlags parameter
Allow testing XML parsing with different flags.
2016-02-26 09:47:45 +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
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
c1c4d0d5a5 tests: qemuxml2xml: assign device addresses
We use the PreFormat callback for this. Many test cases need to be extended
to pass in proper qemuCaps flags so AssignAddresses doesn't throw errors.

One test case (pcie-root-port-too-many) is dropped, since it was meant
only for checking an error condition in qemuxml2argv, and one we add in
AssignAddresses it errors here too.

Long term I think AssignAddresses should be handled in qemu's PostParse
callback, but that's not entirely straightforward. Handling it here
means we can get the test suite churn over with.
2016-02-09 16:09:01 -05:00
Cole Robinson
8e0fd243f8 tests: utils: Add PreFormat callback for CompareXML2XML helper
This allows individual driver tests to hook in their own code before
the def is formatted and compared.

We will eventually use this in the qemuxml2xml
2016-02-09 16:09:01 -05:00
Cole Robinson
129c35326a tests: qemuxml2xml: specify qemuCaps in test cases
Similar to how we do it for qemuxml2argvtest. This will be used in future
patches.
2016-02-09 15:09:07 -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
Cole Robinson
d093d623e3 tests: qemuxml2xml: Always use different output file
Most qemuxml2xml tests expect that the input XML is unchanged after
parsing. This is unlike 99% of new qemu configs in the wild, which after
initial parsing end up with stable PCI device addresses. The xml2xml bit
doesn't currently hit that code path though, so most XML testing indeed
does not change.

Future patches will add that PCI address bits, which means most test cases
will have different output. So let's do away with the hardcoded same vs
different test split, and always track a separate output file. Tests can
still have same input and output, it just necessitates 2 separate XML files.
2016-02-09 10:22:05 -05:00
Daniel P. Berrange
1036ddadb2 conf: add caps to virDomainObjFormat/SaveStatus
The virDomainObjFormat and virDomainSaveStatus methods
both call into virDomainDefFormat, so should be providing
a non-NULL virCapsPtr instance.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-02-05 10:57:08 +00: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
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
8d48ce02c3 tests: qemuxml2xml: Wire up QEMUCaps usage
Future changes will make some of these tests dependent on specific
QEMUCaps flags, so wire up the basic handling. Flags will be added
in future patches.
2016-01-08 21:21:34 -05:00
Cole Robinson
f8ce014319 tests: qemuxml2xml: drop early file loading
For the standard active/inactive XML testing, if we leave the file loading
up to the generic XML2XML infrastructure, we get the benefit of
VIR_TEST_REGENERATE_OUTPUT, at the price of a few more disk reads. Seems
worth it.
2016-01-08 21:21:34 -05:00
Cole Robinson
5770c17074 tests: Share domain XML2XML compare helper
This creates a shared function in testutils.c that consolidates all
the slightly different implementations.
2016-01-08 21:21:34 -05:00
Cole Robinson
a4af45c065 tests: qemuxml2xml: Convert fprintf to VIR_TEST_DEBUG 2016-01-08 13:25:21 -05:00
Pavel Hrdina
781d70c027 tests.testutils: use VIR_TEST_REGENERATE_OUTPUT for virTestDifferenceFull
This patch enable regeneration of expected output file for
virTestDifferenceFull.  It also introduces new
virTestDifferenceFullNoRegenerate function for special cases, where we
don't want to regenerate output.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-01-08 16:08:15 +01:00
Ján Tomko
1a538a07c7 conf: add XML for input device passthrough
Add xml for the new virtio-input-host-pci device:
<input type='passthrough' bus='virtio'>
  <source evdev='/dev/input/event1234'/>
</input>

https://bugzilla.redhat.com/show_bug.cgi?id=1231114
2015-11-30 12:29:03 +01:00
Ján Tomko
bebdfafb2b conf: parse and format virtio input bus in domain XML
To be used by the family of virtio input devices:

<input type='mouse' bus='virtio'/>
<input type='tablet' bus='virtio'/>
<input type='keyboard' bus='virtio'/>

https://bugzilla.redhat.com/show_bug.cgi?id=1231114
2015-11-30 12:22:06 +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
Dmitry Andreev
5e8d2ebd7a tests: add tests for the new panic device attribute - 'model' 2015-11-25 12:30:05 +01:00
Pavel Hrdina
fc03eb53c0 domain-conf: reorder usb controllers so the master is first
USB controllers can share the same 'index' which indicates, that there
is some sort of master-companion relationship.  Reorder the controllers
in XML in to place the master controller before its companions.  This is
required by QEMU to not fail with error message:

error: internal error: process exited while connecting to monitor:
2015-10-26T16:25:17.630265Z qemu-system-x86_64:
-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x6:
USB bus 'usb.0' not found

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-11-11 15:30:49 +01: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
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
Martin Kletzander
7d19413955 tests: Check GIC-related XMLs in qemuxml2xmltest
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-10-06 15:10:36 +02:00
Peter Krempa
ed94ad9e40 conf: Drop VIR_DOMAIN_DEF_PARSE_CLOCK_ADJUST flag
The flag was used only for formatting the XML and once the parser and
formatter flags were split in 0ecd685109
it doesn't make sense any more to have it.
2015-09-22 16:09:27 +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
Luyao Huang
83ae3ee39b conf: fix crash when parsing a unordered NUMA <cell/>
https://bugzilla.redhat.com/show_bug.cgi?id=1260846

Introduced by 8fedbbdb, if we parse an unordered NUMA cell, will
get a segfault. This is because of a check for overlapping @cpus
sets we have there. However, since the array to hold guest NUMA
cells is allocated upfront and therefore it contains all zeros,
an out of order cell will break our assumption that cell IDs have
increasing character. At this point we try to access yet NULL
bitmap and therefore segfault.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
2015-09-08 10:40:20 +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
8ce86722d7 qemu: Keep numad hint after daemon restart
The numad hint stored in priv->autoNodeset is information that gets lost
during daemon restart.  And because we would like to use that
information in the future, we also need to save it in the status XML.
For the sake of tests, we need to initialize nnumaCell_max to some
value, so that the restoration doesn't fail in our test suite.  There is
no need to fill in the actual numa cell data since the recalculating
function virCapabilitiesGetCpusForNodemask() will not fail, it will just
skip filling the data in the bitmap which we don't use in tests anyway.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-08-13 15:06:06 +02:00
Martin Kletzander
35eecddee3 conf: Add ioeventfd option for controllers
This will be used with a virtio-scsi controller later on.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-08-10 15:05:34 +02:00
Laine Stump
76379a6ec1 conf: new pcie-controller model "pcie-switch-downstream-port"
This controller can be connected only to a port on a
pcie-switch-upstream-port. It provides a single hotpluggable port that
will accept any PCI or PCIe device, as well as any device requiring a
pcie-*-port (the only current example of such a device is the
pcie-switch-upstream-port).
2015-08-09 22:30:47 -04:00
Laine Stump
38ea9515af conf: new pci controller model "pcie-switch-upstream-port"
This controller can be connected only to a pcie-root-port or a
pcie-switch-downstream-port (which will be added in a later patch),
which is the reason for the new connect type
VIR_PCI_CONNECT_TYPE_PCIE_PORT. A pcie-switch-upstream-port provides
32 ports (slot=0 to slot=31) on the downstream side, which can only
have pci controllers of model "pcie-switch-downstream-port" plugged
into them, which is the reason for the other new connect type
VIR_PCI_CONNECT_TYPE_PCIE_SWITCH.
2015-08-09 22:12:29 -04:00
Laine Stump
16328520f6 qemu: support new pci controller model "pcie-root-port"
This is backed by the qemu device ioh3420.

chassis and port from the <target> subelement are used to store/set the
respective qemu device options for the ioh3420. Currently, chassis is
set to be the index of the controller, and port is set to
"(slot << 3) + function" (per suggestion from Alex Williamson).
2015-08-09 21:58:55 -04:00
Laine Stump
dce3b8beb3 conf: new pci controller model "pcie-root-port"
This controller can be connected (at domain startup time only - not
hotpluggable) only to a port on the pcie root complex ("pcie-root" in
libvirt config), hence the new connect type
VIR_PCI_CONNECT_TYPE_PCIE_ROOT. It provides a hotpluggable port that
will accept any PCI or PCIe device.

New attributes must be added to the controller <target> subelement for
this - chassis and port are guest-visible option values that will be
set by libvirt with values derived from the controller's index and pci
address information.
2015-08-09 21:52:52 -04:00
Luyao Huang
786539d6bf conf: Format scheduler priority when it is zero
https://bugzilla.redhat.com/show_bug.cgi?id=1235116

According to our XML definition, zero is as valid as any other value.
Mainly because it should be kernel-agnostic.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
2015-06-25 23:25:30 +02:00
Eric Farman
c733e97323 docs: Fix XML schema handling of LUN address in hostdev tag
Defining a domain with a SCSI disk attached via a hostdev
tag and a source address unit value longer than two digits
causes an error when editing the domain with virsh edit,
even if no changes are made to the domain definition.
The error suggests invalid XML, somewhere:

  # virsh edit lmb_guest
  error: XML document failed to validate against schema:
  Unable to validate doc against /usr/local/share/libvirt/schemas/domain.rng
  Extra element devices in interleave
  Element domain failed to validate content

The virt-xml-validate tool fails with a similar error:

  # virt-xml-validate lmb_guest.xml
  Relax-NG validity error : Extra element devices in interleave
  lmb_guest.xml:17: element devices: Relax-NG validity error :
  Element domain failed to validate content
  lmb_guest.xml fails to validate

The hostdev tag requires a source address to be specified,
which includes bus, target, and unit address attributes.
According to the SCSI Architecture Model spec (section
4.9 of SAM-2), a LUN address is 64 bits and thus could be
up to 20 decimal digits long.  Unfortunately, the XML
schema limits this string to just two digits.  Similarly,
the target field can be up to 32 bits in length, which
would be 10 decimal digits.

  # lsscsi -xx
  [0:0:19:0x4022401100000000]  disk    IBM      2107900          3.44 /dev/sda
  # lsscsi
  [0:0:19:1074872354]disk    IBM      2107900          3.44  /dev/sda
  # cat lmb_guest.xml
  <domain type='kvm'>
    <name>lmb_guest</name>
    <memory unit='MiB'>1024</memory>
  ...trimmed...
    <devices>
      <controller type='scsi' model='virtio-scsi' index='0'/>
      <hostdev mode='subsystem' type='scsi'>
        <source>
          <adapter name='scsi_host0'/>
          <address bus='0' target='19' unit='1074872354'/>
        </source>
      </hostdev>
  ...trimmed...

Since the reference unit and target fields are used in
several places in the XML schema, create a separate one
specific for SCSI Logical Units that will permit the
greater length.  This permits both the validation utility
and the virsh edit command to succeed when a hostdev
tag is included.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
2015-06-22 16:15:49 -04:00
Michal Privoznik
a9a27e602c virSysinfo: Introduce SMBIOS type 2 support
https://bugzilla.redhat.com/show_bug.cgi?id=1220527

This type of information defines attributes of a system
baseboard. With one exception: board type is yet not implemented
in qemu so it's not introduced here either.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-06-18 10:10:26 +02:00