Commit Graph

14351 Commits

Author SHA1 Message Date
Daniel P. Berrange
cb3868f701 Ensure LXC/QEMU APIs set the filename for errors
The virLibConnError macros in libvirt-lxc.c and
libvirt-qemu.c were passing NULL for the filename.
This causes a crash if the logging code is configured
to use journald.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-08-02 15:32:26 +01:00
Daniel P. Berrange
311eae8257 Remove reference to python/tests from RPM %doc
The python/tests files were recently deleted, but a reference was
left in the RPM %doc entry

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-08-02 16:29:43 +02:00
Peter Krempa
8f95d5d84c qemumonitortestutils: Don't skip va_end() on error path
When allocation of memory failed the error path didn't call va_end()
causing a coverity failure.

Reported by John Ferlan.
2013-08-02 12:28:58 +02:00
Peter Krempa
ae9ef97b9b qemuagenttest: Check invalid response in shutdown test
The shutdown test utilizes waiting for condition to exit the test. This
addition will return an error for the shutdown command to see if the
condition waiting code will not hang.
2013-08-02 12:28:58 +02:00
Peter Krempa
baebb34120 qemuagenttest: Fix checking of shutdown mode
Coverity complained about unused variable that contains the shutdown
mode. The original intention was to check it against the requested mode.

Also the fixed check revealed a mistake in the expected shutdown mode.

Reported by John Ferlan.
2013-08-02 12:28:50 +02:00
Roman Bogorodskiy
4ac708f250 bridge driver: extract platform specifics
* Move platform specific things (e.g. firewalling and route
  collision checks) into bridge_driver_platform
* Create two platform specific implementations:
    - bridge_driver_linux: Linux implementation using iptables,
      it's actually the code moved from bridge_driver.c
    - bridge_driver_nop: dumb implementation that does nothing

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-08-01 15:47:02 -06:00
John Ferlan
6e69166ef1 valgrind: Adjust filter for _dl_allocate_tls
More tests are now using the path - adjust the filter to include any
path from a test through pthread_create to _dl_allocate_tls
2013-08-01 17:04:28 -04:00
John Ferlan
3b4b121423 tests: Coverity found new NULL_RETURNS
Coverity reported the existing missing check of the return value and
subsequent use from a call to virJSONValueFromString() in testJSONAddRemove().
2013-08-01 17:04:28 -04:00
Jincheng Miao
a320730a88 build: fix qemuagenttest build with -O0 in fedora 19.
When building libvirt with -O0 flag in fedora 19, it will fail to
generate qemuagenttest, a link error occurs like:

./.libs/libqemumonitortestutils.a(qemumonitortestutils.o): In function `qemuMonitorTestFree':
libvirt/tests/qemumonitortestutils.c:346: undefined reference to `qemuMonitorClose'
./.libs/libqemumonitortestutils.a(qemumonitortestutils.o): In function `qemuMonitorTestNew':
libvirt/tests/qemumonitortestutils.c:870: undefined reference to `qemuMonitorOpen'
collect2: error: ld returned 1 exit status

Fix it by listing libraries in the correct order to avoid lazy linkage.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-08-01 14:07:03 -06:00
Eric Blake
13c573740b maint: use modern autoconf idioms
Autoconf 2.59 says that AC_OUTPUT with arguments is obsolete,
and we are already using the replacement for some, but not all,
of our output files.

* configure.ac (AC_OUTPUT): Rewrite to use AC_CONFIG_FILES.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-08-01 07:31:53 -06:00
Guannan Ren
dbca841457 qemu: check presence of each disk and its backing file as well
For disk with startupPolicy support, such as cdrom and floppy
when its chain is broken, the startup policy will apply,
otherwise, report an error.
2013-08-01 13:26:47 +08:00
Guannan Ren
d7b7aa2c20 qemu: add helper functions for diskchain checking
*src/util/virstoragefile.c: Add a helper function to get
the first name of missing backing files, if the name is NULL,
it means the diskchain is not broken.
*src/qemu/qemu_domain.c: qemuDiskChainCheckBroken(disk) to
check if its chain is broken
2013-08-01 13:26:27 +08:00
Guannan Ren
e2ccc96cf0 qemu: refactor qemuDomainCheckDiskPresence for only disk presence check
Refactor this function to make it focus on disk presence checking,
including diskchain checking, and not only for CDROM and Floppy.
This change is good for the following patches.
2013-08-01 13:26:20 +08:00
Mooli Tayer
6f4a0ebe8c Configuring systemd to restart libvirt on failure
This will create a respawn behaviour in case libvirt
process exits due to nonzero exit code, is terminated
by a signal, an operation times out or the configured
watchdog timeout is triggered.
see http://www.freedesktop.org/software/systemd/man/systemd.service.html
and https://bugzilla.redhat.com/show_bug.cgi?id=981974

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-07-31 16:55:27 -06:00
Stefan Bader
9d0557b965 xen: Avoid double free of virDomainDef in xenDaemonCreateXML
The virDomainDef is allocated by the caller and also used after
calling to xenDaemonCreateXML. So it must not get freed by the
callee.

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
2013-07-31 16:15:56 -06:00
Daniel P. Berrange
2fe2470181 Enable support for systemd-machined in cgroups creation
Make the virCgroupNewMachine method try to use systemd-machined
first. If that fails, then fallback to using the traditional
cgroup setup code path.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-31 19:29:19 +01:00
Daniel P. Berrange
75304eaa1a Cope with races while killing processes
When systemd is involved in managing processes, it may start
killing off & tearing down croups associated with the process
while we're still doing virCgroupKillPainfully. We must
explicitly check for ENOENT and treat it as if we had finished
killing processes

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-31 19:27:28 +01:00
Daniel P. Berrange
aedd46e7e3 Add support for systemd cgroup mount
Systemd uses a named cgroup mount for tracking processes. Add
it as another type of controller, albeit one which we have to
special case in a number of places. In particular we must
never create/delete directories there, nor add tasks. Essentially
the systemd mount is to be considered read-only for libvirt.

With this change both the virCgroupDetectPlacement and
virCgroupCopyPlacement methods must be invoked. The copy
placement method will copy setup for resource controllers
only. The detect placement method will probe for any
named controllers, or resource controllers not already
setup.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-31 19:27:19 +01:00
Daniel P. Berrange
4574b475df Add APIs for formatting systemd slice/scope names
There are some interesting escaping rules to consider when dealing
with systemd slice/scope names. Thus it is helpful to have APIs
for formatting names

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-31 19:24:53 +01:00
Peter Krempa
2d95e8b100 qemuagenttest: Add tests for CPU plug functions and helpers 2013-07-31 14:45:46 +02:00
Peter Krempa
fea2590a02 qemuagenttest: Introduce testing of shutdown commands
This patch exports a few utility functions and adds testing of shutdown
commands of the guest agent.
2013-07-31 14:25:43 +02:00
Peter Krempa
f3a9391bec qemuagenttest: Add testing of agent suspend modes 2013-07-31 14:25:43 +02:00
Peter Krempa
725ee3b1d5 qemuagenttest: Test the filesystem trimming 2013-07-31 14:25:43 +02:00
Peter Krempa
5c94dfdd76 tests: Add qemuagenttest
Add a basic test framework with two simple tests to test guest agent
interaction.
2013-07-31 14:25:43 +02:00
Peter Krempa
e32f6e778b qemumonitortestutils: Add the ability to check arguments of commands
This patch adds helpers that allow to check for argument values in
commands sent to the monitor.
2013-07-31 14:25:43 +02:00
Peter Krempa
69441df4d0 qemumonitortestutils: Improve error reporting from mock qemu monitor
Use the JSON error messages to report errors back to the caller in
addition to erroring out. The error reported from the event loop from
the mock function of the monitor was later overwritten by the call to
the monitor/agent interaction API. This will also allow testing of error
reporting.
2013-07-31 14:25:43 +02:00
Peter Krempa
659fe6d2db qemumonitortestutils: Add instrumentation for guest agent testing
Add helper functions to open guest agent connections and a handler for
replying to the "guest-sync" command.
2013-07-31 14:25:43 +02:00
Peter Krempa
f6bb917e6a qemumonitortestutils: Split lines on \n instead of \r\n
The normal monitor uses windows line endings, where the agent monitor
uses only newlines. Change this to tolerate both approaches and allow to
use the utilities for guest agent tests.
2013-07-31 14:25:43 +02:00
Peter Krempa
5467cbef4b qemumonitortestutils: Refactor the test helpers to allow reuse
Refactor the test helpers to allow adding callbacks to verify the
monitor responses instead of simple command name checking and clean up
various parts to prepare for adding guest agent tests.
2013-07-31 14:25:43 +02:00
Peter Krempa
3383480430 qemumonitortestutils: Split up creation of the test to allow reuse
The instrumentation for the monitor test can be hacked for qemu agent
testing. Split out the monitor specific stuff to allow using the code in
guest agent tests in the future.
2013-07-31 14:25:43 +02:00
Peter Krempa
a63a7a5af9 qemumonitortestutils: Don't crash on non fully initialized test
The qemumonitorjsontest crashed when one of the initialization steps
done before starting the worker thread failed. This patch fixes this by
trying to pthread_join() the thread only after it was created.
2013-07-31 14:25:43 +02:00
Peter Krempa
5bf61f3818 qemumonitortestutils: remove multiline function calls 2013-07-31 14:25:43 +02:00
Peter Krempa
65f3f9dd78 qemumonitortestutils: Use VIR_DELETE_ELEMENT and VIR_APPEND_ELEMENT
Simplify the code using the existing helpers instead of open coding the
same functionality.
2013-07-31 14:25:43 +02:00
Peter Krempa
d24dbdd0a2 qemumonitortestutils: Use consistent header style and line spacing 2013-07-31 14:25:43 +02:00
Peter Krempa
56874f0191 qemu_agent: Remove obvious comments
Most APIs in libvirt report errors, thus no need to state that
explicitly.
2013-07-31 14:25:43 +02:00
Peter Krempa
18a629167c qemu_agent: Move updater function for VCPU hotplug into qemu_agent.c
To allow testing of the cpu updater function, this function needs to be
available separately. Export it from qemu_agent.c where it should
belong.
2013-07-31 14:25:43 +02:00
Peter Krempa
2e38753fb0 qemu_agent: Output newline at the end of the sync JSON message
Although this isn't apparently needed for the guest agent itself, the
test I will be adding later depends on the newline as a separator of
messages to process.
2013-07-31 14:25:43 +02:00
Peter Krempa
cc4df6fd5b conf: Export virDomainChrSourceDefClear() 2013-07-31 14:25:43 +02:00
Ján Tomko
567fe30a3b Don't mark parentIndex with ATTRIBUTE_UNUSED
parentIndex is used in virNetworkDefUpdateIPDHCPRange
2013-07-31 12:23:21 +02:00
Bamvor Jian Zhang
bcef0f0158 add console support in libxl
this patch introduce the console api in libxl driver for both pv and
hvm guest.  and import and update the libxlMakeChrdevStr function
which was deleted in commit dfa1e1dd.

Signed-off-by: Bamvor Jian Zhang <bjzhang@suse.com>
2013-07-30 15:58:28 -06:00
Dan Walsh
fbd7682706 util: add virGetUserDirectoryByUID
This function is needed for virt-login-shell.  Also modify virGirUserDirectory
to use the new function, to simplify the code.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-07-30 15:25:59 -06:00
Eric Blake
02033b633a maint: fix typo for SENTINEL
* src/openvz/openvz_driver.c: Use correct spelling.
* src/vmware/vmware_conf.c: Likewise.
* src/vmware/vmware_conf.h: Likewise.
* src/vmware/vmware_driver.c: Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-07-30 10:49:53 -06:00
Jiri Denemark
462863a3ee spec: Don't mix commands with macro definitions
%build section should first define all required macros and then run
commands. Interleaving them makes it harder to spot what commands are
run.
2013-07-30 17:13:40 +02:00
Jiri Denemark
d5cd5bf031 spec: Use --enable-werror on RHEL
As RHEL provides a stable tool chain, we don't have to worry about
frequent changes in reported compiler warnings (which prevents us from
enabling -Werror unconditionally).
2013-07-30 17:05:44 +02:00
Jiri Denemark
a718d28279 spec: RHEL-7 does not have sanlock on i686 2013-07-30 17:05:44 +02:00
Peter Krempa
9c7de20a2b spec: Disable libssh2 support for RHEL
https://bugzilla.redhat.com/show_bug.cgi?id=905513

Libssh2 isn't reliable enough to support the libvirt transport using it.
The problems include mishandling of "known_hosts" files that may confuse
users.
2013-07-30 17:05:43 +02:00
Jiri Denemark
df166a611b tests: Put a mock library at the start of LD_PRELOAD
This fixes vircgrouptest when run in a sandbox which already overrides
open() and others.
2013-07-30 17:05:43 +02:00
Daniel P. Berrange
6aa5ebbecd Support apparmor in RPM spec
If libapparmor-devel happens to be installed when building the
RPM, it will failed due to unlisted virt-aa-helper in %files.
Add support for apparmor in the spec, so that we can explicitly
turn it on/off, defaulting to off in all distros. This causes
--without-apparmor to be given to configure, preventing the
build failures if the user happens to have libapparmor-devel
present.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-30 14:13:58 +01:00
Daniel P. Berrange
5bb2a245ab Delete obsolete / unused python test files
The python/tests directory contains a number of so called
"tests" for the python API. These are all hardcoded to
look for Xen and cannot be run in any automated fashion,
and no one is ever manually running them. Given that they
don't meaningully contribute to the test coverage, delete
them.

For some reason these tests were also copied into the
filesystem as part of 'make install'. The change to the
RPM in commit 3347a42032
caused a build failure, since it removed the code which
deleted these installed tests.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-30 14:13:58 +01:00
Yuri Chornoivan
5b4c035b08 Fix minor typos in messages and docs
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-07-30 07:07:33 -06:00