Commit Graph

6502 Commits

Author SHA1 Message Date
Peter Krempa
37208d9d17 nwfilterxml2xmltest: Rename cases with XMLs not conforming to schema
There's quite a few negative tests. In anticipation of schema testing of
the 'nwfilterxml2xmlin' directory rename all negative/non-conformant
XMLs with the -invalid suffix.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-20 09:05:10 +02:00
Peter Krempa
f4aa549ea8 nwfilterxml2firewall: Fix schema compilance of 'tcp' test case
Fix the 'flags' of the last rule to conform to the RNG schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-20 09:05:10 +02:00
Peter Krempa
59d847b578 domainconfdata/getfilesystem.xml: Remove <init> element
The element is not needed for the test and doesn't conform to the domain
XML schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-20 09:05:10 +02:00
Peter Krempa
2dce8109f9 virschematest: Fix testing of 'nwfilter' xmls
The files are under 'src/nwfilter/xml'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-20 09:05:10 +02:00
Peter Krempa
57f1d5bb3b virschematest: Add coverage for 'examples/xml/test'
Add all appropriate file from our test driver example XML directory.

Note that the two 'node.*' files are actually custom for the test driver
to load full state. We don't have a schema for them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-20 09:05:10 +02:00
Peter Krempa
933b4b9980 virschematest: Add coverage for 'examples/xml/storage'
Match the correct subsets of the files via the 'dirRegex' property.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-20 09:05:10 +02:00
Peter Krempa
873d484190 virschematest: Add regex filtering for directory contents
In some cases we have directories with mixed XML files in the test
suite. Adding regex filtering will allow testing subsets of the XML
files against schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-20 09:05:10 +02:00
Peter Krempa
837633afb9 virschematest: Rewrite internals to allow increasing XML test coverage
To allow greater variablitity of XML schema validation tests without
needlessly reparsing the schema we need to refactor the internals to
pass in structs rather than just paths to directory.

This allows to directly implement testing of single files and will
simplify further additions such as filtering of the list of XML files in
a directory.

The list of tested paths is directly ported for now and will be improved
in follow-up patches.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-20 09:05:10 +02:00
Peter Krempa
8c67e389d6 qemuBlockExportAddNBD: Use 'block-export-add' when available
Switch to the new QMP command once it becomes available. Since the code
was refactored to have just one central location to do this we can
contain the ugly bits to just this one function.

Since we now use the replacement for 'nbd-server-add' mark the test case
as being OK with removal of the command.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-19 13:36:58 +02:00
Peter Krempa
f70e9c6cb8 qemu: Add infrastructure for 'block-export-add' to export NBD
Add the monitor code, corresponding generator of properties for NBD and
tests validating it against the schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-19 13:36:58 +02:00
Peter Krempa
adb9f7123a qemu: capabilities: Add QEMU_CAPS_BLOCK_EXPORT_ADD
The 'block-export-add' QMP command is a replacement for 'nbd-server-add'
and will allow greater flexibility. Add a capability so that we can
switch to it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-19 13:36:58 +02:00
Peter Krempa
2f451d8114 tests: qemucapabilities: Update capabilities for qemu-5.2 dev cycle
Update to commit v5.1.0-2207-g96292515c0

Recent changes include deprecation of 'nbd-server-add' and addition of
'block-export-add'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-19 13:36:58 +02:00
Peter Krempa
917d8a5390 qemumonitorjsontest: Allow deprecation of 'nbd-server-add' QMP command
qemu is going to deprecate this command in the next release. Allow this
as later patches will implement the use of replacement.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-19 13:36:58 +02:00
Peter Krempa
77064438d4 bhyve: parse: Set video device model when parsing bhyve commandline
Add the proper video device type when parsing bhyve's commandline into a
XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
2020-10-19 11:50:49 +02:00
Peter Krempa
296598ea40 bhyveargv2xmldata: Remove XML files for console2/3/4 test case
The test case is invoked using DO_TEST_FAIL so the XML files are
actually unexpected, unused and actually don't even conform to the RNG
schema for <domain>.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
2020-10-19 11:50:37 +02:00
Erik Skultety
2508d10f67 conf: domain: sev: Make 'cbitpos' & 'reducedPhysBits' attrs optional
These XML attributes have been mandatory since the introduction of SEV
support to libvirt. This design decision was based on QEMU's
requirement for these to be mandatory for migration purposes, as
differences in these values across platforms must result in the
pre-migration checks failing (not that migration with SEV works at the
time of this patch).

Expecting the user to specify these is cumbersome and the same XML
cannot be re-used across different revisions of SEV. Since
we have SEV platform information saved in QEMU capabilities, we can
make the attributes optional and should fill them in automatically
in the QEMU driver right before starting it.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/57

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-19 11:03:39 +02:00
Daniel Henrique Barboza
27371bd517 qemu_command.c: move QEMU_CAPS_DEVICE_NVDIMM_UNARMED check to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:33 -03:00
Daniel Henrique Barboza
0bf8dfb02a qemu_command.c: move 'panic' validation to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:33 -03:00
Daniel Henrique Barboza
d3dad77dd6 qemu_command.c: move usb_redir validations to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:33 -03:00
Daniel Henrique Barboza
eb42c1313f qemu_command.c: move SHMEM validation to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:33 -03:00
Daniel Henrique Barboza
c47b013992 qemu_command.c: move NUMA memory backing check to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:33 -03:00
Daniel Henrique Barboza
4b42c27ee7 qemu_command.c: move CPU mode check to qemu_validate.c
All but VIR_CPU_MODE_HOST_MODEL were moved. 'host_model' mode
has nuances that forbid the verification to be moved to parse
time.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:33 -03:00
Daniel Henrique Barboza
2d8a60fab1 qemu_command.c: move QEMU_CAPS_FW_CFG validation to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:27 -03:00
Daniel Henrique Barboza
f800aa3ee7 qemu_command.c: move RNG backend validation to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:50:34 -03:00
Daniel Henrique Barboza
03e4e4b21e qemu_command.c: move QEMU_CAPS_DEVICE_USB_KBD check to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:50:34 -03:00
Daniel Henrique Barboza
edee4290c9 qemu_command.c: move QEMU_CAPS_VIRTIO_NET_HOST_MTU check to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:50:34 -03:00
Daniel Henrique Barboza
53fa517082 qemu_command.c: move QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE check to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:50:34 -03:00
Daniel Henrique Barboza
78c6507473 qemu_command.c: move QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE check to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:50:26 -03:00
Daniel Henrique Barboza
37c6d4a62c qemu_command.c: move QEMU_CAPS_VIRTIO_TX_ALG check to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:01:49 -03:00
Daniel Henrique Barboza
a40659eb82 qemu_command.c: move DISK_BUS_USB validation to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:01:49 -03:00
Daniel Henrique Barboza
da1748cab1 qemu_command.c: move DISK_BUS_SATA validation to qemu_validate.c
A few tweaks were made during the move:

- the error messages were changed to mention 'sata controller'
instead of 'ide controller';

- a check for address type 'drive' was added like it is done
with other bus types. The error message of qemuxml2argdata was
updated to reflect that now, instead of erroring it out from the
common code in virDomainDiskDefValidate(), we're failing earlier
with a different error message.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 09:55:37 -03:00
Daniel Henrique Barboza
c9fbb07bab qemu_command.c: move LUN and IDE checks to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 09:45:34 -03:00
Daniel Henrique Barboza
ccb08c3818 qemu_command.c: move wwn validation to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 09:45:17 -03:00
Michal Privoznik
76db9e8bcd lib: s/free-page-reporting/freePageReporting/
In fee8a61d29 a new attribute to <memballoon/> was introduced:
free-page-reporting. We don't really like hyphens in attribute
names. Use camelCase instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-10-15 10:57:11 +02:00
Michal Privoznik
9ba99180b3 tests: Turn virtio-options-memballoon-freepage-reporting.xml into a symlink
The output virtio-options-memballoon-freepage-reporting.xml of
xml2xmlout is the same as the input. Make it as symlink to save
space.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-10-15 10:51:07 +02:00
Pino Toscano
2214fe9044 vmx: start parsing SATA disks
Always reverse-engineering VMX files, attempt to support SATA disks in
guests, and their controllers.

The esx-in-the-wild-10 test case is taken from RHBZ#1883588, while the
result of esx-in-the-wild-8 is updated with SATA disks.

Fixes (hopefully):
https://bugzilla.redhat.com/show_bug.cgi?id=1677608
https://bugzilla.redhat.com/show_bug.cgi?id=1883588

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-14 11:23:30 +02:00
Nico Pache
4cb5f34905 provide testing for free-page-reporting feature in QEMU
This provides basic testing for the free-page-reporting feature that is
introduced in qemu 5.1.

Signed-off-by: Nico Pache <npache@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-13 17:02:48 +02:00
Nico Pache
5032b247e9 QEMU: declare qemu capabilities for the Virtio Free page reporting feature
This patch will introduce the free-page-reporting feature capabilities
that are in qemu 5.1

Signed-off-by: Nico Pache <npache@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-13 17:02:42 +02:00
Michal Privoznik
0b66196d86 qemu: Set noqueue qdisc for TAP devices
By default, pfifo_fast queueing discipline (qdisc) is set on
newly created interfaces (including TAPs). This qdisc has three
queues and packets that want to be sent through given NIC are
placed into one of the queues based on TOS field. Queues are then
emptied based on their priority allowing interactive sessions
stay interactive whilst something else is downloading a large
file.

Obviously, this means that kernel has to be involved and some
locking has to happen (when placing packets into queues). If
virtualization is taken into account then the above algorithm
happens twice - once in the guest and the second time in the
host.

This is arguably not optimal as it burns host CPU cycles
needlessly. Guest already made it choice and sent packets in the
order it wants.

To resolve this, Linux kernel offers 'noqueue' qdisc which can be
applied on virtual interfaces and in fact for 'lo' it is by
default:

  lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue

Set it for other TAP devices we create for domains too. With this
change I was able to squeeze 1Mbps more from a macvtap attached
to a guest and to my 1Gbps LAN (as measured by iperf3).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1329644
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-13 16:31:29 +02:00
Roman Bogorodskiy
476bf54e86 bhyve: fix virtio-9p src/dst order
For the virtio-9p bhyve command line argument, the proper order
is mount_tag=/path/to/host/dir, not the opposite.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-12 15:24:21 +04:00
Roman Bogorodskiy
7382a7c2be bhyve: implement virtio-9p support
Recently virtio-9p support was added to bhyve.

On the host side it looks this way:

  bhyve .... -s 25:0,virtio-9p,sharename=/path/to/shared/dir

It could also have ",ro" suffix to make share read-only.

In the Linux guest, this share is mounted with:

  mount -t 9p sharename /mnt/sharename

In the guest user will see the same permissions and ownership
information for this directory as on the host. No uid/gid remapping is
supported, so those could resolve to wrong user or group names.

The same applies to the other side: chowning/chmodding in the guest will
set specified ownership and permissions on the host.

In libvirt domain XML it's modeled using the 'filesystem' element:

  <filesystem type='mount'>
    <source dir='/path/to/shared/dir'/>
    <target dir='sharename'/>
  </filesystem>

Optional 'readonly' sub-element enables read-only mode.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-09 18:46:04 +04:00
Pavel Hrdina
a9932fc292 tests: use g_autoptr for virCgroup
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2020-10-09 16:24:49 +02:00
Pavel Hrdina
5ad8272888 util: vircgroup: change virCgroupFree to take only virCgroupPtr
As preparation for g_autoptr() we need to change the function to take
only virCgroupPtr.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2020-10-09 16:24:35 +02:00
Tim Wiederhake
470dd74027 tests: Remove references to "cpu_map.xml" in the code
"cpu_map.xml" was moved to a directory "cpu_map" and split up into
several files.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2020-10-09 15:38:05 +02:00
Ján Tomko
19c7b50c94 tests: delete VIR_ALLOC tests cases
There are no more users of VIR_ALLOC or VIR_ALLOC_N.
Delete their test cases.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2020-10-08 19:19:22 +02:00
Ján Tomko
173e2e73bf tests: use g_new0 instead of VIR_ALLOC
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2020-10-08 19:19:22 +02:00
Roman Bolshakov
c3d02040ac tests: commandhelper: Accept POLLNVAL on macOS
commandhelper hangs indefinitely in poll() on macOS on commandtest test2
and later because POLLNVAL is returned on revents for input file
descriptor opened from /dev/null, i.e this hangs:

  $ tests/commandhelper < /dev/null
  BEGIN STDOUT
  BEGIN STDERR
  ^C

But it works fine with regular stdin:

  $ tests/commandhelper <<< test
  BEGIN STDOUT
  BEGIN STDERR
  test
  test
  END STDOUT
  END STDERR

The issue is mentioned in poll(2):

  BUGS
    The poll() system call currently does not support devices.

With the change all 28 cases in commandtest pass.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-10-08 17:04:08 +02:00
Michal Privoznik
0c8ab47847 qemu: Don't generate '-machine memory-backend' and '-numa memdev'
In 88957116c9 I've switched to -machine memory-backend=ID and
-object memory-backend-* because QEMU is obsoleting -mem-path
and -mem-prealloc. However, what I did not foresee was that using
-machine memory-backend in combination with -numa is not allowed
in QEMU. This was reported upstream and fortunately not released
yet.

The problem is that if domain has NUMA nodes then we will
generate memory-backend-* objects for NUMA nodes (because if QEMU
is new enough to expose default RAM ID it also supports -numa
memdev=) and adding non-NUMA memory backend is wrong.

Reported-by: Masayoshi Mizuma <msys.mizuma@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-08 12:55:10 +02:00
Jiri Denemark
3bf6f9fe22 cpu_map: Remove monitor feature from EPYC-Rome
The feature is filtered by KVM and never automatically enabled. So even
though QEMU definition of EPYC-Rome contains this feature, the guest
won't see it. Also domain capabilities will show it as disabled for KVM
domains. Thus the feature should not really be included in our
definition of EPYC-Rome.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2020-10-08 09:58:44 +02:00
Jiri Denemark
736b8637f6 cputest: Update QEMU data for Ryzen 9 3900X
The CPU should be identified as EPYC-Rome, but the QEMU binary used to
gather the original test data did not support this model. Let's update
the supported models to QEMU 5.1.0.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-07 18:42:17 +02:00