Commit Graph

6477 Commits

Author SHA1 Message Date
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
Markus Schade
f941639f86 cpu_map: Defined and enable EPYC-Rome model
Signed-off-by: Markus Schade <markus.schade@hetzner.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2020-10-07 17:30:54 +02:00
Markus Schade
e06590f170 Add testdata for AMD EPYC 7502
Signed-off-by: Markus Schade <markus.schade@hetzner.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2020-10-07 17:25:02 +02:00
Tim Wiederhake
676396ba5b tests: Rename some test files in cputestdata
The files contained the "-invalid" marker in their filename, marking
them as test cases that are supposed to fail in the virschematest.
Unfortunately, the "-invalid" marker does not discriminate between
different tests the files might be used in.

A later patch will introduce a new test validating the XML. This
test is not supposed to fail, as the files contain valid XML.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2020-10-07 11:26:37 +02:00
Tim Wiederhake
4c3ed3b84e cpu: Wire in XML validation
This adds a new value to virConnectCompareCPUFlags,
"VIR_CONNECT_CPU_VALIDATE_XML", that governs XML document validation in
virCPUDefParseXML.

In src/conf/cpu_conf.c, include configmake.h for PKGDATADIR and
virfile.h for virFileFindResource.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2020-10-07 11:26:27 +02:00
Cole Robinson
14f877e8d0 tests: cover disk, interface <backenddomain>
There is present no XML test coverage for this.
Add genericxml parse + formatting coverage.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-10-05 12:43:00 -04:00
Peter Krempa
cb6fdb0125 virBitmapNew: Don't check return value
Remove return value check from all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-10-05 15:38:47 +02:00
Peter Krempa
bab5a79d6a util: bitamp: Remove virBitmapNewEmpty
It can be replaced by virBitmapNew(0).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-10-05 15:38:47 +02:00
Peter Krempa
f054317a0b virbitmaptest: Remove unnecessary error/cleanup labels
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-10-05 15:38:47 +02:00
Peter Krempa
05e82621e0 virbitmaptest: Use g_auto(free) for cleanup
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-10-05 15:38:47 +02:00
Peter Krempa
297fc39a2d virbitmaptest: Refactor checks in 'test6'
The 'checkBitmap' helper uses 'virBitmapFormat' internally and also
reports better errors. Use it instead of the open-coded checks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-10-05 15:38:47 +02:00
Peter Krempa
0128fe1411 virbitmaptest: Turn 'TEST_MAP' macro into a helper function
The function will also be reusable in other places of the code by making
the size check optional. For now only test12* is refactored since it
used TEST_MAP directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-10-05 15:38:47 +02:00
Peter Krempa
7a1bc02be9 virbitmaptest: Use separate output strings in 'test5'
The test validates two outputs. Don't reuse 'str' for both.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-10-05 15:38:47 +02:00
Peter Krempa
5e309e82a7 virbitmaptest: Split up test4
'test4' was testing three distinct operations on separate instances of a
bitmap. Split it up into 'test4a', 'test4b' and 'test4c' so that the
'bitmap' variable is not reused.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-10-05 15:38:47 +02:00
Peter Krempa
110b95d573 virbitmaptest: Split up test12
'test12' was testing two distinct operations on two instances of a
bitmap. Split it up into 'test12a' and 'test12b' so that the 'bitmap'
variable is not reused.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-10-05 15:38:47 +02:00
Peter Krempa
6d6480c462 virbitmaptest: Add few more cases for virBitmapToString
Test an empty bitmap including it's extension via the self-expanding
APIs and and a "0" and "" strings when converting the string back and
forth.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-10-05 12:57:46 +02:00
Peter Krempa
5642508732 virbitmaptest: test13: Refactor memory cleanup
Move scope of variables and get rid of the 'cleanup' section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-10-05 12:26:22 +02:00
Peter Krempa
8efad320fa virBitmapToString: Remove unused 'prefix' and 'trim' arguments
There's only one combination used so we can remove the rest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-10-05 12:26:22 +02:00
Daniel P. Berrangé
9c1dc67403 tests: fix misc spelling errors reported by codespell
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-10-05 10:28:43 +01:00
Michal Privoznik
053beeb04d virfirewalltest: Don't duplicate string when adding it onto stringlist
In our wrapper of g_dbus_connection_call_sync() in
virfirewalltest a string is duplicated and added onto a
virStringList. This leads to a memory leak because
virStringListAdd() duplicates the string itself.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2020-10-02 12:48:55 +02:00
Michal Privoznik
2c4ebab4f5 tests: Set G_DEBUG environment variable
With us switching to glib more and more it is easy to get things
wrong (as can be seen in the previous commit). Set G_DEBUG
variable to "fatal-warnings" which causes GLib to abort the
program at the first call to g_warning() or g_critical().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2020-10-02 12:48:55 +02:00
Pavel Hrdina
48622bb563 tests: fix incorrect free of GVariant in our GLib mock functions
GLib implementation of g_dbus_connection_call_sync() calls
g_variant_ref_sink() on the passed @parameters to make sure they have
proper reference. If the original reference is floating the
g_dbus_connection_call_sync() consumes it, but if it's normal reference
it will just add another one.

Our mock functions were only freeing the @parameters which is incorrect
and doesn't reflect how the real implementation works.

Reported-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-02 12:43:15 +02:00
Michal Privoznik
9a4568b079 qemuxml2xmloutdata: Make more symlinks
I've found two files under qemuxml2xmloutdata/ that are the same
as in qemuxml2argvdata/. Replace them with symlinks.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-10-01 14:53:28 +02:00
Michal Privoznik
88957116c9 qemu: Use memory-backend-* for regular guest memory
So far, Libvirt configures memory-backend-* for memory hotplug,
possibly NUMA nodes and in a few other cases. This patch
switches to constructing the memory-backend-* command line for
all cases. To keep ability to migrate guests a little hack is
used: the ID of the object is set to the one that QEMU uses
internally anyways. These IDs are stable (first started to appear
somewhere around v0.13.0-rc0~96) and can't change.

In fact, this patch does exactly what QEMU does internally. The
reason for moving the logic into Libvirt is that QEMU wants to
deprecate the old style of specifying memory.

So far, only x84_64 test cases are changed, because tests for
other architectures use older capabilities, which still lack the
QEMU_CAPS_MACHINE_MEMORY_BACKEND capability and they don't report
the RAM ID.

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

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-01 12:06:22 +02:00
Michal Privoznik
b647654cbb qemu: Track default-ram-id machine attribute
The machine structure has another (optional) attribute:
default-ram-id, which specifies the alias of the default RAM
object. While the alias is private, it can never change in order
to not break migration. QEMU uses the alias when allocating
regular, not NUMA memory. In order to switch to new command line
and maintain migration, save this ID.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-01 12:04:48 +02:00
Michal Privoznik
eda5cc7a62 qemuBuildMemoryBackendProps: Move @prealloc setting to backend agnostic part
All three memory backends (-file, -ram and -memfd) have .prealloc
attribute. Since we are setting it only for -file, the
corresponding code lives only under if() that handles that
specific backend. But in near future we will want to set the
attribute for other backends too. Therefore, move the
corresponding code outside of the if().

This causes some .argv files to be changed, but the only change
happening there is move of the attribute (best viewed with:
'git show --color-words=.').

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-01 12:01:31 +02:00