Commit Graph

3529 Commits

Author SHA1 Message Date
Peter Krempa
93a3f516ee tests: drivermodule: Make sure that all compiled storage backends can be loaded
Add a new storage driver registration function that will force the
backend code to fail if any of the storage backend modules can't be
loaded. This will make sure that they work and are present.
2017-02-22 09:31:33 +01:00
Peter Krempa
0a6d3e51b4 storage: Turn storage backends into dynamic modules
If driver modules are enabled turn storage driver backends into
dynamically loadable objects. This will allow greater modularity for
binary distributions, where heavyweight dependencies as rbd and gluster
can be avoided by selecting only a subset of drivers if the rest is not
necessary.

The storage modules are installed into 'LIBDIR/libvirt/storage-backend/'
and users can override the location by using
'LIBVIRT_STORAGE_BACKEND_DIR' environment variable.

rpm based distros will at this point install all the backends when
libvirt-daemon-driver-storage package is installed.
2017-02-22 09:31:33 +01:00
Peter Krempa
bd8f10c62a test: qemuhotplugtest: Add testing of individual vcpu hotplug
Test that the vcpu entity selection code works properly
2017-02-21 15:27:24 +01:00
Peter Krempa
f813fe810f storage: backend: Refactor registration of the backend drivers
Add APIs that allow to dynamically register driver backends so that the
list of available drivers does not need to be known during compile time.

This will allow us to modularize the storage driver on runtime.
2017-02-21 09:34:30 +01:00
Peter Krempa
633b7592d6 daemon: Refactor connection driver module loading
Pass the registration function name to virDriverLoadModule so that we
can later call specific functions if necessary (e.g. for testing
purposes). This gets rid of the rather ugly automatic name generator and
unifies the code to load/initialize the modules.

It's also clear which registration function gets called.
2017-02-21 09:24:33 +01:00
Peter Krempa
2e4e6affdd tests: drivermodule: Drop unused macro arguments
Refactors of the test resulted into the second argument of the 'TEST'
macro to be unused. Drop them.
2017-02-21 08:19:11 +01:00
Peter Krempa
58ea495988 tests: storagepoolxml2xml: Remove compile conditionals
The XML2XML test should work properly even if the storage backend is
disabled, since it does not use it.
2017-02-21 08:19:11 +01:00
Pavel Hrdina
a4a1ad2066 conf: display all iothread ids in the XML if one of them is not generated
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-02-20 18:40:54 +01:00
Pavel Hrdina
579fc9a287 tests: add QEMU 2.9.0 caps data
QEMU 2.9.0 is not released yet but it's close to its release and
we need this data to implement new features that will be in
that release.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-02-20 13:13:52 +01:00
Pavel Hrdina
a6e28aa599 tests: update QEMU 2.8.0 caps data
The old data was generated from not released QEMU.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-02-20 12:46:15 +01:00
John Ferlan
f3b1b98121 tests: Add createVHBAByNodeDevice-parent-fabric-wwn to fchosttest
Add a test that allows providing the parent fabric_wwn in the input XML
in order to create the vHBA.

This also fixes a mixed setting of the fabric_wwn field from the read
test driver XML strings.
2017-02-19 06:45:09 -05:00
John Ferlan
19ff43612c tests: Add createVHBAByNodeDevice-parent-wwn to fchosttest
Add a test that allows providing the parent wwnn/wwpn in the input XML
in order to create the vHBA.
2017-02-19 06:45:09 -05:00
John Ferlan
5319c49ce9 tests: Add createVHBAByNodeDevice-no-parent to fchosttest
Add a test that allows not providing a parent in the input XML, but still
being able to create finding a VPORT capable NPIV HBA.
2017-02-19 06:45:09 -05:00
John Ferlan
4b6ee784de tests: Add new fchosttest tests for management of a vHBA
Add a test that will mimic creation and destruction of a vHBA
by using node device XML. The design will allow for testing the
multiple mechanisms.

The first test uses just <parent> in the node device XML. This is
somewhat similar to the existing objecteventtest, except that this
test will not provide input wwnn/wwpn's (similar to how the process
is described for the the libvirt wiki).

This requires mocking the virRandomGenerateWWN since parsing the
input XML (virNodeDevCapSCSIHostParseXML) requires either a provided
wwnn/wwpn in the XML or the ability to randomly generate the wwnn/wwpn.
2017-02-19 06:45:09 -05:00
John Ferlan
03346def06 util: Move scsi_host specific functions from virutil
Create a virscsihost.c and place the functions there. That removes the
last #ifdef __linux__ from virutil.c.

Take the opporunity to also change the function names and in one case
the parameters slightly
2017-02-19 06:45:09 -05:00
John Ferlan
16416816c1 util: Create a new virvhba module and move/rename API's
Rather than have them mixed in with the virutil apis, create a separate
virvhba.c module and move the vHBA related calls into there. Soon there
will be more added.

Also modify the names of the functions and some arguments to be more
indicative of what is really happening. Adjust the callers respectively.

While I was changing fchosttest, rather than the non-descriptive names
test1...test6, rename them to match what the test is doing.
2017-02-19 06:45:09 -05:00
John Ferlan
9588a21b32 test: Fix fchosttest resource leak
Commit id '666bee3' made fabric_name optional; however, if fabric name
was present, then a leak would occur.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2017-02-19 06:45:09 -05:00
John Ferlan
779e49054a tests: Alter test_driver HBA name/data to be closer to reality
Alter "test-scsi-host-vport" to be "scsi_host1" to match the real
environment. This is the vport capable HBA - IOW the NPIV device.
Add more fields to scsi_host1 as well.

Alter the XML being used by the objecttest to create a vHBA in order
to match the scsi_host1 parent name and to use validateable wwnn/wwpn.
This will allow for realistic testing.
2017-02-19 06:45:09 -05:00
Marc-André Lureau
e5bda10141 qemu: add rendernode argument
Add a new attribute 'rendernode' to <gl> spice element.

Give it to QEMU if qemu supports it (queued for 2.9).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-02-17 15:47:58 +01:00
Marc-André Lureau
7f1bdec5fa nodedev: add drm capability
Add a new 'drm' capability for Direct Rendering Manager (DRM) devices,
providing device type information.

Teach the udev backend to populate those devices.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-02-17 15:47:58 +01:00
Marc-André Lureau
0809508ed2 nodedev: add <devnode> paths
Add new <devnode> top-level <device> element, that list the associated
/dev files. Distinguish the main /dev name from symlinks with a 'type'
attribute of value 'dev' or 'symlink'.

Update a test to check XML schema, and actually add it to the test list
since it was missing.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2017-02-17 15:47:58 +01:00
Jiri Denemark
78d27c6501 cputest: Fix name of the file removed by cpu-parse.sh
We want to remove the file created by

    json <<<"$data" >$fname.json

in case it was empty.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-02-17 11:19:29 +01:00
Nitesh Konkar
5729746543 Ensure disk names follow the disk name regex
Currently disk names do not follow the
(regex) /^[fhv]d[a-z]+[0-9]*$/ completely
and hence one can assign disk names like
vd2 etc. This patch ensures that the
disk names follow the regex mentioned.
This patch also adds a testcase.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2017-02-16 09:59:13 +01:00
Ján Tomko
4a41cf18b1 util: fix off-by-one when expanding a bitmap
To make sure bit 'b' fits into the bitmap, we need to allocate b+1
bits, since we number from 0.

Adjust the bitmap test to set a bit at a multiple of 16.
That way the test fails without this fix, because the VIR_REALLOC
call clears the newly added memory even if the original pointer
has not changed.
2017-02-14 13:30:48 +01:00
Tomáš Golembiovský
5d82a2085f valgrind: add suppression for bash memory leak
Add suppression for memory leak in bash observerd with bash 4.4.011 on
Arch Linux.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2017-02-14 10:54:29 +01:00
Ján Tomko
723fef99c0 qemu: enforce maximum ports value for nec-xhci
This controller only allows up to 15 ports.

https://bugzilla.redhat.com/show_bug.cgi?id=1375417
2017-02-13 16:34:09 +01:00
Ján Tomko
384504f7ba qemu: assign USB port on a selected hub for all devices
Due to a logic error, the autofilling of USB port when a bus is
specified:
    <address type='usb' bus='0'/>
does not work for non-hub devices on domain startup.

Fix the logic in qemuDomainAssignUSBPortsIterator to also
assign ports for USB addresses that do not yet have one.

https://bugzilla.redhat.com/show_bug.cgi?id=1374128
2017-02-13 09:46:15 +01:00
Roman Bogorodskiy
5620c60959 bhyve: add e1000 nic support
Recently e1000 NIC support was added to bhyve; implement that in
the bhyve driver:

 - Add capability check by analyzing output of the 'bhyve -s 0,e1000'
   command
 - Modify bhyveBuildNetArgStr() to support e1000 and also pass
   virConnectPtr so it could call bhyveDriverGetCaps() to check if this
   NIC is supported
 - Modify command parsing code to add support for e1000 and adjust tests
 - Add net-e1000 test
2017-02-11 06:51:28 +04:00
John Ferlan
e8a35271d4 tests: Link virusbmock with probes
Seeing similar error to commit id '997be5c27' with the inability
to find the libvirt_event_poll_purge_timeout_semaphore symbol
causing a virusbtest failure.
2017-02-10 10:55:26 -05:00
Michal Privoznik
afecfc2bf4 testUSBList: don't leak @dev
==22187== 77 (56 direct, 21 indirect) bytes in 1 blocks are definitely lost in loss record 23 of 37
==22187==    at 0x4C2BC75: calloc (vg_replace_malloc.c:624)
==22187==    by 0x4E75685: virAlloc (viralloc.c:144)
==22187==    by 0x4F0613A: virUSBDeviceNew (virusb.c:332)
==22187==    by 0x4F05BA2: virUSBDeviceSearch (virusb.c:183)
==22187==    by 0x4F05F95: virUSBDeviceFind (virusb.c:296)
==22187==    by 0x403514: testUSBList (virusbtest.c:209)
==22187==    by 0x403BD8: virTestRun (testutils.c:180)
==22187==    by 0x4039E5: mymain (virusbtest.c:285)
==22187==    by 0x4056BC: virTestMain (testutils.c:992)
==22187==    by 0x403A4A: main (virusbtest.c:293)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-02-10 10:25:44 +01:00
Michal Privoznik
eb58732c01 virusbmock: Link with libvirt_utils
We are using couple of functions from there (e.g. virStrdup) and
rely that the binary linking us has the libvirt_utils linked
already. Well, this makes valgrind sad.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-02-10 10:25:44 +01:00
Michal Privoznik
a9595814ed tests: Trace re-executing processes with valgrind
A lot of our tests re-execute themeselves after loading their
mock library. This, however, makes valgrind sad because currently
we do not tell it to trace the process after exec().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-02-10 10:25:44 +01:00
Jaroslav Safka
1c4f3b56f8 qemu: Add args generation for file memory backing
This patch add support for file memory backing on numa topology.

The specified access mode in memoryBacking can be overriden
by specifying token memAccess in numa cell.
2017-02-09 14:27:19 +01:00
Jaroslav Safka
bc6d3121a4 conf: Add new xml elements for file memorybacking support
This part introduces new xml elements for file based
memorybacking support and their parsing.
(It allows vhost-user to be used without hugepages.)

New xml elements:
<memoryBacking>
  <source type="file|anonymous"/>
  <access mode="shared|private"/>
  <allocation mode="immediate|ondemand"/>
</memoryBacking>
2017-02-09 14:27:19 +01:00
Laine Stump
68a42bf6f7 conf: support configuring mtu size in a virtual network
Example:

  <network>
     ...
     <mtu size='9000'/>
     ...

If mtu is unset, it's assumed that we want the default for whatever is
the underlying transport (usually this is 1500).

This setting isn't yet wired in, so it will have no effect.

This partially resolves: https://bugzilla.redhat.com/1224348
2017-02-07 13:52:06 -05:00
Laine Stump
dd8ac030fb util: add MTU arg to virNetDevTapCreateInBridgePort()
virNetDevTapCreateInBridgePort() has always set the new tap device to
the current MTU of the bridge it's being attached to. There is one
case where we will want to set the new tap device to a different
(usually larger) MTU - if that's done with the very first device added
to the bridge, the bridge's MTU will be set to the device's MTU. This
patch allows for that possibility by adding "int mtu" to the arg list
for virNetDevTapCreateInBridgePort(), but all callers are sending -1,
so it doesn't yet have any effect.

Since the requested MTU isn't necessarily what is used in the end (for
example, if there is no MTU requested, the tap device will be set to
the current MTU of the bridge), and the hypervisor may want to know
the actual MTU used, we also return the actual MTU to the caller (if
actualMTU is non-NULL).
2017-02-07 13:45:08 -05:00
Andrea Bolognani
c2e60ad0e5 qemu: Forbid <memoryBacking><locked> without <memtune><hard_limit>
In order for memory locking to work, the hard limit on memory
locking (and usage) has to be set appropriately by the user.

The documentation mentions the requirement already: with this
patch, it's going to be enforced by runtime checks as well,
by forbidding a non-compliant guest from being defined as well
as edited and started.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1316774
2017-02-07 18:43:10 +01:00
Roman Bogorodskiy
66c21aee89 bhyve: fix virtio disk addresses
Like it usually happens, I fixed one thing and broke another:
in 803966c76 address allocation was fixed for SATA disks, but
broke that for virtio disks, because it dropped disk address
assignment completely. It's not needed for SATA disks anymore,
but still needed for the virtio ones.

Bring that back and add a couple of tests to make sure it won't
happen again.
2017-02-07 19:17:58 +04:00
Peter Krempa
5550dde150 tests: qemuhotplug: Don't free the monitor object as part of @vm
The test monitor should be freed separately so we need to remove the
pointer from the @vm object. This fixes a race condition crash in the
test introduced in commit a245abce43.
2017-02-02 16:46:43 +01:00
Peter Krempa
5ae7b0d8af tests: qemuhotplug: Fix memory leaks after cpu hotplug testing patches
testQemuHotplugCpuDataFree leaked @data always and
testQemuHotplugCpuPrepare leaked @prefix on success
2017-02-02 15:57:29 +01:00
Ján Tomko
3ac97c2ded qemu: Add enough USB hubs to accomodate all devices
Commit 815d98a started auto-adding one hub if there are more USB devices
than available USB ports.

This was a strange choice, since there might be even more devices.
Before USB address allocation was implemented in libvirt, QEMU
automatically added a new USB hub if the old one was full.

Adjust the logic to try adding as many hubs as will be needed
to plug in all the specified devices.

https://bugzilla.redhat.com/show_bug.cgi?id=1410188
2017-01-31 13:09:08 +01:00
Roman Bogorodskiy
ae01530cb4 bhyve: add tests for SATA address allocation 2017-01-30 20:48:42 +04:00
Roman Bogorodskiy
803966c76d bhyve: fix SATA address allocation
As bhyve for a long time didn't have a notion of the explicit SATA
controller and created a controller for each drive, the bhyve driver
in libvirt acted in a similar way and didn't care about the SATA
controllers and assigned PCI addresses to drives directly, as
the generated command will look like this anyway:

 2:0,ahci-hd,somedisk.img

This no longer makes sense because:

 1. After commit c07d1c1c4f it's not possible to assign
    PCI addresses to disks
 2. Bhyve now supports multiple disk drives for a controller,
    so it's going away from 1:1 controller:disk mapping, so
    the controller object starts to make more sense now

So, this patch does the following:

 - Assign PCI address to SATA controllers (previously we didn't do this)
 - Assign disk addresses instead of PCI addresses for disks. Now, when
   building a bhyve command, we take PCI address not from the disk
   itself but from its controller
 - Assign addresses at XML parsing time using the
   assignAddressesCallback. This is done mainly for being able to
   verify address allocation via xml2xml tests
 - Adjust existing bhyvexml2{xml,argv} tests to chase the new
   address allocation

This patch is largely based on work of Fabian Freyer.
2017-01-30 20:48:42 +04:00
Roman Bogorodskiy
13a050b2c3 bhyve: add virBhyveDriverCreateXMLConf
Add virBhyveDriverCreateXMLConf, a simple wrapper around
virDomainXMLOptionNew that makes it easier to pass bhyveConnPtr
as a private data for parser. It will be used later for device
address allocation at parsing time.

Update consumers to use it instead of direct calls to
virDomainXMLOptionNew.

As we now have proper callbacks connected for the tests, update
test files accordingly to include the automatically generated
PCI root controller.
2017-01-30 20:48:42 +04:00
Peter Krempa
bfc32e5895 tests: storage: Fix storage xml2xml test for vstorage pool
The input and output were the same, but the output file did not
correspond to what libvirt would output.
2017-01-27 10:39:53 +01:00
Pavel Hrdina
f19390d2d3 domain_conf: vnc: preserve autoport value if no port was specified
The issue is that if this graphics definition is provided:

  <graphics type='vnc' port='0'/>

it's parsed as:

  <graphics type='vnc' autoport='no'>
    <listen type='address'/>
  </graphics>

but if the resulting XML is parsed again the output is:

  <graphics type='vnc' port='-1' autoport='yes'>
    <listen type='address'/>
  </graphics>

and this should not happen.  The XML have to always remain the same
after it was already parsed by libvirt.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-01-27 09:46:03 +01:00
Nitesh Konkar
67e98c6452 virnettlssessiontest.c: fix grammar
Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2017-01-26 15:13:58 -05:00
Olga Krishtal
a55ddc8774 storage: vstorage pool documentation and simple test
Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
2017-01-26 10:43:42 -05:00
Michal Privoznik
572eda12ad qemu: Implement mtu on interface
Not only we should set the MTU on the host end of the device but
also let qemu know what MTU did we set.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-01-26 10:00:01 +01:00
Michal Privoznik
b020cf73fe domain_conf: Introduce <mtu/> to <interface/>
So far we allow to set MTU for libvirt networks. However, not all
domain interfaces have to be plugged into a libvirt network and
even if they are, they might want to have a different MTU (e.g.
for testing purposes).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-01-26 09:59:56 +01:00