Commit Graph

3703 Commits

Author SHA1 Message Date
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
Pavel Hrdina
26d21e5de8 tests: update QEMU 2.9.0 caps data to final version
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-04-26 19:34:25 +02:00
Daniel P. Berrange
02fb15fb60 util: switch over to use keycodemapdb GIT submodule
A long time ago we imported the keymaps.csv file from GTK-VNC so we
can do conversions between keycode sets. Meanwhile lots of bug fixes
have gone into this CSV file and libvirt hasn't kept in sync. The
keymaps.csv file and associated generator script has been pulled out
of GTK-VNC into a dedicated GIT repo for use as a submodule. This
allows GTK-VNC, SPICE-GTK, QEMU and libvirt to share the same master
database and tools and pushing updates merely requires a submodule
commit update as with gnulib.

The test suite is updated to cover some extra boundary conditions.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-04-25 21:14:18 +01:00
Martin Kletzander
fcef44728d Set coalesce settings for domain interfaces
This patch makes use of the virNetDevSetCoalesce() function to make
appropriate settings effective for devices that support them.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-04-21 13:35:04 +02:00
Martin Kletzander
523c996062 conf, docs: Add support for coalesce setting(s)
We are currently parsing only rx/frames/max because that's the only
value that makes sense for us.  The tun device just added support for
this one and the others are only supported by hardware devices which
we don't need to worry about as the only way we'd pass those to the
domain is using <hostdev/> or <interface type='hostdev'/>.  And in
those cases the guest can modify the settings itself.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-04-21 13:34:41 +02:00
Jiri Denemark
56bd7edcb5 qemu: Pass migratable host CPU model to virCPUUpdate
We already know from QEMU which CPU features will block migration. Let's
use this information to make a migratable copy of the host CPU model and
use it for updating guest CPU specification. This will allow us to drop
feature filtering from virCPUUpdate where it was just a hack.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-04-19 16:36:38 +02:00
Daniel P. Berrange
6f37cb80df Prevent test failures with ebtables/iptables/ip6tables are missing
When running tests in a restricted container (as opposed to a full
OS install), we can't assume ebtables/iptbles/ip6tables are going
to be installed. We must check this and mark the tests as skipped.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-04-19 10:51:51 +01:00
Pavel Hrdina
fa60251b01 tests: domaincapstest: add test for Q35 machine type
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-04-18 13:27:11 +02:00
Pavel Hrdina
8ddd44806b qemu: report IDE bus in domain capabilities only if it's supported
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1441964

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-04-18 13:27:11 +02:00
Ján Tomko
b003b9781b qemu: do not crash on USB address with no port and invalid bus
Properly error out when the user requests a port from a bus
that does not have a controller present in the domain XML.

https://bugzilla.redhat.com/show_bug.cgi?id=1441589
2017-04-13 10:45:28 +02:00
Peter Krempa
9d49c20653 test: virsh-optparse: Fix expected test output with new error checking
Commit 4f4c3b1397 added code to remember errors during freeing
of domain objects. This changed the output when testing scaled numbers
parsing in virsh-optparse. Adjust the expected output.
2017-04-13 10:14:42 +02:00
Pavel Hrdina
8d04ea1661 tests/testutilsqemu: properly initialize qemu caps for tests
This removes the hacky extern global variable and modifies the
test code to properly create QEMU capabilities cache for QEMU
binaries used in our tests.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-04-11 14:06:47 +02:00
Pavel Hrdina
e6e26a899d tests: unify qemu binary paths for all qemu related tests
Our test data used a lot of different qemu binary paths and some
of them were based on downstream systems.

Note that there is one file where I had to add "accel=kvm" because
the qemuargv2xml code parses "/usr/bin/kvm" as virt type="kvm".

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-04-11 14:06:47 +02:00
Pavel Hrdina
e9a85a6e4f tests: don't use different QEMU binary paths for different virt types
The virt type for QEMU can be modified by -machine attribute "accel"
so there is no need to have different QEMU binary paths.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-04-11 14:06:47 +02:00
Pavel Hrdina
3a2c08ad32 tests/testutilsqemu: introduce QEMUBinList with all qemu binaries for tests
Let's group all the binaries that we use in our test suite to one array.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-04-11 14:06:47 +02:00
Pavel Hrdina
1da4efbe8a tests/testutilsqemu: extract guest creation into separate functions
All other architectures have separate functions to prepare guest
capabilities, do the same for i686 and x86_64 as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-04-11 14:06:47 +02:00
Pavel Hrdina
2b50a11acb tests: use global virQEMUDriver
Most tests already use global driver variable that is initialized
before any test case is executed, convert these remaining tests to
the same concept.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-04-11 14:06:47 +02:00
Pavel Hrdina
060de8357a tests/qemuxml2xmltest: remove NOP call of virQEMUCapsSetList
Commit 5572cd7f0e deprecated QEMU_CAPS_DEVICE capability but forgot
to remove this call as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-04-11 14:06:47 +02:00
Pavel Hrdina
2bc7600c33 tests/qemuxml2argvtest: remove unnecessary machine canonicalization
This is not required to run our tests.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-04-11 14:06:47 +02:00
Pavel Hrdina
9005a64b5c tests: fix some resource leaks
Found by running valgrind for these tests.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-04-11 13:23:01 +02:00
Marc Hartmayer
fd6e3f48ed refactoring: Use the return value of virObjectRef directly
Use the return value of virObjectRef directly. This way, it's easier
for another reader to identify the reason why the additional reference
is required.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
2017-04-10 14:49:20 +02:00
Jiri Denemark
0268df4020 Revert "qemu: Pass migratable host model to virCPUUpdate"
This reverts commit 959e72d323 which was
pushed accidentally.
2017-04-07 13:19:55 +02:00
Jiri Denemark
959e72d323 qemu: Pass migratable host model to virCPUUpdate
This will allow us to drop feature filtering from virCPUUpdate where it
was just a hack.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-04-07 10:12:24 +02:00
Jiri Denemark
00e0cbcb56 qemu: Add migratable parameter to virQEMUCapsInitCPUModel
The caller can ask for a migratable CPU model by passing true for the
new parameter.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-04-07 10:12:24 +02:00
Ján Tomko
e73889b631 Split out -Wframe-larger-than warning from WARN_CLFAGS
Introduce STRICT_FRAME_LIMIT_CFLAGS that will be used for
production code and RELAXED_FRAME_LIMIT_CFLAGS for tests.

Raising the limit for tests allows building them with clang
with optimizations disabled.
2017-04-06 12:29:35 +02:00
Andrea Bolognani
2e5de445a1 qemu: Move some functions to qemu_capspriv.h
This header file has been created so that we can expose
internal functions to the test suite without making them
public: those in qemu_capabilities.h bearing the comment

  /* Only for use by test suite */

are obvious candidates for being moved over.
2017-04-06 10:07:43 +02:00
Peter Krempa
8e0139869a docs: Move news.rng out of docs/schemas
docs/schemas directory is meant for schemas which are installed on the
system. The schema for the news file does not need to be installed.
Store it along with the file it describes for simplicity.
2017-04-05 09:51:51 +02:00
John Ferlan
466a53af05 tests: Pass BlockIOThrottle arguments by reference not value
Pass the data by reference rather than everything on the stack.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2017-04-04 12:40:27 -04:00
Andrea Bolognani
4ceac4bf29 tests: Rename VIRT_TEST_* macros to VIR_TEST_*
We use the "vir" prefix pretty consistently in our
APIs, both external and internal, which made these
macros stood out.
2017-04-04 17:30:03 +02:00
Peter Krempa
dff04e0af0 storage: gluster: Use volume name as "<name>" field in the XML
For native gluster pools the <dir> field denotes a directory inside the
pool. For the actual pool name the <name> field has to be used.
2017-04-04 16:36:15 +02:00
Peter Krempa
5df6992e1c storage: Fix XPath for looking up gluster volume name
Use the relative lookup specifier rather than the global one. Otherwise
only the first name would be looked up. Add a test case to cover the
scenario.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1436574
2017-04-04 16:36:15 +02:00