Commit Graph

3833 Commits

Author SHA1 Message Date
Cole Robinson
426dc5eb28 qemu: command: support -chardev for platform devices
Some qemu arch/machine types have built in platform devices that
are always implicitly available. For platform serial devices, the
current code assumes that only old style -serial config can be
used for these devices.

Apparently though since -chardev was introduced, we can use -chardev
in these cases, like this:

  -chardev pty,id=foo
  -serial chardev:foo

Since -chardev enables all sorts of modern features, use this method
for platform devices.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2017-07-10 17:22:42 -04:00
Cole Robinson
b4d5604350 qemu: caps: blacklist QEMU_CAPS_CHARDEV
Every qemu version we support has QEMU_CAPS_CHARDEV, so stop
explicitly tracking it and blacklist it like we've done for many
other feature flags.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2017-07-10 17:15:53 -04:00
Cole Robinson
67a2de414f tests: qemuxml2argv: Add some QEMU_CAPS_CHARDEV annotations
Several tests are intending to test some serial/console related
bits but aren't setting QEMU_CAPS_CHARDEV. This will soon be enabled
unconditionally so let's add it ahead of time.

* q35-virt-manager-basic: Intended to test a virt-manager q35 config,
    which will include a serial/console device
* console-compat*: console/serial XML compat handling
* bios: Needs a serial device for sgabios CLI

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2017-07-10 17:02:11 -04:00
Cole Robinson
9818c08eed tests: qemuxml2argv: Drop old style serial testing
These tests are exercising old style -serial command lines. That
code will soon be removed, so drop these tests.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2017-07-10 17:00:20 -04:00
Cole Robinson
bae185c77b tests: qemuxml2argv: drop redundant serial testing
Several cases have incidental <serial> or <console> XML which aren't
the features being tested for. Upcoming changes will cause some
churn here, so instead drop these bits now.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2017-07-10 16:59:59 -04:00
Cole Robinson
56540950e7 qemu: command: always use -chardev for monitor config
AFAIK there aren't any cases where we will/should hit the old code
path for our supported qemu versions, so drop the old code.

Massive test suite churn follows

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2017-07-10 16:59:38 -04:00
Cole Robinson
ca5c5b997b qemu: command: Remove old style -parallel building
AFAIK there aren't any qemu arch/machine types with platform parallel
devices that would require old style -parallel config, so we shouldn't
ever need this nowadays.

Remove a now redundant test

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2017-07-10 16:58:26 -04:00
Cole Robinson
5afe52a871 tests: qemuxml2argv: Add an aarch64 pci-serial test
This demonstrates that the previous qemu caps changes will use
-chardev for pci-serial on aarch64 machvirt

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2017-07-10 16:58:13 -04:00
Peter Krempa
ccac446545 qemu: domain: Use vcpu 'node-id' property and pass it back to qemu
vcpu properties gathered from query-hotpluggable cpus need to be passed
back to qemu. As qemu did not use the node-id property until now and
libvirt forgot to pass it back properly (it was parsed but not passed
around) we did not honor this.

This patch adds node-id to the structures where it was missing and
passes it around as necessary.

The test data was generated with a VM with following config:
    <numa>
      <cell id='0' cpus='0,2,4,6' memory='512000' unit='KiB'/>
      <cell id='1' cpus='1,3,5,7' memory='512000' unit='KiB'/>
    </numa>

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1452053
2017-07-10 13:23:04 +02:00
Julio Faracco
89cb34c7dd tests: virstringtest: adding tests to virStrToDouble()
There are no occurrences of tests related to Strings and Double numbers
inside virstringtest.c. This commit introduces some tests to validate the
conversion. The test does not include locale changes yet.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
2017-07-10 09:15:53 +02:00
Roman Bogorodskiy
78fc843c7b bhyve: add vga configuration for video driver
Add support for vgaconf driver configuration. In domain xml it looks like
this:

  <video>
    <driver vgaconf='io|on|off'>
    <model .../>
  </video>

It was added with bhyve gop video in mind to allow users control how the
video device is exposed to the guest, specifically, how VGA I/O is
handled.

One can refer to the bhyve manual page to get more detailed description
of the possible VGA configuration options:

https://www.freebsd.org/cgi/man.cgi?query=bhyve&manpath=FreeBSD+12-current

The relevant part could be found using the 'vgaconf' keyword.

Also, add some tests for this new feature.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-06-27 17:44:27 +04:00
Peter Krempa
d65781bf06 tests: hotplug: Test disks with duplicate WWNs 2017-06-23 14:11:25 +02:00
Cole Robinson
8a129b75e2 tests: virstoragetest: fix --without-yajl
Recently added JSON tests should be skipped if compiled --without-yajl

https://bugzilla.redhat.com/show_bug.cgi?id=1463435
2017-06-21 12:12:26 -04:00
Farhan Ali
29ba41c2d4 qemu: Add loadparm to qemu command line string
Check for the LOADPARM capabilility and potentially add a loadparm=x to
the "-machine" string for the QEMU command line.

Also add xml2argv test cases for loadparm.

Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
2017-06-20 07:03:22 -04:00
Farhan Ali
04b1d5d192 qemu: Introduce a new QEMU capability for -machine loadparm
Add new capability for the "-machine loadparm" QEMU option.

Add the capabilities replies/xml for s390x for QEMU 2.9.50.

Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>
2017-06-20 07:03:22 -04:00
Farhan Ali
54fa1b44af conf: Add loadparm boot option for a boot device
Update the per device boot schema to add an optional loadparm parameter.

eg: <boot order='1' loadparm='2'/>

Extend the virDomainDeviceInfo to support loadparm option.
Modify the appropriate functions to parse loadparm from boot device xml.
Add the xml2xml test to validate the field.

Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
2017-06-20 07:03:22 -04:00
Peter Krempa
b16133b114 util: storage: adapt to changes in JSON format for sheepdog
Since qemu 2.9 the options changed from a monolithic string into fine
grained options for the json pseudo-protocol object.
2017-06-20 08:40:18 +02:00
Peter Krempa
ea2c418ac3 util: storage: adapt to changes in JSON format for ssh
Since qemu 2.9 the options changed from a monolithic string into fine
grained options for the json pseudo-protocol object.
2017-06-20 08:40:18 +02:00
Peter Krempa
4fac5a1935 util: storage: adapt to changes in JSON format for ceph/rbd
Since qemu 2.9 the options changed from a monolithic string into fine
grained options for the json pseudo-protocol object.
2017-06-20 08:40:18 +02:00
Peter Krempa
35d23f90b2 util: storage: adapt to changes in JSON format for NBD
Since 2.9 the host and port for NBD are no longer directly under the
json pseudo-protocol object, but rather belong to a sub-object called
'server'.
2017-06-20 08:40:18 +02:00
Peter Krempa
b24bc54080 util: storage: Add JSON parser for new options in iSCSI protocol
Starting from qemu 2.9, more granular options are supported. Add parser
for the relevant bits.

With this patch libvirt is able to parse the host and target IQN of from
the JSON pseudo-protocol specification.

This corresponds to BlockdevOptionsIscsi in qemu qapi.
2017-06-20 08:40:18 +02:00
Peter Krempa
1f915d40a2 util: storage: Add support for type 'inet' in virStorageSourceParseBackingJSONSocketAddress
'SocketAddress' structure was changed to contain 'inet' instead of
'tcp' since qemu commit c5f1ae3ae7b. Existing entries have a backward
compatibility layer.

Libvirt will parse 'inet' and 'tcp' as equivalents.
2017-06-20 08:40:18 +02:00
Martin Kletzander
d23410449f qemu: Pass the number of heads even with -vga qxl
When added in multiple previous commits, it was used only with -device
qxl(-vga), but for some QEMUs (< 1.6) we need to add this
functionality when using -vga qxl as well.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-06-19 13:26:24 +02:00
Pavel Hrdina
e13e8808f9 security: don't relabel chardev source if virtlogd is used as stdio handler
In the case that virtlogd is used as stdio handler we pass to QEMU
only FD to a PIPE connected to virtlogd instead of the file itself.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2017-06-16 16:00:10 +02:00
Martin Kletzander
cc9f0521cd Report more correct information for cache control
On some platforms the number of bits in the cbm_mask might not be
divisible by 4 (and not even by 2), so we need to properly count the
bits.  Similar file, min_cbm_bits, is properly parsed and used, but if
the number is greater than one, we lose the information about
granularity when reporting the data in capabilities.  For that matter
always report granularity, but if it is not the same as the minimum,
add that information in there as well.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-06-16 13:09:41 +02:00
William Grant
f3b0f324eb apparmor, virt-aa-helper: Allow aarch64 UEFI.
Allow access to aarch64 UEFI images.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Guido Günther <agx@sigxcpu.org>
2017-06-16 10:38:52 +02:00
Christian Ehrhardt
5b80c973f1 virt-aa-helper: Generalize test for firmware paths
This replaces individual tests for firmware locations by
a generic function which will simplify having additional
locations in the future.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
2017-06-16 10:38:52 +02:00
Simon McVittie
8d4aad6412 virt-aa-helper, apparmor: allow /usr/share/OVMF/ too
The split firmware and variables files introduced by
https://bugs.debian.org/764918 are in a different directory for
some reason. Let the virtual machine read both.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
2017-06-16 10:38:52 +02:00
Michal Privoznik
1e8d6c6ef0 qemu: Don't try to use hugepages if not enabled
https://bugzilla.redhat.com/show_bug.cgi?id=1214369

My fix 671d18594f was incomplete. If domain doesn't have
hugepages enabled, because of missing condition we would still be
putting hugepages path onto qemu cmd line. Clean up the
conditions so that it's more visible next time.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-06-14 16:47:14 +02:00
Michal Privoznik
992bf863fc qemu: Prefer hugepages over mem source='file'
https://bugzilla.redhat.com/show_bug.cgi?id=1214369

Consider the following XML:

  <memoryBacking>
    <hugepages>
      <page size='2048' unit='KiB' nodeset='1'/>
    </hugepages>
    <source type='file'/>
    <access mode='shared'/>
  </memoryBacking>

  <numa>
    <cell id='0' cpus='0-3' memory='512000' unit='KiB'/>
    <cell id='1' cpus='4-7' memory='512000' unit='KiB'/>
  </numa>

The following cmd line is generated:

  -object
  memory-backend-file,id=ram-node0,mem-path=/var/lib/libvirt/qemu/ram,
  share=yes,size=524288000 -numa node,nodeid=0,cpus=0-3,memdev=ram-node0
  -object
  memory-backend-file,id=ram-node1,mem-path=/var/lib/libvirt/qemu/ram,
  share=yes,size=524288000 -numa node,nodeid=1,cpus=4-7,memdev=ram-node1

This is obviously wrong as for node 1 hugepages should have been
used. The hugepages configuration is more specific than <source
type='file'/>.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-06-13 16:44:29 +02:00
Michal Privoznik
671d18594f qemu: Allow memAccess for hugepages again
https://bugzilla.redhat.com/show_bug.cgi?id=1214369
https://bugzilla.redhat.com/show_bug.cgi?id=1458638

Historically, we've always supported memAccess for domains backed
by hugepages. However, somewhere along the way we've regressed
and stopped allowing such configuration. Fix it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-06-13 16:44:29 +02:00
Michal Privoznik
1fd19670c6 qemuxml2xmltest: Test hugepage enabled domains
We have couple of hugepage enabled domains for qemuxml2argvtest.
Unfortunately, often when adding a test case there I forget to
add it to xml2xml test too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-06-13 16:44:29 +02:00
Jiri Denemark
5c8c2d1633 cpu_ppc64: Add support for host-model on POWER9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-06-13 10:35:53 +02:00
Roman Bogorodskiy
ebe8139536 bhyve: tests: add vnc test to bhyvexml2xmltest
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-06-12 18:04:54 +04:00
Pavel Hrdina
8f827f2ace qemu: skip only ',' for VNC and Spice unix socket
Commit 824272cb28 attempted to fix escaping of characters in unix
socket path but it was wrong.  We need to escape only ',', there is
no escape character for '='.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2017-06-12 12:45:25 +02:00
Ján Tomko
b2cbc3a060 qemu: format virtio-related options on the command line
Format iommu_platform= and ats= for virtio devices.

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

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-08 16:33:13 +02:00
Ján Tomko
56a28fbb57 qemuxml2argvtest: add virtio-options test case
Add a test case to demonstrate the addition of new command line options

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

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-08 16:32:58 +02:00
Ján Tomko
cc0933d350 Add virtio-related options to input devices
https://bugzilla.redhat.com/show_bug.cgi?id=1283251

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-08 16:32:53 +02:00
Ján Tomko
f5384fb402 Add virtio-related options to video
https://bugzilla.redhat.com/show_bug.cgi?id=1283251

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-08 16:32:49 +02:00
Ján Tomko
f65db1be12 Add virtio-related options to rng devices
https://bugzilla.redhat.com/show_bug.cgi?id=1283251

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-08 16:32:44 +02:00
Ján Tomko
b10c22d9fa Add virtio-related options to filesystems
https://bugzilla.redhat.com/show_bug.cgi?id=1283251

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-08 16:32:40 +02:00
Ján Tomko
c85217cf8a Add virtio-related options to controllers
https://bugzilla.redhat.com/show_bug.cgi?id=1283251

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-08 16:32:33 +02:00
Ján Tomko
1bc2cb3b32 Add virtio-related options to disks
https://bugzilla.redhat.com/show_bug.cgi?id=1283251

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-08 16:32:27 +02:00
Ján Tomko
82223f9364 add virtio-related options to memballoon
https://bugzilla.redhat.com/show_bug.cgi?id=1283251

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-08 16:32:11 +02:00
Ján Tomko
fd51864340 Add virtio-related options to interfaces
<interface type='user'>
  <mac address='52:54:56:5a:5c:5e'/>
  <model type='virtio'/>
  <driver iommu='on' ats='on'/>
</interface>

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

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-08 16:31:54 +02:00
Ján Tomko
15911ab820 qemuxml2xmltest: add virtio-options test
Add a test case with all the virtio devices we know to demonstrate
the addition of new options.

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

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-08 16:31:32 +02:00
Ján Tomko
240e443afd qemu: format device-iotlb on intel-iommu command line
Format the device-iotlb attribute.

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

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-08 16:31:28 +02:00
Ján Tomko
27b187be39 conf: add iotlb attribute to iommu
Add a new iotlb attribute to the iommu device
to control the device IOTLB support for intel-iommu.

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

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-08 16:31:09 +02:00
Michal Privoznik
2a13a0a103 qemu: Query for vhostuser iface names at runtime
https://bugzilla.redhat.com/show_bug.cgi?id=1459091

Currently, we are querying for vhostuser interface name in post
parse callback. At that time interface might not yet exist.
However, it has to exist when starting domain. Therefore it makes
more sense to query its name at that point. This partially
reverts 57b5e27.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-06-08 15:02:22 +02:00
Jiri Denemark
25af7e950a conf: Add save cookie callbacks to xmlopt
virDomainXMLOption gains driver specific callbacks for parsing and
formatting save cookies.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-07 13:36:01 +02:00
Jiri Denemark
957cd268a9 conf: Pass xmlopt to virDomainSnapshotDefFormat
This will be used later when a save cookie will become part of the
snapshot XML using new driver specific parser/formatter functions.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-07 13:36:01 +02:00
Jiri Denemark
702013f3b3 conf: Refactor virCPUDefParseXML
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-07 13:36:01 +02:00
Ján Tomko
bb74c66e67 conf: only format <controller> as a pair tag when needed
Make the decision based on the usage of childBuf buffer.

This fixes the oddity in the test case introduced by commit c1c4d0d
where we would format an empty pair tag.
2017-06-05 16:13:50 +02:00
Michal Privoznik
567f04808e bhyveargv2xmltest: Fix call of virDomainDefCheckABIStability
In 4f0aeed I've expanded the list of arguments for
virDomainDefCheckABIStability() but I forgot to fix
bhyveargv2xmltest.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-06-05 11:46:02 +02:00
Martin Kletzander
f4c09b913e Reset the whole stack in testutils
The memset() was resetting only 30 bytes in the array (size of the
array), but it is array of pointers.  Since it is a static array,
let's just reset it by its size.

Found by gcc-7.1:

  testutils.c: In function 'virTestRun':
  testutils.c:243:13: error: 'memset' used with length equal to number
  of elements without multiplication by element size [-Werror=memset-elt-size]
    memset(testAllocStack, 0, ARRAY_CARDINALITY(testAllocStack));
    ^~~~~~

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-06-05 09:50:51 +02:00
Eli Qiao
0ab409ccc4 Expose resource control capabilities for caches
Add cache resource control into capabilities for CAT without CDP:

  <cache>
    <bank id='0' level='3' type='unified' size='15360' unit='KiB' cpus='0-5'>
      <control min='768' unit='KiB' scope='both' max_allocation='4'/>
    </bank>
  </cache>

and with CDP:

  <cache>
    <bank id='0' level='3' type='unified' size='15360' unit='KiB' cpus='0-5'>
      <control min='768' unit='KiB' scope='code' max_allocation='4'/>
      <control min='768' unit='KiB' scope='data' max_allocation='4'/>
    </bank>
  </cache>

Also add new test cases for vircaps2xmltest.

Signed-off-by: Eli Qiao <liyong.qiao@intel.com>
2017-06-05 09:50:51 +02:00
Michal Privoznik
4f0aeed871 virDomainXMLOption: Introduce virDomainABIStabilityDomain
While checking for ABI stability, drivers might pose additional
checks that are not valid for general case. For instance, qemu
driver might check some memory backing attributes because of how
qemu works. But those attributes may work well in other drivers.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-06-05 09:08:52 +02:00
Bjoern Walk
bb2adfe934 node_device: introduce new capability FC_RPORT
Similar to scsi_host and fc_host, there is a relation between a
scsi_target and its transport specific fc_remote_port. Let's expose this
relation and relevant information behind it.

An example for a virsh nodedev-dumpxml:

    virsh # nodedev-dumpxml scsi_target0_0_0
    <device>
      <name>scsi_target0_0_0</name>
      <path>/sys/devices/[...]/host0/rport-0:0-0/target0:0:0</path>
      <parent>scsi_host0</parent>
      <capability type='scsi_target'>
        <target>target0:0:0</target>
        <capability type='fc_remote_port'>
          <rport>rport-0:0-0</rport>
          <wwpn>0x9d73bc45f0e21a86</wwpn>
        </capability>
      </capability>
    </device>

Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
2017-05-26 10:44:05 -04:00
Bjoern Walk
b0ffd938d4 node_device: detect CCW devices
Make CCW devices available to the node_device driver. The devices are
already seen by udev so let's implement necessary code for detecting
them properly.

Topologically, CCW devices are similar to PCI devices, e.g.:

    +- ccw_0_0_1a2b
        |
        +- scsi_host0
            |
            +- scsi_target0_0_0
                |
                +- scsi_0_0_0_0

Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
2017-05-26 10:44:05 -04:00
Ján Tomko
381e638d81 qemu: format eim on intel-iommu command line
This option turns on extended interrupt mode,
which allows more than 255 vCPUs.

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

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2017-05-26 08:16:29 +02:00
Ján Tomko
dc61d92758 conf: add eim attribute to <iommu><driver>
Add an attribute to control extended interrupt mode.

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

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2017-05-26 08:11:25 +02:00
Wim ten Have
4cd3f24139 xenconfig: fix handling of NULL disk source
It is possible to crash libvirtd when converting xl native config to
domXML when the xl config contains an empty disk source, e.g. an empty
CDROM. Fix by checking that the disk source is non-NULL before parsing it.

Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
2017-05-19 08:47:36 -06:00
Michal Privoznik
2f69dd36bb virfiletest: include linux/falloc.h
On systems with older glibc including fcntl.h for getting
FALLOC_FL_PUNCH_HOLE defined is not enough. We must also include
linux/falloc.h.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-05-19 14:02:37 +02:00
Michal Privoznik
adbd1626cb virfiletest: Test virFileInData iff SEEK_HOLE is defined
Yet another place where we need to wrap code in
HAVE_DECL_SEEK_HOLE block.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-05-19 14:02:37 +02:00
Erik Skultety
88ef73e13c nodedev: Introduce mdev capability for mediated devices
Start discovering the mediated devices on the host system and format the
attributes for the mediated device into the XML. Compared to the parent
device which reports generic information about the abstract mediated
devices types, a child device only reports the type name it has been
instantiated from and the IOMMU group number, since that's device
specific compared to the rest of the info that can be gathered about
mediated devices at the moment.
This patch introduces both the formatting and parsing routines, updates
nodedev.rng schema, adding a testcase as well.

The resulting mdev child device XML:
<device>
  <name>mdev_4b20d080_1b54_4048_85b3_a6a62d165c01</name>
  <path>/sys/devices/.../4b20d080-1b54-4048-85b3-a6a62d165c01</path>
  <parent>pci_0000_06_00_0</parent>
  <driver>
    <name>vfio_mdev</name>
  </driver>
  <capability type='mdev'>
    <type id='vendor_supplied_type_id'/>
    <iommuGroup number='NUM'/>
  <capability/>
<device/>

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2017-05-18 12:21:45 +02:00
Erik Skultety
500cbc066a nodedev: Introduce the mdev capability to a PCI parent device
The parent device needs to report the generic stuff about the supported
mediated devices types, like device API, available instances, type name,
etc. Therefore this patch introduces a new nested capability element of
type 'mdev_types' with the resulting XML of the following format:

<device>
  ...
  <capability type='pci'>
    ...
    <capability type='mdev_types'>
      <type id='vendor_supplied_id'>
        <name>optional_vendor_supplied_codename</name>
        <deviceAPI>vfio-pci</deviceAPI>
        <availableInstances>NUM</availableInstances>
      </type>
        ...
      <type>
        ...
      </type>
    </capability>
  </capability>
  ...
</device>

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2017-05-18 12:21:33 +02:00
Michal Privoznik
b928d140f4 util: Introduce virFileInData
This function takes a FD and determines whether the current
position is in data section or in a hole. In addition to that,
it also determines how much bytes are there remaining till the
current section ends.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-05-18 07:42:13 +02:00
Andrea Bolognani
bc07101a7c qemu: Use GICv2 for aarch64/virt TCG guests
There are currently some limitations in the emulated GICv3
that make it unsuitable as a default. Use GICv2 instead.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2017-05-16 16:48:30 +02:00
Andrea Bolognani
b24eaf6210 tests: Check default GIC version for aarch64/virt TCG guests
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2017-05-16 16:48:30 +02:00
Pavel Hrdina
ed99660446 qemu: improve detection of UNIX path generated by libvirt
Currently we consider all UNIX paths with specific prefix as generated
by libvirt, but that's a wrong assumption.  Let's make the detection
better by actually checking whether the whole path matches one of the
paths that we generate or generated in the past.

The UNIX path isn't stored in config XML since libvirt-1.3.1.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-05-16 11:33:49 +02:00
Ján Tomko
a56914486c qemu: format caching-mode on iommu command line
Format the caching-mode option for the intel-iommu device,
based on its <driver caching> attribute value.

https://bugzilla.redhat.com/show_bug.cgi?id=1427005
2017-05-15 15:44:11 +02:00
Ján Tomko
d12781b47e conf: add caching_mode attribute to iommu device
Add a new attribute to control the caching mode.

https://bugzilla.redhat.com/show_bug.cgi?id=1427005
2017-05-15 15:44:11 +02:00
Ján Tomko
04028a9db9 qemu: format intel-iommu,intremap on the command line
https://bugzilla.redhat.com/show_bug.cgi?id=1427005
2017-05-15 15:44:11 +02:00
Ján Tomko
2020e2c6f2 conf: add <driver intremap> to <iommu>
Add a new attribute to control interrupt remapping.

https://bugzilla.redhat.com/show_bug.cgi?id=1427005
2017-05-15 15:44:11 +02:00
Ján Tomko
6b5c6314b2 qemu: format kernel_irqchip on the command line
Add kernel_irqchip=split/on to the QEMU command line
and a capability that looks for it in query-command-line-options
output. For the 'split' option, use a version check
since it cannot be reasonably probed.

https://bugzilla.redhat.com/show_bug.cgi?id=1427005
2017-05-15 15:44:11 +02:00
Ján Tomko
8023b21a95 conf: add <ioapic driver> to <features>
Add a new <ioapic> element with a driver attribute.

Possible values are qemu and kvm. With 'qemu', the I/O
APIC can be put in the userspace even for KVM domains.

https://bugzilla.redhat.com/show_bug.cgi?id=1427005
2017-05-15 15:41:17 +02:00
Martin Kletzander
ec337aee9b test-wrap-argv.pl: Accept short parameter -i for --in-place
I like to use it that way and every time I try running it I just
instinctively use '-i' (like with sed, etc.) and it makes sense, IMHO.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-05-15 12:34:19 +02:00
Pavel Hrdina
0918b84968 util: introduce virBufferEscapeRegex
Add a helper to escape all possible meta-characters used for
POSIX extended regular expressions.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-05-12 16:54:33 +02:00
Pavel Hrdina
f15f155403 util: introduce virStringMatch
Simply tries to match the provided regex on a string and returns
the result.  Useful if caller don't care about the matched substring
and want to just test if some pattern patches a string.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-05-12 16:51:18 +02:00
Daniel P. Berrange
300c7c7035 tests: stub out virfilewrapper.c on Win32
The Win32 platform can not do link time overrides in the same way
that we can on POSIX / ELF based platforms, so we cannot build
the virfilewrapper.c code reliably. Just stub it out on Win32
so it is a no-op. Tests that use this file are already written
to skip on Win32.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-05-11 11:45:41 +01:00
Daniel P. Berrange
4a1a4be37e Add missing deps on virfilewrapper.h
The test programs depend on virfilewrapper.h as well as the
virfilewrapper.c. Adding the dep ensures that virfilewrapper.h
gets included in the dist tarball.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-05-10 16:15:05 +01:00
Roman Bogorodskiy
058bf5549f tests: fix virfilewrapper
If __lxstat() and __xstat() functions are not available, build fails with:

  CC       virfilewrapper.o
virfilewrapper.c:180:5: error: no previous prototype for function '__lxstat' [-Werror,-Wmissing-prototypes]
int __lxstat(int ver, const char *path, struct stat *sb)
    ^
virfilewrapper.c:208:5: error: no previous prototype for function '__xstat' [-Werror,-Wmissing-prototypes]
int __xstat(int ver, const char *path, struct stat *sb)

Luckily, we already check presence of these functions in configure
using AC_CHECK_FUNCS, so just don't wrap these if they're not available.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
2017-05-09 17:03:02 +04:00
Martin Kletzander
0e3ff22c6f tests: Add resctrl test for vircaps2xmltest
Add info from yet another machine, this time with resctrl data so that
we can extend tests easily in a test-driven way.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-05-09 13:12:40 +02:00
Martin Kletzander
fec6e4c48c tests: Add support for more complicated hierarchies in vircaps2xmltest
More directories will need to be mocked, so let's prepare for that.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-05-09 13:12:40 +02:00
Martin Kletzander
4ad6a73bfc Add host cache information in capabilities
We're only adding only info about L3 caches, we can add more
later (just by changing one line), but for now that's more than enough
without overwhelming anyone.

XML snippet of how this should look like (also seen as part of the commit):

  <cache>
    <bank id='0' level='3' type='both' size='8192' unit='KiB' cpus='0-7'/>
  </cache>

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-05-09 13:12:40 +02:00
Martin Kletzander
90a118fa69 tests: Add missing cache data for vircaps2xmltest
Commit a0fdd2f6f9 added some data from
the system but forgot 3 files for each cache.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-05-09 13:12:40 +02:00
Martin Kletzander
eb18683fdb tests: Test vircaps2xmldata XMLs in virschematest
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-05-09 13:12:40 +02:00
Martin Kletzander
7008e10869 util: Remove virsysfs and instead enhance virFileReadValue* functions
It is no longer needed thanks to the great virfilewrapper.c.  And this
way we don't have to add a new set of functions for each prefixed
path.

While on that, add two functions that weren't there before, string and
scaled integer reading ones.  Also increase the length of the string
being read by one to accompany for the optional newline at the
end (i.e. change INT_STRLEN_BOUND to INT_BUFSIZE_BOUND).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-05-09 13:12:40 +02:00
Martin Kletzander
ae60ea48bc tests: Add virfilewrapper -- the new super "mock"
This mock (which is actually not mock at all, see later) can redirect
all accesses to a path into another path.  There is no need to
create mocks for particular directories, you just create a directory
with all the data a redirect the test there.

In the future, this should also be able to register callbacks for
calls/paths, e.g. when the test is going to write into anything under
"/sys/devices", call function fce();  Then in the open() call we would
add information about the fd into some structure and in write() we
would call fce() with parameters like @path to write to, @data to
be written and pointer to optional return value, so that fce() itself
could stop the call from happening or change its behaviour.  But
that's an idea for a latter day.

This is not a mock because it will not be preloaded, but compiled in
the test itself.  See future patches for usage.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-05-09 13:12:40 +02:00
Michal Privoznik
b8ef4758f3 fdstreamtest: Print more info on read failure
It helps with debugging if we know what's the return value of
saferead().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-04-28 14:17:10 +02:00
Michal Privoznik
1cb23be2a5 fdstreamtest: Rename tempdir
Because of copy-paste the temporary directory used for this test
is called "fakesysdir". That's probably misleading.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-04-28 14:17:10 +02:00
Pavel Hrdina
568887a32f qemu: use qemu-xhci USB controller by default for ppc64 and aarch64
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1438682

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Acked-by: Andrea Bolognani <abologna@redhat.com>
2017-04-28 10:47:12 +02:00
Pavel Hrdina
278e70f8f8 qemu: add support for qemu-xhci USB controller
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1438682

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Acked-by: Andrea Bolognani <abologna@redhat.com>
2017-04-28 10:44:36 +02:00
Pavel Hrdina
5237a74d4a qemu: introduce QEMU_CAPS_DEVICE_QEMU_XHCI
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Acked-by: Andrea Bolognani <abologna@redhat.com>
2017-04-28 10:44:03 +02:00
Pavel Hrdina
233f8d0bd4 qemu: use nec-usb-xhci as a default controller for aarch64 if available
This is a USB3 controller and it's a better choice than piix3-uhci.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Acked-by: Andrea Bolognani <abologna@redhat.com>
2017-04-28 10:42:26 +02:00
Peter Krempa
ef0bb841c9 tests: genericxml2xml: Add test case for HTTP based disk 2017-04-28 10:22:40 +02:00
Wim ten Have
5ade0ff905 xlconfigtest: add tests for 'nestedhvm' support
Testing various configuration schemas targeting postive and negative
nestedhvm under libvirt <cpu mode="host-passthrough"> configuration.

Mode "host-passthrough" generates nestedhvm=1 in/from xl format where

Intel virtualization (VT-x):
<feature policy='disable' name='vmx'/>

    or

AMD virtualization (AMD-V):
<feature policy='disable' name='svm'/>

disables virtualization mode under guest domains.

Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2017-04-27 15:05:44 -06:00
Jiri Denemark
df13c0b477 qemu: Add support for guest CPU cache
This patch maps /domain/cpu/cache element into -cpu parameters:

- <cache mode='passthrough'/> is translated to host-cache-info=on
- <cache level='3' mode='emulate'/> is transformed into l3-cache=on
- <cache mode='disable'/> is turned in host-cache-info=off,l3-cache=off

Any other <cache> element is forbidden.

The tricky part is detecting whether QEMU supports the CPU properties.

The 'host-cache-info' property is introduced in v2.4.0-1389-ge265e3e480,
earlier QEMU releases enabled host-cache-info by default and had no way
to disable it. If the property is present, it defaults to 'off' for any
QEMU until at least 2.9.0.

The 'l3-cache' property was introduced later by v2.7.0-200-g14c985cffa.
Earlier versions worked as if l3-cache=off was passed. For any QEMU
until at least 2.9.0 l3-cache is 'off' by default.

QEMU 2.9.0 was the first release which supports probing both properties
by running device-list-properties with typename=host-x86_64-cpu. Older
QEMU releases did not support device-list-properties command for CPU
devices. Thus we can't really rely on probing them and we can just use
query-cpu-model-expansion QMP command as a witness.

Because the cache property probing is only reliable for QEMU >= 2.9.0
when both are already supported for quite a few releases, we let QEMU
report an error if a specific cache mode is explicitly requested. The
other mode (or both if a user requested CPU cache to be disabled) is
explicitly turned off for QEMU >= 2.9.0 to avoid any surprises in case
the QEMU defaults change. Any older QEMU already turns them off so not
doing so explicitly does not make any harm.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-04-27 22:41:10 +02:00
Jiri Denemark
a646a6016a Add support for CPU cache specification
This patch introduces

    <cache level='N' mode='emulate'/>
    <cache mode='passthrough'/>
    <cache mode='disable'/>

sub element of /domain/cpu. Currently only a single <cache> element is
allowed.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-04-27 22:07:14 +02:00
Michal Privoznik
1a4a4ffa3e lib: Fix c99 style comments
We prefer c89 style of comments.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-04-27 14:13:19 +02:00