Commit Graph

871 Commits

Author SHA1 Message Date
Kristina Hanicova
78744415fe tests: add case for pvpanic-pci without address
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2023-02-21 17:51:28 +01:00
Kristina Hanicova
f4367059d2 tests: add test cases for device pvpanic-pci
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2023-02-21 17:51:24 +01:00
Martin Kletzander
1c61bd718a Support multiple watchdog devices
This is already possible with qemu, and actually already happening with
q35 machines and a specified watchdog since q35 already includes a
watchdog we do not include in the XML.  In order to express such
posibility multiple watchdogs need to be supported.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-01-26 16:40:30 +01:00
zhenwei pi
7ba22d21a1 conf: introduce crypto device
Introduce crypto device like:

  <crypto model='virtio' type='qemu'>
    <backend model='builtin' queues='1'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
  </crypto>

  <crypto model='virtio' type='qemu'>
    <backend model='lkcf'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
  </crypto>

Currently, crypto model supports virtio only, type supports qemu only
(vhost-user in the plan). For the qemu type, backend supports modle
builtin/lkcf, and the queues is optional.

Changes in this commit:
- docs: formatdomain.rst
- schemas: domaincommon.rng
- conf: crypto related domain conf
- qemu: crypto related
- tests: crypto related test

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-01-25 16:00:42 +01:00
Laine Stump
a8ee7ae301 conf: parse/format passt-related XML additions
This implements XML config to represent a subset of the features
supported by 'passt' (https://passt.top), which is an alternative
backend for emulated network devices that requires no elevated
privileges (similar to slirp, but "better").

Along with setting the backend to use passt (via <backend
type='passt'/> when the interface type='user'), we also support
passt's --log-file and --interface options (via the <backend>
subelement logFile and upstream attributes) and its --tcp-ports and
--udp-ports options (which selectively forward incoming connections to
the host on to the guest) via the new <portForward> subelement of
<interface>. Here is an example of the config for a network interface
that uses passt to connect:

    <interface type='user'>
      <mac address='52:54:00:a8:33:fc'/>
      <ip address='192.168.221.122' family='ipv4'/>
      <model type='virtio'/>
      <backend type='passt' logFile='/tmp/xyzzy.log' upstream='eth0'/>
      <portForward address='10.0.0.1' proto='tcp' dev='eth0'>
        <range start='2022' to='22'/>
        <range start='5000' end='5099' to='1000'/>
        <range start='5010' end='5029' exclude='yes'/>
      </portForward>
      <portForward proto='udp'>
        <range start='10101'/>
      </portForward>
    </interface>

In this case:

* the guest will be offered address 192.168.221.122 for its interface
  via DHCP

* the passt process will write all log messages to /tmp/xyzzy.log

* routes to the outside for the guest will be derived from the
  addresses and routes associated with the host interface "eth0".

* incoming tcp port 2022 to the host will be forwarded to port 22
  on the guest.

* incoming tcp ports 5000-5099 (with the exception of ports 5010-5029)
  to the host will be forwarded to port 1000-1099 on the guest.

* incoming udp packets on port 10101 will be forwarded (unchanged) to
  the guest.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2023-01-09 14:24:27 -05:00
Peter Krempa
fe6077585e qemuxml2*test: Enable testing of disks with 'fdgroup'
Enable the qemuxml2xml variant and add output data for qemuxml2argvtest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2023-01-09 14:59:43 +01:00
Peter Krempa
608c4b249e qemuxml2xmltest: Remove 'disk-backing-chain' case and output files
The test is superseded by 'disk-backing-chains-(no)index' cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2023-01-06 15:31:16 +01:00
Ján Tomko
ad3f33a992 qemu: add external backend for tpm
Introduce a new backend type 'external' for connecting to a swtpm daemon
not managed by libvirtd.

Mostly in one commit, thanks to -Wswitch and the way we generate
capabilities.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-12-19 10:33:20 +01:00
Lin Yang
facadf2491 conf: Introduce SGX EPC element into device memory xml
<devices>
  ...
  <memory model='sgx-epc'>
    <source>
      <nodemask>0-1</nodemask>
    </source>
    <target>
      <size unit='KiB'>512</size>
      <node>0</node>
    </target>
  </memory>
  ...
</devices>

Signed-off-by: Lin Yang <lin.a.yang@intel.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Haibin Huang <haibin.huang@intel.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-11-11 14:06:34 +01:00
Michal Privoznik
69eeea5d92 qemu: Assume QEMU_CAPS_VIRTIO_NET_FAILOVER
Introduced in QEMU's commit of v4.2.0-rc0~23^2~4 the .failover
attribute of virtio-net device is always available for all QEMU
versions we support (4.2.0, currently). Therefore, we can assume
the capability is always set and thus doesn't need to be checked
for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
2eab78d5f5 qemu: Assume QEMU_CAPS_VIRTIO_NET_HOST_MTU
Introduced in QEMU's commit of v2.9.0-rc0~162^2~10 the .host_mtu
attribute of virtio-net device is always available for all QEMU
versions we support (4.2.0, currently). Therefore, we can assume
the capability is always set and thus doesn't need to be checked
for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
ed8696549d qemu: Assume QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE
Introduced in QEMU's commit of v2.10.0-rc0~95^2~20 the
.tx_queue_size attribute of virtio-net device is always available
for all QEMU versions we support (4.2.0, currently). Therefore,
we can assume the capability is always set and thus doesn't need
to be checked for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
7fd8465187 qemu: Assume QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE
Introduced in QEMU's commit of v2.8.0-rc0~116^2~26 the
.rx_queue_size attribute of virtio-net device is always available
for all QEMU versions we support (4.2.0, currently). Therefore,
we can assume the capability is always set and thus doesn't need
to be checked for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
8bf50fa018 qemu: Assume QEMU_CAPS_NUMA
Introduced in QEMU's commit of v3.0.0-rc0~124^2~1 the
set-numa-node command is always available for all QEMU versions
we support (4.2.0, currently). Therefore, we can assume the
capability is always set and thus doesn't need to be checked for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
8641fcfa63 qemu: Assume QEMU_CAPS_OBJECT_MEMORY_FILE
Introduced in QEMU's commit of v2.1.0-rc0~41^2~26 only for Linux,
and later in v3.1.0-rc0~71^2~10 for all POSIX, the
memory-backend-file is going to be present for all QEMU versions
we support (4.2.0, currently). Therefore, we can assume the
capability is always set and thus doesn't need to be checked for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Michal Privoznik
fbbae04214 qemu: Assume QEMU_CAPS_OBJECT_MEMORY_RAM
Introduced in QEMU's commit of v2.1.0-rc0~41^2~104 the
memory-backend-ram is going to be present for all QEMU versions
we support (4.2.0, currently). Therefore, we can assume the
capability is always set and thus doesn't need to be checked for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Michal Privoznik
682dd480ac qemuxml2xmltest: Convert hugepages related tests to _CAPS_LATEST
Currently, we have maybe a dozen tests for hugepages related stuff in
qemuxml2xmltest. In all cases DO_TEST() is used, which means we have to
enumerate all capabilities needed (though, it's usually just
QEMU_CAPS_OBJECT_MEMORY_RAM and QEMU_CAPS_OBJECT_MEMORY_FILE,
exceptionally QEMU_CAPS_DEVICE_PC_DIMM too).

Instead of deleting the caps flags one-by-one, just switch the
tests to use DO_CAPS_LATEST().

Since some of our expected output files are just a symlink to their
respective input files, these are changed too. But from QEMU's
POV nothing changes as no .args file is changed.

Oh, and I'm also adding a 'hugepages-memaccess3' test case, which
was missing, surprisingly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Ján Tomko
0662e6bd36 qemu: Assume QEMU_CAPS_CCW
Introduced in libvirt by:
  commit f245a9791c
    qemu: introduce capability for virtual-css-bridge

Which mentions that its support was in QEMU 2.7.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-03 19:46:42 +02:00
Ján Tomko
b02568f1be qemu: Assume QEMU_CAPS_CCW_CSSID_UNRESTRICTED
This capability was introduced by libvirt commit:
  commit 263e65fd20
      qemu: introduce vfio-ccw capability

It probes for the cssid-unrestricted property of
virtual-css-bridge, which was introduced in QEMU v2.12 by:
  commit 99577c492fb2916165ed9bc215f058877f0a4106
      s390x/css: unrestrict cssids

Since we bumped the minimum QEMU version to 4.2.0, assume
this property is always present.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-03 19:46:42 +02:00
Ján Tomko
72768bde3d qemu: assume QEMU_CAPS_CHARDEV_LOGFILE
Introduced in QEMU 2.6

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Peter Krempa
ec91195ead qemuxml2xmltest: Convert all test cases asserting QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY
Turn them into DO_TEST_CAPS_LATEST tests so that we are closer to real
world.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
517ca3c46a qemuxml2*test: Remove 'q35-virtio-pci' test case
As noted by the comments the only difference was the qemu capabilities
asserted. Now that we use only real caps for this test case it makes no
sense to have two copies.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
a7669aa119 qemuxml2*test: Use QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL for macos hfv tests
Switch from QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY to
QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL as it has no impact on the test
output.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Ján Tomko
6b4c1e010e qemu: always assume QEMU_CAPS_*_HOLE64_SIZE
Introduced back in 2013 by QEMU commit:
  commit 398489018183d613306ab022653552247d93919f

      pc: limit 64 bit hole to 2G by default

Released in 1.6.0

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-22 14:45:04 +02:00
Ján Tomko
c80b10e88f qemu: always assume QEMU_CAPS_VIRTIO_TX_ALG
Introduced back in 2010 by QEMU commit:
  commit a697a334b3c4d3250e6420f5d38550ea10eb5319
      virtio-net: Introduce a new bottom half packet TX

Released in QEMU 0.14.0

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-08-11 18:34:47 +02:00
Ján Tomko
9a23c55b04 tests: qemuxml2xmltest: remove interface from disk test
There is no need to specify an interface for a disk test.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-08-11 18:34:47 +02:00
Peter Krempa
8eae01ba28 qemuxml2xmltest: Modernize all test cases using QEMU_CAPS_QCOW2_LUKS
Modernize 'disk-nvme', 'encrypted-disk-usage', 'encrypted-disk', and
'user-aliases' cases to use DO_TEST_CAPS_LATEST.

This will remove all uses of QEMU_CAPS_QCOW2_LUKS from the test suite.

Since the output files are done via symlinks to input files, the input
files need to be modernized with few auto-added XML bits.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
95215e6b79 qemuxml2(argv|xml)test: Remove use of QEMU_CAPS_AUDIODEV in fake-caps tests
The code no longer uses the capability so the tests don't need to assert
it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
88dbfabd4e qemuxml2(argv|xml)test: Remove 'qemu-4.1' variant of 'x86-kvm-32-on-64'
Upcoming patches will bump minimum qemu version to 4.2. In this case we
the 'latest' case is sufficient as with qemu-4.2 we already behave as
upstream ('qemu64' cpu is used instead of 'qemu32').

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Michal Privoznik
303636e7d0 qemuxml2xmltest: Test memory-hotplug-dimm-addr
After previous commit, when memory-hotplug-dimm-addr.xml file was
fixed, we can also introduce the test case to qemuxml2xmltest.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-01 10:36:11 +02:00
Daniel P. Berrangé
578ac25c6a conf: support stateless UEFI firmware
Normally when an UEFI firmware is marked as read-only, an associated
NVRAM file will be created. Some builds of UEFI firmware, however, wish
to remain stateless and so will be read-only, but never have any NVRAM
file. To represent this concept a 'stateless' tristate bool attribute
is introduced on the <loader/> element.

There are rather a large number of permutations to consider.

With default firmware selection

  *  <os/>

     => Historic default, no change

  *  <os>
       <loader stateless='yes'/>
     </os>

     => Explicit version of historic default, no change

  *  <os>
       <loader stateless='no'/>
     </os>

      => Invalid, bios is always stateless

With manual legacy BIOS selection

  *  <os>
       <loader>/path/to/seabios</loader>
       ...
     </os>

     => Historic default, no change

  *  <os>
       <loader stateless='yes'>/path/to/seabios</loader>
       ...
     </os>

     => Explicit version of historic default, no change

  *  <os>
       <loader stateless='no'>/path/to/seabios</loader>
       ...
     </os>

      => Invalid, bios is always stateless

With manual UEFI selection

  *  <os>
       <loader type='pflash'>/path/to/edk2</loader>
       ...
     </os>

     => Historic default, no change

  *  <os>
       <loader type='pflash' stateless='yes'>/path/to/edk2</loader>
       ...
     </os>

     => Skip auto-filling NVRAM / template

  *  <os>
       <loader type='pflash' stateless='no'>/path/to/edk2</loader>
       ...
     </os>

     => Explicit version of historic default, no change

With automatic firmware selection

  *  <os firmware='bios'/>

     => Historic default, no change

  *  <os firmware='bios'>
       <loader stateless='yes'/>
     </os>

     => Explicit version of historic default, no change

  *  <os firmware='bios'>
       <loader stateless='no'/>
     </os>

      => Invalid, bios is always stateless

  *  <os firmware='uefi'/>

     => Historic default, no change

  *  <os firmware='uefi'>
       <loader stateless='yes'/>
     </os>

     => Skip auto-filling NVRAM / template

  *  <os firmware='uefi'>
       <loader stateless='no'/>
     </os>

     => Explicit version of historic default, no change

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-07-26 15:41:44 +01:00
Jonathon Jongsma
62ca300530 util: remove virObjectUnref() adapters
These wrapper functions were used to adapt the virObjectUnref() function
signature for different callbacks. But in commit 0d184072, the
virObjectUnref() function was changed to return a void instead of a
bool, so these adapters are no longer necessary.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-07-15 16:44:39 -05:00
Michal Privoznik
94ae42fd25 tests: Update hostdev-usb-* hostdev-pci-* xml2xml and xml2argv tests
Currently, we have bunch of PCI/USB tests cases for
qemuxml2argvtest and qemuxml2xmltest but all of them run without
any capabilities. This makes is needlessly complicated when
trying to extend them. Switch to DO_TEST_CAPS_LATEST().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-13 15:42:08 +02:00
Peter Krempa
dcd30a3bf3 qemuxml2(argv|xml)test: Drop qemu-3.1 version of 'cpu-Icelake-Server-pconfig'
Prior to qemu-3.2 we'd have to disable the 'pconfig' feature explicitly
which is no longer needed with new qemu. Remove the version locked to
qemu-3.1 as the 'latest' case sufficiently handles what we want to test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-11 12:48:28 +02:00
Andrea Bolognani
1afc026c73 tests: Add more firmware tests
Note that some of these new tests are displaying incorrect or
suboptimal behavior. When we address those in upcoming patches,
this will be highlighted by changes in the test data.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:16 +02:00
Andrea Bolognani
f29a8bcef1 tests: Rename and reorganize firmware tests
Group all tests related to firmware selection together and give
them consistent names that leave room for further tests to be
added in an upcoming commit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:10 +02:00
Andrea Bolognani
acb8733924 tests: Drop bios-nvram-os-interleave test
This was introduced in

  commit 5882064084
  Author: Martin Kletzander <mkletzan@redhat.com>
  Date:   Wed Feb 25 15:45:26 2015 +0100

    tests: Add test for os interleaving

to ensure a recent change in the schema was behaving correctly.

Seven years later, it no longer seems very useful to keep it
around.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:09 +02:00
Peng Liang
48e8c36b05 tests: Remove unused includes
Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-06-16 06:43:58 +02:00
Rohit Kumar
d762abfe3f Add unit tests for new specification of nvram.
This patch adds unit tests for remote NVRAM.

Examples:

<nvram type='network'>
  <source protocol='iscsi' name='iqn.2013-07.com.example:iscsi-nopool/0'>
    <host name='example.com' port='6000'/>
    <auth username='myname'>
      <secret type='iscsi' usage='mycluster_myname'/>
    </auth>
  </source>
</nvram>

and

<nvram type='network'>
  <source protocol='nbd' name='bar'>
    <host name='example.org' port='6000'/>
  </source>
</nvram>

and

<nvram type='file'>
  <source file='/var/lib/libvirt/nvram/guest_VARS.fd'/>
</nvram>

Signed-off-by: Prerna Saxena <prerna.saxena@nutanix.com>
Signed-off-by: Florian Schmidt <flosch@nutanix.com>
Signed-off-by: Rohit Kumar <rohit.kumar3@nutanix.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Rohit Kumar <rohit.kumar3@nutanix.com>
2022-06-14 15:53:11 +02:00
Michal Privoznik
568503edf1 conf: Introduce thread_pool_min and thread_pool_max attributes to IOThread
At least in case of QEMU an IOThread is actually a pool of
threads (see iothread_set_aio_context_params() in QEMU's code
base). As such, it can have minimal and maximal number of worker
threads. Allow setting them in domain XML.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-06-10 13:59:46 +02:00
Daniel Henrique Barboza
316de7eb12 cpu_ppc64: add support for host-model on POWER10
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2022-05-24 14:25:41 -03:00
Daniel Henrique Barboza
eca2a6cc92 qemuxml2xmltests.c: convert pseries tests to DO_TEST_CAPS_ARCH_LATEST
qemuxml2xmltests that have "pseries" in the name now use the
DO_TEST_CAPS_LATEST_ARCH() macro.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2022-05-23 19:19:16 -03:00
Marc-André Lureau
7648e40da5 conf: add <serial type='dbus'>
Like a Spice port, a dbus serial must specify an associated channel name.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-05-19 12:36:35 +02:00
Marc-André Lureau
a062f5f777 conf: add <audio type='dbus'> support
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-05-19 12:36:28 +02:00
Marc-André Lureau
88ba34f5a0 conf: add <graphics type='dbus'>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-05-19 12:36:09 +02:00
Peter Krempa
d53e75aad0 conf: Introduce 'absolute' clock offset
The 'absolute' clock offset type has a 'start' attribute which is an
unix epoch timestamp to which the hardware clock is always set at start
of the VM.

This is useful if some VM needs to be kept set to an arbitrary time for
e.g. testing or working around broken software.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-05-17 19:30:59 +02:00
Andrea Bolognani
a6ea77e0a5 tests: Introduce smm=off test
This complements the existing smm=on tests. Looking at the output
files, one can immediately see how this case is currently not being
handled correctly. We're going to fix that in the next commit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-05-16 14:29:09 +02:00
Andrea Bolognani
dd3258da09 tests: Update smm=on test
Use DO_TEST_CAPS_LATEST() instead of hardcoding capabilities and
add the xml2xml part, which was missing; finally, rename it to
accomodate the complementary smm=off test that we're about to
introduce.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-05-16 14:29:04 +02:00
Martin Kletzander
90d36d625e tests: Adjust for invalid qemu command combinations
Everything spice is not supported (and does not make sense) without spice
graphics.  For some tests I also added cirrus VGA capability so that the XML
stays simple and libvirt can guess a default video model rather than adding too
much of an irrelevant XML into the individual tests.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-05-12 10:20:36 +02:00
Martin Kletzander
d00e51e10c Remove serial-spiceport-nospice test
This old test was added by me to allow people to keep the spicevmc
channel while changing graphics type from spice to something else.
However we do not do this in other places and also now we have all the
Validate functions so it is better to show the user they will not have
the spicevmc channel available rather than simply not formatting it on
the qemu command line.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-05-12 10:20:36 +02:00
Jonathon Jongsma
2ba73a10fd qemu: add support for qemu-vdagent channel
Implement the qemu-vdagent channel introduced in the previous commit.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-10 11:00:16 -05:00
Peter Krempa
f0c3398bc4 tests: qemuxml2*: Add testing of authenticated http/ftp disks
Extend the 'disk-cdrom-network' to cover this instance. This also
validates that the parameters of -blockdev conform to the QAPI schema.

Also add the xml2xml variant of this test case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-25 16:34:59 +02:00
Andrea Bolognani
519a2c5577 qemu: Assume QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT
All QEMU versions we support have this feature.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-19 15:43:17 +02:00
Andrew Melnychenko
a8b1cbe77e domain_conf: Add configs for virtio net RSS and Hash report.
Added "rss" and "rss_hash_report" configuration that should be
used with qemu virtio RSS. Both options are triswitches. Used as
"driver" options and affects only NIC with model type "virtio".
In other patches - options should turn on virtio-net RSS and hash
properties.

Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:36:27 +02:00
Andrea Bolognani
428ba3608a tests: Add test cases for virtio-iommu
These represent valid uses of the device.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
Peter Krempa
e6d1ed4a76 conf: Add support for setting expected TLS hostname for NBD disks
In cases when the hostname of the NBD server doesn't match the hostname
in the TLS certificate the new attribute 'tlsHostname' can be used to
override it.

Add the XML infrastructure and tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 15:17:06 +01:00
Jonathon Jongsma
a5e659f071 qemu: support multiqueue for vdpa net device
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2024406

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-03-09 16:23:02 -06:00
Peter Krempa
e51c0ac891 qemuxml2xmltest: Remove unnecessary versioned invocation of 'disk-cache'
The 'disk-cache' output file is identical in the interesting parts
(everything besides CPU config) to the '-latest' version, so the
versioned invocation can be dropped.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 09:45:28 +01:00
Daniel P. Berrangé
7714034ecd qemu: add tests for the ISA debug console command line
The XML-to-XML test validates that we don't accidentally copy the
isa-debug <serial> into a <console>.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-03 10:59:03 +00:00
Andrea Bolognani
299d48d574 tests: Add HVF test cases
We need to use a hardcoded list of capabilities because we don't
yet have proper replies files obtained from QEMU running on actual
macOS machines.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:54:44 +01:00
Andrea Bolognani
ebb921cb37 tests: Add macOS support to qemuxml2*test
The new DO_TEST_MACOS() macro makes it possible to create test
cases that verify the behavior of libvirt on a macOS machine
with HVF support available.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:54:44 +01:00
Peter Krempa
49a85978b7 qemu: capabilities: Retire QEMU_CAPS_QXL_MAX_OUTPUTS and QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS
Both are supported by qemu-2.11 and later, so we don't have to check for
them explicitly.

Note that QXL is supported only on x86_64, thus on other arches only the
capability for 'virtio-gpu' is removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-19 16:54:32 +01:00
Ján Tomko
711f593566 conf: reject unfiltered sgio on validation
No kernels supported by upstream libvirt have the feature.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 13:57:59 +01:00
Peter Krempa
239a6f6954 qemuxml2(xml|argv)test: Test real state of things with 'x86-kvm-32-on-64'
As demonstrated by the qemuxml2xmltest DO_TEST_CAPS_LATEST data based on
the 'x86-kvm-32-on-64' test case the post parse CPU selection code which
fills in the CPU into the definition does not have exactly the same
logic as we used to have when the cpu model was picked when formatting
the commandline.

Change the qemuxml2argv test to use DO_TEST_CAPS_LATEST too as it
doesn't really make sense to test this on fake data.

In addition to 'latest' versions, this also adds second invocation
locked to qemu-4.1.0 which demonstrates the old behaviour.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-07 09:25:14 +01:00
Peter Krempa
ee12bd7b8a qemuxml2(argv|xml)test: Unify usage of DO_TEST_CAPS_LATEST
The qemuxml2argv invocation of some tests used DO_TEST_CAPS_LATEST while
the qemuxml2xmltest invocation uses fake caps. Unify them on
DO_TEST_CAPS_LATEST.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-07 09:25:14 +01:00
Peter Krempa
c05dc2851c qemuxml2(argv|xml)test: Enable 'controller-usb-order' for qemuxml2argv and convert it to latest caps
Since introduction in fc03eb53c0 there wasn't a qemuxml2argv
version. As we are touching the files convert them to
DO_TEST_CAPS_LATEST directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-07 09:25:14 +01:00
Peter Krempa
22184d6631 qemuxml2xmltest: Replace 'interface-server' by 'net-server' test case
According to commit 5222256849 the test case was added to verify that
the '<address>' element is covered by the schema. The test was not
registered for qemuxml2argvtest though. We can use 'net-server' instead
as it has the same type. On the other hand that one was not registered
for qemuxml2xmltest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-07 09:25:14 +01:00
Michal Privoznik
d00e6dfe6b qemuxml2xmltest: Introduce tpm-emulator-spapr test
We already have the input xml because of xml2arg test. However,
the corresponding xml2xml test case is missing. Make the expected
XML a symlink to the input XML and clean the latter up a bit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-01-04 09:43:35 +01:00
Tim Wiederhake
565524fb5f tests: Add tests for hyperv-passthrough
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-12-14 16:50:45 +01:00
Michal Privoznik
f106788069 conf: Introduce TCG domain features
It may come handy to be able to tweak TCG options, in this
specific case the size of translation block cache size (tb-size).
Since we can expect more knobs to tweak let's put them under
common element, like this:

  <domain>
    <features>
      <tcg>
        <tb-cache unit='MiB'>128</tb-cache>
      </tcg>
    </features>
  </domain>

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Kashyap Chamarthy <kchamart@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-12-13 17:01:02 +01:00
Michal Privoznik
3f390db2e2 qemuxml2argvtest: Introduce another numa-topology test
This test shows a bug we have: even though the XML says:

  <allocation mode='immediate'/>

there is no -mem-prealloc nor .prealloc=yes anywhere on the cmd
line. This will be fixed in the next commit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-22 12:27:19 +01:00
Ján Tomko
966e08ebef tests: qemuxml2xml: use latest caps for spice tests
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-11-04 14:37:15 +01:00
Ján Tomko
ee7a03bd55 tests: qemuxml2xmltest: move graphics-spice-timeout
Move the test closer to other graphics-spice tests.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-11-04 14:37:15 +01:00
Laine Stump
dba9893831 Revert "conf: introduce support for acpi-bridge-hotplug feature"
This reverts commit 7300ccc9b3.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
2021-10-25 23:18:41 -04:00
Laine Stump
ea373d6c07 Revert "qemuxml2xmltest: Convert all acpi-hotplug control related tests to DO_TEST_CAPS_LATEST"
This reverts commit da896d440c.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
2021-10-25 23:18:40 -04:00
Or Ozeri
59090adf63 qemu: add librbd encryption engine
rbd encryption is new in qemu 6.1.0.
This commit adds a new encryption engine property which
allows the user to use this new encryption engine.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-10-25 14:06:15 +02:00
Peter Krempa
fd2aed1ab5 qemuxml2xmltest: Remove 'panic-isa' case
The same test in regards to the 'panic' device is the 'panic-double'
case, thus panic-isa can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:00 +02:00
Peter Krempa
da896d440c qemuxml2xmltest: Convert all acpi-hotplug control related tests to DO_TEST_CAPS_LATEST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 09:41:22 +02:00
Ani Sinha
7300ccc9b3 conf: introduce support for acpi-bridge-hotplug feature
This change introduces a new libvirt sub-element <pci> under
<features> that can be used to configure all pci related features.
Currently the only sub-sub element supported by this sub-element is
'acpi-bridge-hotplug' as shown below:

<features>
  <pci>
    <acpi-bridge-hotplug state='on|off'/>
  </pci>
</features>

The above option is only available for the QEMU driver, for x86 guests
only. It is a global option, affecting all PCI bridge controllers on
the guest.

The 'acpi-bridge-hotplug' option enables or disables ACPI hotplug
support for cold-plugged pci bridges. Examples of bridges include the
PCI-PCI bridge (pci-bridge controller) for pc (i440fx) machinetypes,
or PCIe-PCI bridges and pcie-root-port controllers for q35
machinetypes.

For pc machinetypes in x86, this option has been available in QEMU
since version 2.1. Please see the following changes in qemu repo:

9e047b982452c6 ("piix4: add acpi pci hotplug support")
133a2da488062e ("pc: acpi: generate AML only for PCI0 devices if PCI
               bridge hotplug is disabled")

For q35 machinetypes, this was introduced in QEMU 6.1 with the
following changes in qemu repo:

(a) c0e427d6eb5fef ("hw/acpi/ich9: Enable ACPI PCI hot-plug")
(b) 17858a16950860 ("hw/acpi/ich9: Set ACPI PCI hot-plug as default on
                   Q35")

The reasons for enabling ACPI based hotplug for PCIe (q35) based
machines (as opposed to native hotplug) are outlined in (b). There are
use cases where users would still want to use native
hotplug. Therefore, this config option enables users to choose either
ACPI based hotplug or native hotplug for bridges (for example for pcie
root port controller in q35 machines).

Qemu capability validation checks have also been added along with
related unit tests to exercise the new conf option.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-10-10 13:13:45 -04:00
Ani Sinha
400979fd06 qemu: capabilities: remove -en from piix4-acpi-root-hotplug-en
The capability name piix4-acpi-root-hotplug-en is not conventional and
appreared to be confusing to some. "en" suffix is also incorrect as the
capability in qemu is used to both enable and disable hotplug on the pci root
bus on the i440fx. Hence, rename it to piix4.acpi-root-pci-hotplug so that it
is clearer, less confusing and more accurate.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-10-05 00:07:23 -04:00
Ani Sinha
8eadf82fb5 conf: introduce option to enable/disable pci hotplug on pci-root controller
This change introduces libvirt xml support to enable/disable hotplug on the
pci-root controller. It adds a 'target' subelement for the pci-root controller
with a 'hotplug' property. This property can be used to enable or disable
hotplug for the pci-root controller. For example, in order to disable hotplug
on the pci-root controller, one has to use set '<target hotplug='off'>' as
shown below:

<controller type='pci' model='pci-root'>
  <target hotplug='off'/>
</controller>

'<target hotplug='on'>' option would enable hotplug for pci-root controller.
This is also the default value. This option is only available for pc machine
types and is applicable for qemu/kvm accelerator only.This feature was
introduced from qemu version 5.2 with the following change in qemu repository:

3d7e78aa7777f ("Introduce a new flag for i440fx to disable PCI hotplug on the root bus")

The above qemu commit describes some reasons why users might to disable hotplug
on PCI root buses.

Related unit tests to exercise the new conf option has also been added.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-10-01 14:19:44 -04:00
Michal Privoznik
f931cb7f21 conf: Introduce virtio-mem <memory/> model
The virtio-mem is paravirtualized mechanism of adding/removing
memory to/from a VM. A virtio-mem-pci device is split into blocks
of equal size which are then exposed (all or only a requested
portion of them) to the guest kernel to use as regular memory.
Therefore, the device has two important attributes:

  1) block-size, which defines the size of a block
  2) requested-size, which defines how much memory (in bytes)
     is the device requested to expose to the guest.

The 'block-size' is configured on command line and immutable
throughout device's lifetime. The 'requested-size' can be set on
the command line too, but also is adjustable via monitor. In
fact, that is how management software places its requests to
change the memory allocation. If it wants to give more memory to
the guest it changes 'requested-size' to a bigger value, and if it
wants to shrink guest memory it changes the 'requested-size' to a
smaller value. Note, value of zero means that guest should
release all memory offered by the device. Of course, guest has to
cooperate. Therefore, there is a third attribute 'size' which is
read only and reflects how much memory the guest still has. This
can be different to 'requested-size', obviously. Because of name
clash, I've named it 'current' and it is dealt with in future
commits (it is a runtime information anyway).

In the backend, memory for virtio-mem is backed by usual objects:
memory-backend-{ram,file,memfd} and their size puts the cap on
the amount of memory that a virtio-mem device can offer to a
guest. But we are already able to express this info using <size/>
under <target/>.

Therefore, we need only two more elements to cover 'block-size'
and 'requested-size' attributes. This is the XML I've came up
with:

  <memory model='virtio-mem'>
    <source>
      <nodemask>1-3</nodemask>
      <pagesize unit='KiB'>2048</pagesize>
    </source>
    <target>
      <size unit='KiB'>2097152</size>
      <node>0</node>
      <block unit='KiB'>2048</block>
      <requested unit='KiB'>1048576</requested>
    </target>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
  </memory>

I hope by now it is obvious that:

  1) 'requested-size' must be an integer multiple of
     'block-size', and
  2) virtio-mem-pci device goes onto PCI bus and thus needs PCI
     address.

Then there is a limitation that the minimal 'block-size' is
transparent huge page size (I'll leave this without explanation).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-01 11:02:53 +02:00
Peter Krempa
686caa57e5 qemu: validate: Always assume QEMU_CAPS_SPICE_FILE_XFER_DISABLE
QEMU added the capability to disable file transfers via spice in commit
5ad24e5f3b ("spice: Add -spice disable-agent-file-transfer cmdline
option (rhbz#961850)") released in qemu-v1.6.0 and the option can't be
disabled.

Remove the unnecessary validation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-24 10:37:01 +02:00
Peter Krempa
22c681256b qemu: Assume QEMU_CAPS_FW_CFG
qemu supports this since 81b2b81062 ("fw_cfg: insert fw_cfg file blobs
via qemu cmdline") released in qemu-v2.4.0 and it can't be compiled out.

Assume that the option always works and remove the corresponding check.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:08 +02:00
Peter Krempa
9216090cf1 qemu: Always assume QEMU_CAPS_SPLASH_TIMEOUT
Supported since qemu commit 3d3b8303c6 ("showing a splash picture when
start") released in qemu-v1.0 and can't be compiled out.

Assume that it's present and remove the validation code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:07 +02:00
Peter Krempa
2b928f1c2d qemu: Always assume QEMU_CAPS_REBOOT_TIMEOUT
Supported since ac05f34924 ("add a boot parameter to set reboot
timeout") released in qemu-v1.3.0 and can't be compiled out.

Assume that it's present and remove the validation code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:07 +02:00
Hiroki Narukawa
32967b891e qemuxml2*test: Make disk-virtio-queues tests use DO_TEST_CAPS_LATEST
Currently disk-virtio-queues test is now using specifying a fake
capability.

By this commit this test will make use of DO_TEST_CAPS_LATEST.

Signed-off-by: Hiroki Narukawa <hnarukaw@yahoo-corp.jp>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-09-21 12:22:48 +02:00
Ján Tomko
e431293d74 tests: qemuxml2*test: switch to virTestRunLog
This essentially reverts:
commit ca5c8e1dc7
    qemuxml2argvtest: Avoid conditions in test macro

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-08-23 14:43:57 +02:00
Peter Krempa
510b951d9c qemuxml2xmltesttest: Avoid conditions in test macro
Pass a pointer to the 'ret' variable to the test executor itself and
update it there to improve compile times of the test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-08-18 10:20:49 +02:00
Peter Krempa
ca5c8e1dc7 qemuxml2argvtest: Avoid conditions in test macro
Pass a pointer to the 'ret' variable to the test executor itself and
update it there to improve compile times of the test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-08-18 10:20:49 +02:00
Peter Krempa
68bb5f9fa6 testutilsqemu: Improve error propagation from 'testQemuInfoSetArgs'
Previously we've ran into problems when 'testQemuInfoSetArgs' failed as
calling the actual test executor could lead to a crash if the data
wasn't prepared but reporting an error doesn't play nicely with our test
output which is handled by 'virTestRun'.

To avoid the issue (and as a side effect improve compilation times of
the test files) split up testQemuInfoSetArgs into two functions.

The first is still called 'testQemuInfoSetArgs' and just blindly
populates arguments into a sub-struct of testQemuInfo. This function no
longer reports errors

A new function 'testQemuInfoInitArgs' which is meant to be called from
the test executor then checks errors and prepares the test data. This
one can fail and the test will be marked as failed appropriately.

A nice side effect is that this vastly improves compile times of
qemuxml2xmltest and qemuxml2argvtest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-08-18 10:20:49 +02:00
Peter Krempa
92e0cd2620 testutilsqemu: Introduce struct to hold data valid for all test runs
We pass multiple caching objects to individual tests which don't change.
To prevent always having to pass them individually to
'testQemuInfoSetArgs' introduce 'struct testQemuConf' which will hold
all of them and just the struct will be passed to the tests.

Additionally this will make the conf available from inside the test run.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-08-18 10:20:49 +02:00
Peter Krempa
80340a199b qemuxml2xmltest: Remove 'NONE' macro
There's one last user. Use QEMU_CAPS_LAST explicitly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-08-18 10:20:49 +02:00
Peter Krempa
786c097b51 qemuxml2xmltest: Add 'DO_TEST_NOCAPS' to replace 'DO_TEST("blah", NONE);'
Add a explicit version of our test invocation macro for tests which use
no capabilities.

This reduces the usage of the somewhat anonymous 'NONE' macro and will
lead to simplification of the code later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-08-18 10:20:49 +02:00
Peter Krempa
1c2b04c0ac qemuxml2xmltest: Remove hack for qemuCaps allocation
Since qemuCaps are now always allocated we don't need to pass
ARG_QEMU_CAPS, QEMU_CAPS_LAST to force the allocation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-08-18 10:20:48 +02:00
Peter Krempa
7c63372ebc qemuxml2xmltest: Rename DO_TEST_INTERNAL to DO_TEST_FULL and fix users
'DO_TEST_FULL' isn't a useful wrapper any more. Use the better name for
the main macro and replace all uses.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-08-18 10:20:48 +02:00
Peter Krempa
d779279e1c qemuxml2xmltest: Add 'ARG_END' from higher level macros
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-08-18 10:20:48 +02:00
Andrea Bolognani
b298fc142f tests: Test pcie-expander-bus for aarch64/virt guests
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-08-04 09:58:16 +02:00
Michal Privoznik
c6d7b9a261 qemu: Don't use memory-backend-memfd for NVDIMMs
If guest is configured to use memfd then the function that build
memory-backend-* part of command line will put
memory-backend-memfd, always. Even for NVDIMMs. This is not
correct, because NVDIMMs need a backing path (usually to a real
host NVDIMM device). Therefore, regardless of memfd being
requested, we have to stick with memory-backend-file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2021-07-07 16:25:03 +02:00
Andrea Bolognani
7ad6f8dde0 tests: Add aarch64-tpm test to qemuxml2xml
We're going to change the input file later, and having this
additional coverage will demonstrate that such a change does not
alter the behavior.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Liu Yiding <liuyd.fnst@fujitsu.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-01 16:15:05 +02:00