Commit Graph

1785 Commits

Author SHA1 Message Date
Thorsten Behrens
5eb61e6846 Add unit test for virCgroupGetPercpuStats. 2014-02-20 16:20:10 +01:00
Thorsten Behrens
35aebf1118 Fix misspelled cpuacct.usage_percpu in cgroup mock. 2014-02-20 16:20:10 +01:00
Thorsten Behrens
977a187ad7 Add unit test for virCgroupGetMemoryUsage. 2014-02-20 16:20:10 +01:00
Thorsten Behrens
9ce8a7c5c5 Add unit test for virCgroupGetBlkioIo*Serviced 2014-02-20 16:20:09 +01:00
Oleg Strikov
41b9b71877 qemu: Use virtio network device for aarch64/virt
This patch changes network device type used by default from rtl8139
to virtio when architecture type is aarch64 and machine type is virt.
Qemu doesn't support any other machine types for aarch64 right now and
we can't make any other aarch64-specific tuning in this function yet.

Signed-off-by: Oleg Strikov <oleg.strikov@canonical.com>
2014-02-19 10:46:10 -05:00
Li Zhang
cffa51b81d Add a default USB keyboard and USB mouse for PPC64
There is no keyboard working on PPC64 and PS2 mouse is only for X86
when graphics are enabled.

Add a USB keyboard and USB mouse for PPC64 when graphics are enabled.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2014-02-19 09:16:31 +01:00
Li Zhang
78730478aa qemu: format qemu command line for USB keyboard
Format qemu command line for USB keyboard
and add test cases for it.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2014-02-19 09:16:31 +01:00
Li Zhang
f5ffd45f4c qemu: Add USB keyboard capability
Add USB keyboard capability probing and test cases.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2014-02-19 09:16:31 +01:00
Li Zhang
b39275954b conf: Remove the implicit PS2 devices for non-X86 platforms
PS2 devices only work on X86 platform, other platforms may need
USB devices instead. Athough it doesn't influence the QEMU command line,
it's not right to add PS2 mouse/keyboard for non-X86 platform.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2014-02-19 09:16:31 +01:00
Li Zhang
bc18373391 conf: Add keyboard input device type
There is no keyboard support currently in libvirt.

For some platforms (PPC64 QEMU) this makes graphics unusable,
since the keyboard is not implicit and it can't be added via libvirt.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2014-02-19 09:16:31 +01:00
Ján Tomko
665344da01 Add tests for secret XML parsing
also validate it against the RNG schema.
2014-02-14 16:47:14 +01:00
Cédric Bosdonnat
18fb3df463 Forgot to add lxcconf2xmldata to dist. 2014-02-14 16:13:54 +01:00
Ján Tomko
0ee9081215 Support IPv6 in port allocator
Also try to bind on IPv6 to check if the port is occupied.

Change the mocked bind in the test to return EADDRINUSE
for some ports only for the IPv4/IPv6 socket if we're testing
on a host with IPv6 compiled in.

Also mock socket() to make it fail with EAFNOTSUPPORTED
if LIBVIRT_TEST_IPV4ONLY is set in the environment, to
simulate a host without IPv6 support in the kernel. The
tests are repeated again with this variable set.

https://bugzilla.redhat.com/show_bug.cgi?id=1025407
2014-02-14 13:18:35 +01:00
Peter Krempa
e32268184b storage: Add file storage APIs in the default storage driver
Add APIs that will allow to use the storage driver to assist in
operations on files even for remote filesystems without native
representation as files in the host.
2014-02-14 10:47:56 +01:00
Cédric Bosdonnat
3d58fa3f85 LXC from native: convert blkio throttle config 2014-02-12 17:52:47 +00:00
Cédric Bosdonnat
a09bbc024d LXC from native: map vlan network type
The problem with VLAN is that the user still has to manually create the
vlan interface on the host. Then the generated configuration will use
it as a nerwork hostdev device. So the generated configurations of the
following two fragments are equivalent (see rhbz#1059637).

lxc.network.type = phys
lxc.network.link = eth0.5

lxc.network.type = vlan
lxc.network.link = eth0
lxc.network.vlan.id = 5
2014-02-12 17:52:47 +00:00
Cédric Bosdonnat
0f13a525d2 LXC from native: map lxc.arch to /domain/os/type@arch 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
5b8bfb0276 LXC from native: add lxc.cgroup.blkio.* mapping 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
281e2990ee LXC from native: map lxc.cgroup.cpuset.* 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
4f3f7aea6c LXC from native: map lxc.cgroup.cpu.* 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
13b9946eb5 LXC from native: migrate memory tuning 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
99d8cddfbe LXC from native: convert lxc.id_map into <idmap> 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
8e45b88772 LXC from native: convert macvlan network configuration 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
f01fe54e75 LXC from native: convert lxc.tty to console devices 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
69fc236243 LXC from native: convert phys network types to net hostdev devices 2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
b73c029d83 LXC from native: migrate veth network configuration
Some of the LXC configuration properties aren't migrated since they
would only cause problems in libvirt-lxc:
  * lxc.network.ipv[46]: LXC driver doesn't setup IP address of guests,
    see rhbz#1059624
  * lxc.network.name, see rhbz#1059630
2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
7bfd6e97ec LXC from native: implement no network conversion
If no network configuration is provided, LXC only provides the loopback
interface. To match this, we need to use the privnet feature. LXC will
also define a 'none' network type in its 1.0.0 version that fits
libvirt LXC driver's default.
2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
a41680f8c5 LXC from native: migrate fstab and lxc.mount.entry
Tmpfs relative size and default 50% size values aren't supported as
we have no idea of the available memory at the conversion time.
2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
197b13e5d9 LXC from native: import rootfs
LXC rootfs can be either a directory or a block device or an image
file. The first two types have been implemented, but the image file is
still to be done since LXC auto-guesses the file format at mount time
and the LXC driver doesn't support the 'auto' format.
2014-02-12 17:52:46 +00:00
Cédric Bosdonnat
7195c807b2 LXC driver: started implementing connectDomainXMLFromNative
This function aims at converting LXC configuration into a libvirt
domain XML description to help users migrate from LXC to libvirt.

Here is an example of how the lxc configuration works:
virsh -c lxc:/// domxml-from-native lxc-tools /var/lib/lxc/migrate_test/config

It is possible that some parts couldn't be properly mapped into a
domain XML fragment, so users should carefully review the result
before creating the domain.

fstab files in lxc.mount lines will need to be merged into the
configuration file as lxc.mount.entry.

As we can't know the amount of memory of the host, we have to set a
default value for max_balloon that users will probably want to adjust.
2014-02-12 17:52:46 +00:00
Ján Tomko
5b0dc11db8 Fix leaks in vircapstest
Coverity complains about cell_cpus being leaked on error
and valgrind shows 'caps' is leaked on success.

Introduced in eb64e87.
2014-02-12 14:41:47 +01:00
Pradipta Kr. Banerjee
eb64e8752b vircapstest: Introduce virCapabilitiesGetCpusForNodemask test
This test creates a Fake NUMA topology with non-sequential cell ids
to check if libvirt properly handles the same

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
Signed-off-by: Pradipta Kr. Banerjee <bpradip@in.ibm.com>
2014-02-11 14:44:20 +00:00
Martin Kletzander
d27e6bc40f qemu: introduce spiceport chardev backend
Add a new backend for any character device.  This backend uses channel
in spice connection.  This channel is similar to spicevmc, but
all-purpose in contrast to spicevmc.

Apart from spicevmc, spiceport-backed chardev will not be formatted
into the command-line if there is no spice to use (with test for that
as well).  For this I moved the def->graphics counting to the start
of the function so its results can be used in rest of the code even in
the future.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-02-11 13:43:55 +01:00
Peter Krempa
600bca592b qemu: hyperv: Add support for timer enlightenments
Add a new <timer> for the HyperV reference time counter enlightenment
and the iTSC reference page for Windows guests.

This feature provides a paravirtual approach to track timer events for
the guest (similar to kvmclock) with the option to use real hardware
clock on systems with a iTSC with compensation across various hosts.
2014-02-10 11:30:10 +01:00
Peter Krempa
bbd392ff86 schema: Fix guest timer specification schema according to the docs
According to the documentation describing various tunables for domain
timers not all the fields are supported by all the driver types. Express
these in the RNG:

- rtc, platform: Only these support the "track" attribute.
- tsc: only one to support "frequency" and "mode" attributes
- hpet, pit: tickpolicy/catchup attribute/element
- kvmclock: no extra attributes are supported

Additionally the attributes of the <catchup> element for
tickpolicy='catchup' are optional according to the parsing code. Express
this in the XML and fix a spurious space added while formatting the
<catchup> element and add tests for it.
2014-02-10 11:09:14 +01:00
Michal Privoznik
c5d09fbdd1 qemuxml2argvtest: Set timezone
With my recent work on the test, both time() and localtime() are used.
While mocking the former one, we get predictable result for UTC. But
since the latter function uses timezone to get local time, the result of
localtime() is not so predictive. Therefore, we must set the TZ variable
at the beginning of the test. To be able to catch some things that work
just by a blind chance, I'm choosing a virtual timezone that (hopefully)
no libvirt developer resides in.
2014-02-06 15:15:10 +01:00
Michal Privoznik
35b7088534 qemuxml2argvmock: Mock time() on non-linux platforms too
The qemuxml2argvtest is run on more platforms than linux. For instance
FreeBSD. On these platforms we are, however, not mocking time() which
results in current time being fetched from system and hence tests number
32 and 33 failing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-02-06 15:15:10 +01:00
Michal Privoznik
e505db0f6c qemuxml2argvtest: Test localtime clock basis
When trying to introduce a test for previous patch, I've
noticed that the command line is constructed using current
time. This won't work in our test suite (unless you guys
wants to set a specific time prior to each test run :) ).
Therefore we need to mock calls to time(2) to return the
same value every time it's called.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-02-06 08:22:22 +01:00
John Ferlan
02bf6568f4 tests: Add test for new virkmod functions
Adding tests for new virKMod{Config|Load|Unload}() API's.

A test for virKModIsBlacklisted() would require some setup which cannot
be assumed.
2014-02-04 08:59:37 -05:00
Laine Stump
66f75925eb network: change default of forwardPlainNames to 'yes'
The previous patch fixed "forwardPlainNames" so that it really is
doing only what is intended, but left the default to be
"forwardPlainNames='no'". Discussion around the initial version of
that patch led to the decision that the default should instead be
"forwardPlainNames='yes'" (i.e. the original behavior before commit
f3886825). This patch makes that change to the default.
2014-02-04 12:00:26 +02:00
Laine Stump
f69a6b987d network: only prevent forwarding of DNS requests for unqualified names
In commit f386825 we began adding the options

  --domain-needed
  --local=/$mydomain/

to all dnsmasq commandlines with the stated reason of preventing
forwarding of DNS queries for names that weren't fully qualified
domain names ("FQDN", i.e. a name that included some "."s and a domain
name). This was later changed to

  domain-needed
  local=/$mydomain/

when we moved the options from the dnsmasq commandline to a conf file.

The original patch on the list, and discussion about it, is here:

  https://www.redhat.com/archives/libvir-list/2012-August/msg01594.html

When a domain name isn't specified (mydomain == ""), the addition of
"domain-needed local=//" will prevent forwarding of domain-less
requests to the virtualization host's DNS resolver, but if a domain
*is* specified, the addition of "local=/domain/" will prevent
forwarding of any requests for *qualified* names within that domain
that aren't resolvable by libvirt's dnsmasq itself.

An example of the problems this causes - let's say a network is
defined with:

   <domain name='example.com'/>
   <dhcp>
      ..
      <host mac='52:54:00:11:22:33' ip='1.2.3.4' name='myguest'/>
   </dhcp>

This results in "local=/example.com/" being added to the dnsmasq options.

If a guest requests "myguest" or "myguest.example.com", that will be
resolved by dnsmasq. If the guest asks for "www.example.com", dnsmasq
will not know the answer, but instead of forwarding it to the host, it
will return NOT FOUND to the guest. In most cases that isn't the
behavior an admin is looking for.

A later patch (commit 4f595ba) attempted to remedy this by adding a
"forwardPlainNames" attribute to the <dns> element. The idea was that
if forwardPlainNames='yes' (default is 'no'), we would allow
unresolved names to be forwarded. However, that patch was botched, in
that it only removed the "domain-needed" option when
forwardPlainNames='yes', and left the "local=/mydomain/".

Really we should have been just including the option "--domain-needed
--local=//" (note the lack of domain name) regardless of the
configured domain of the network, so that requests for names without a
domain would be treated as "local to dnsmasq" and not forwarded, but
all others (including those in the network's configured domain) would
be forwarded. We also shouldn't include *either* of those options if
forwardPlainNames='yes'. This patch makes those corrections.

This patch doesn't remedy the fact that default behavior was changed
by the addition of this feature. That will be handled in a subsequent
patch.
2014-02-04 12:00:26 +02:00
Michal Privoznik
defec0de5f virnetdevbandwidthtest: Link with libxml2
I've received a notice over IRC that on some systems, the
virnetdevbandwidthtest is not linked with libxml:

  /usr/bin/ld: virnetdevbandwidthtest.o: undefined reference to symbol 'xmlStrEqual@@LIBXML2_2.4.30'
  /usr/lib/x86_64-linux-gnu/libxml2.so.2: error adding symbols: DSO missing from command line

Trivial way avoiding this is to add LIBXML_LIBS to
virnetdevbandwidthtest_LDADD.
2014-02-03 17:50:32 +01:00
Michal Privoznik
e60b36cb0d virnetdevbandwidthtest: Introduce some more tests
And while doing this, fix one error raised by coverity. With
current code, @actual_cmd is allowed to be NULL for the whole
run of testVirNetDevBandwidthSet. However, if something else
was expected, the @actal_cmd is passed to virtTestDifference
which dereference it immediately.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-01-31 16:52:27 +01:00
Cédric Bosdonnat
d01596a0d3 virnetdevbandwidthtest: fix hard coded /sbin/tc
On openSuse, (and possibly other distros), tc isn't located in
/sbin/tc. To get rid of that problem, use TC constant instead of hard
coded /sbin/tc in the expected string
2014-01-31 11:12:08 +01:00
Osier Yang
14177ebc24 tests: Modify the scsi util tests
Add tests/virscsidata/sg0 and tests/virscsidata/sg8 as the test
input for constructing scsi->sg_path. And change the scsi generic
number of "1:0:0:0", because it's easy to hide the problem (assuming
most machines have a CDROM drive).

Signed-off-by: Osier Yang <jyang@redhat.com>
2014-01-30 16:34:43 +01:00
Osier Yang
6fdece9a33 tests: Add tests for scsi utils
This creates the basic unit tests for the scsi utils.

Signed-off-by: Osier Yang <jyang@redhat.com>
2014-01-30 15:50:37 +08:00
Osier Yang
10c9ceff6d util: Add one argument for several scsi utils
To support passing the path of the test data to the utils, one
more argument is added to virSCSIDeviceGetSgName,
virSCSIDeviceGetDevName, and virSCSIDeviceNew, and the related
code is changed accordingly.

Later tests for the scsi utils will be based on this patch.

Signed-off-by: Osier Yang <jyang@redhat.com>
2014-01-30 15:48:28 +08:00
Michal Privoznik
122cd16982 Revert "networkAllocateActualDevice: Set QoS for bridgeless networks too"
This reverts commit 2996e6be19
and some parts of 2636dc8c4d.

The former one tried to implement QoS setting on bridgeless networks.
However, as discussed upstream [1], the patch is far away from being
useful in even a single case. The whole idea of network QoS is to have
aggregated limits over several interfaces. This patch is doing
completely the opposite when merging two QoS settings (from the network
and the domain interface) into one which is then set at the domain
interface itself, not the network.

The latter one is the test for the previous one. Now none of them makes
sense.

1: https://www.redhat.com/archives/libvir-list/2014-January/msg01441.html

Conflicts:
	tests/virnetdevbandwidthtest.c: New test has been introduced since
    then.
2014-01-29 19:01:19 +01:00
Michal Privoznik
7bcbb53e18 virnetdevbandwidthtest: Introduce testVirNetDevBandwidthSet
The test tries to set some QoS limits and check if the commands
that are actually executed are the expected ones.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-01-29 18:10:29 +01:00
Peter Krempa
7076b4b72c snapshot: Add support for specifying snapshot disk backing type
Add support for specifying various types when doing snapshots. This will
later allow to do snapshots on network backed volumes. Disks of type
'volume' are not supported by snapshots (yet).

Also amend the test suite to check parsing of the various new disk
types that can now be specified.
2014-01-29 12:56:35 +01:00