]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agoAllow for multi-level inheritance of virObject classes
Daniel P. Berrange [Wed, 9 Jan 2013 17:37:27 +0000 (17:37 +0000)]
Allow for multi-level inheritance of virObject classes

Currently all classes must directly inherit from virObject.
This allows for arbitrarily deep hierarchy. There's not much
to this aside from chaining up the 'dispose' handlers from
each class & providing APIs to check types.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd 'lxc-enter-namespace' command to virsh
Daniel P. Berrange [Fri, 21 Dec 2012 16:51:33 +0000 (16:51 +0000)]
Add 'lxc-enter-namespace' command to virsh

Add a 'lxc-enter-namespace' command which accepts a domain name
and then a command + args to run, attached to the container

eg

  virsh -c lxc:/// lxc-enter-namespace demo -- /bin/ps -auxf

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agolibvirt: lxc: don't mkdir when selinux is disabled
Gao feng [Wed, 9 Jan 2013 11:20:59 +0000 (19:20 +0800)]
libvirt: lxc: don't mkdir when selinux is disabled

libvirt lxc will fail to start when selinux is disabled.
error: Failed to start domain noroot
error: internal error guest failed to start: PATH=/bin:/sbin TERM=linux container=lxc-libvirt container_uuid=b9873916-3516-c199-8112-1592ff694a9e LIBVIRT_LXC_UUID=b9873916-3516-c199-8112-1592ff694a9e LIBVIRT_LXC_NAME=noroot /bin/sh
2013-01-09 11:04:05.384+0000: 1: info : libvirt version: 1.0.1
2013-01-09 11:04:05.384+0000: 1: error : lxcContainerMountBasicFS:546 : Failed to mkdir /sys/fs/selinux: No such file or directory
2013-01-09 11:04:05.384+0000: 7536: info : libvirt version: 1.0.1
2013-01-09 11:04:05.384+0000: 7536: error : virLXCControllerRun:1466 : error receiving signal from container: Input/output error
2013-01-09 11:04:05.404+0000: 7536: error : virCommandWait:2287 : internal error Child process (ip link del veth1) unexpected exit status 1: Cannot find device "veth1"

fix this problem by checking if selinuxfs is mounted
in host before we try to create dir /sys/fs/selinux.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
12 years agobuild: add new file, for lxc_protocol checking
Eric Blake [Tue, 15 Jan 2013 18:54:57 +0000 (11:54 -0700)]
build: add new file, for lxc_protocol checking

Commit 509eb51 added lxc_protocol.x; but without the initial
checkin of src/lxc_protocol-structs, 'make check' would fail for
anyone with pdwtags installed:
make[3]: *** No rule to make target `lxc_protocol-structs', needed by `check-protocol'.  Stop.

* src/lxc_protocol-structs: New file.

12 years agoAdd implementation of virDomainLxcOpenNamespace to LXC driver
Daniel P. Berrange [Fri, 21 Dec 2012 14:22:31 +0000 (14:22 +0000)]
Add implementation of virDomainLxcOpenNamespace to LXC driver

The virDomainLxcOpenNamespace method needs to open every file
in /proc/$INITPID/ns and return the open file descriptor to the
client application.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoImplement the RPC protocol for the libvirt-lxc.la library
Daniel P. Berrange [Fri, 21 Dec 2012 14:20:04 +0000 (14:20 +0000)]
Implement the RPC protocol for the libvirt-lxc.la library

Add the infrastructure for the libvirt-lxc.la library to
the remote protocol client and daemon

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoxen: Resolve resource leak with 'cpuset'
John Ferlan [Thu, 10 Jan 2013 17:46:52 +0000 (12:46 -0500)]
xen: Resolve resource leak with 'cpuset'

Make cpuset local to the while loop and free it once done with it each
time through the loop.  Add a sa_assert() to virBitmapParse() to keep Coverity
from believing there could be a negative return and possible resource leak.

12 years agointerface: Resolve resource leak wth 'tmp_iface_objs'
John Ferlan [Wed, 9 Jan 2013 14:54:16 +0000 (09:54 -0500)]
interface: Resolve resource leak wth 'tmp_iface_objs'

12 years agostorage: Resource resource leak using 'tmp_vols'
John Ferlan [Wed, 9 Jan 2013 14:54:15 +0000 (09:54 -0500)]
storage: Resource resource leak using 'tmp_vols'

12 years agotest: Resource resource leak with 'tmp_vols'
John Ferlan [Wed, 9 Jan 2013 14:54:14 +0000 (09:54 -0500)]
test: Resource resource leak with 'tmp_vols'

12 years agorpc: Avoid resource leak of 'socks' if any object append fails
John Ferlan [Wed, 9 Jan 2013 14:54:12 +0000 (09:54 -0500)]
rpc: Avoid resource leak of 'socks' if any object append fails

12 years agoutil: Resolve resource leak for 'res' in virSetInherit error path.
John Ferlan [Wed, 9 Jan 2013 14:54:10 +0000 (09:54 -0500)]
util: Resolve resource leak for 'res' in virSetInherit error path.

12 years ago.gitignore: Sort alphabetically
Michal Privoznik [Tue, 15 Jan 2013 12:30:30 +0000 (13:30 +0100)]
.gitignore: Sort alphabetically

12 years agointerface: Need to initialize 'add_to_list'
John Ferlan [Tue, 8 Jan 2013 15:41:01 +0000 (10:41 -0500)]
interface: Need to initialize 'add_to_list'

12 years agolxc: Initialize dst due to potential cleanup usage before setting
John Ferlan [Tue, 8 Jan 2013 15:41:00 +0000 (10:41 -0500)]
lxc: Initialize dst due to potential cleanup usage before setting

12 years agoopenvz: Need to initialize 'ret' for kb_per_pages error path
John Ferlan [Tue, 8 Jan 2013 15:40:59 +0000 (10:40 -0500)]
openvz: Need to initialize 'ret' for kb_per_pages error path

12 years agoparallels: Resolve issues with uninitialized 'ret' value
John Ferlan [Tue, 8 Jan 2013 17:34:13 +0000 (12:34 -0500)]
parallels: Resolve issues with uninitialized 'ret' value

Added some messaging to indicate possible failure from virXPathULongLong()
as well

12 years agostorage: Need to also VIR_FREE(reg)
John Ferlan [Thu, 10 Jan 2013 19:44:26 +0000 (14:44 -0500)]
storage: Need to also VIR_FREE(reg)

Commit-id 'afc4631b' added the regfree(reg) to free resources alloc'd
during regcomp; however, reg still needed to be VIR_FREE()'d. The call
to regfree() also didn't account for possible NULL value.  Reformatted
the call to be closer to usage.

12 years agobuild: further fixes for broken if_bridge.h
Eric Blake [Mon, 14 Jan 2013 17:47:41 +0000 (10:47 -0700)]
build: further fixes for broken if_bridge.h

Commit c308a9ae was incomplete; it resolved the configure failure,
but not a later build failure.

* src/util/virnetdevbridge.c: Include pre-req header.
* configure.ac (AC_CHECK_HEADERS): Prefer standard in.h over
non-standard ip6.h.

12 years agodocs: remove extra "
Eric Blake [Mon, 14 Jan 2013 23:46:30 +0000 (16:46 -0700)]
docs: remove extra "

* tools/virsh.pod: Fix typo.

12 years agosecurityselinuxhelper.c: Don't try to include xattr.h if not available
John Ferlan [Mon, 14 Jan 2013 18:45:55 +0000 (13:45 -0500)]
securityselinuxhelper.c: Don't try to include xattr.h if not available

Commit 907a39e7 missed adding the WITH_ATTR around #include <attr/xattr.h>
resulting in a build failure:

  CC     libsecurityselinuxhelper_la-securityselinuxhelper.lo
  securityselinuxhelper.c:27:24: fatal error: attr/xattr.h: No such file or directory
  compilation terminated.
  make[2]: *** [libsecurityselinuxhelper_la-securityselinuxhelper.lo] Error 1
  make[2]: Leaving directory `/home/jferlan/libvirt.work/tests'
  make[1]: *** [all-recursive] Error 1
  make[1]: Leaving directory `/home/jferlan/libvirt.work'
  make: *** [all] Error 2

12 years agoAdd missing stubs to securityselinuxhelper.c
Daniel P. Berrange [Mon, 14 Jan 2013 18:33:44 +0000 (18:33 +0000)]
Add missing stubs to securityselinuxhelper.c

Make sure we override both the raw and non-raw stubs in
securityselinuxhelper.c. Also add diagnostics if
securityselinuxlabeltest fails a test item

12 years agoFix typo LIBCURL_{CFLAGS,LIBS} to CURL_{CFLAGS,LIBS}
Daniel P. Berrange [Mon, 14 Jan 2013 17:07:26 +0000 (17:07 +0000)]
Fix typo LIBCURL_{CFLAGS,LIBS} to CURL_{CFLAGS,LIBS}

Some places missed the conversion from LIBCURL_{CFLAGS,LIBS} to
CURL_{CFLAGS,LIBS}, and a part of curl check was left in
configure.ac instead of m4/virt-curl.m4 by mistake

12 years agobuild: work around broken kernel header
Eric Blake [Mon, 14 Jan 2013 16:54:25 +0000 (09:54 -0700)]
build: work around broken kernel header

I got this scary warning during ./configure on rawhide:

checking linux/if_bridge.h usability... no
checking linux/if_bridge.h presence... yes
configure: WARNING: linux/if_bridge.h: present but cannot be compiled
configure: WARNING: linux/if_bridge.h:     check for missing prerequisite headers?
configure: WARNING: linux/if_bridge.h: see the Autoconf documentation
configure: WARNING: linux/if_bridge.h:     section "Present But Cannot Be Compiled"
configure: WARNING: linux/if_bridge.h: proceeding with the compiler's result
configure: WARNING:     ## ------------------------------------- ##
configure: WARNING:     ## Report this to libvir-list@redhat.com ##
configure: WARNING:     ## ------------------------------------- ##
checking for linux/if_bridge.h... no

* configure.ac (AC_CHECK_HEADERS): Provide struct in6_addr, since
linux/if_bridge.h uses it without declaring it.

12 years agoFix build due to previous LXC patch
Daniel P. Berrange [Mon, 14 Jan 2013 16:34:51 +0000 (16:34 +0000)]
Fix build due to previous LXC patch

Mark virDomainLxcEnterNamespace as skipped in python binding
and remove reference to lxcDomainOpenNamespace which doesn't
arrive until a later patch

12 years agomaint: typo fix
Eric Blake [Mon, 14 Jan 2013 16:33:48 +0000 (09:33 -0700)]
maint: typo fix

I noticed this typo while configuring on a freshly-installed machine.

* m4/virt-udev.m4: Correct pciaccess name.

12 years agoIntroduce an LXC specific public API & library
Daniel P. Berrange [Fri, 21 Dec 2012 13:15:19 +0000 (13:15 +0000)]
Introduce an LXC specific public API & library

This patch introduces support for LXC specific public APIs. In
common with what was done for QEMU, this creates a libvirt_lxc.so
library and libvirt/libvirt-lxc.h header file.

The actual APIs are

  int virDomainLxcOpenNamespace(virDomainPtr domain,
                                int **fdlist,
                                unsigned int flags);

  int virDomainLxcEnterNamespace(virDomainPtr domain,
                                 unsigned int nfdlist,
                                 int *fdlist,
                                 unsigned int *noldfdlist,
                                 int **oldfdlist,
                                 unsigned int flags);

which provide a way to use the setns() system call to move the
calling process into the container's namespace. It is not
practical to write in a generically applicable manner. The
nearest that we could get to such an API would be an API which
allows to pass a command + argv to be executed inside a
container. Even if we had such a generic API, this LXC specific
API is still useful, because it allows the caller to maintain
the current process context, in particular any I/O streams they
have open.

NB the virDomainLxcEnterNamespace() API is special in that it
runs client side, so does not involve the internal driver API.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd a test suite for validating SELinux labelling
Daniel P. Berrange [Wed, 19 Sep 2012 13:00:34 +0000 (14:00 +0100)]
Add a test suite for validating SELinux labelling

There are many aspects of the guest XML which result in the
SELinux driver applying file labelling. With the increasing
configuration options it is desirable to test this behaviour.
It is not possible to assume that the test suite has the
ability to set SELinux labels. Most filesystems though will
support extended attributes. Thus for the purpose of testing,
it is possible to extend the existing LD_PRELOAD hack to
override setfilecon() and getfilecon() to simply use the
'user.libvirt.selinux' attribute for the sake of testing.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRename HAVE_POLKIT to WITH_POLKIT
Daniel P. Berrange [Tue, 8 Jan 2013 22:19:00 +0000 (22:19 +0000)]
Rename HAVE_POLKIT to WITH_POLKIT

12 years agoRemove unused XMLRPC_REQUIRED var
Daniel P. Berrange [Tue, 8 Jan 2013 22:10:57 +0000 (22:10 +0000)]
Remove unused XMLRPC_REQUIRED var

12 years agoConvert openwsman check to use LIBVIRT_CHECK_PKG
Daniel P. Berrange [Tue, 8 Jan 2013 22:08:53 +0000 (22:08 +0000)]
Convert openwsman check to use LIBVIRT_CHECK_PKG

12 years agoConvert ssh2 check to use LIBVIRT_CHECK_PKG
Daniel P. Berrange [Tue, 8 Jan 2013 21:47:55 +0000 (21:47 +0000)]
Convert ssh2 check to use LIBVIRT_CHECK_PKG

This converts the libssh2 configure check to use LIBVIRT_CHECK_PKG.
Previously it would check version 1.0 and 1.3, but this simplifies
things to just require version 1.3

12 years agoRename HAVE_LIBSSH2 to WITH_SSH2
Daniel P. Berrange [Tue, 8 Jan 2013 21:34:15 +0000 (21:34 +0000)]
Rename HAVE_LIBSSH2 to WITH_SSH2

12 years agoConvert curl check over to use LIBVIRT_CHECK_PKG
Daniel P. Berrange [Tue, 8 Jan 2013 21:31:58 +0000 (21:31 +0000)]
Convert curl check over to use LIBVIRT_CHECK_PKG

12 years agoRename HAVE_LIBCURL to WITH_CURL
Daniel P. Berrange [Tue, 8 Jan 2013 21:09:09 +0000 (21:09 +0000)]
Rename HAVE_LIBCURL to WITH_CURL

12 years agoConvert fuse check over to use LIBVIRT_CHECK_PKG
Daniel P. Berrange [Tue, 8 Jan 2013 21:06:57 +0000 (21:06 +0000)]
Convert fuse check over to use LIBVIRT_CHECK_PKG

12 years agoRename HAVE_FUSE to WITH_FUSE
Daniel P. Berrange [Tue, 8 Jan 2013 21:04:35 +0000 (21:04 +0000)]
Rename HAVE_FUSE to WITH_FUSE

12 years agoRename HAVE_GNUTLS to WITH_GNUTLS
Daniel P. Berrange [Tue, 8 Jan 2013 21:02:05 +0000 (21:02 +0000)]
Rename HAVE_GNUTLS to WITH_GNUTLS

12 years agoConvert blkid check over to use LIBVIRT_CHECK_PKG
Daniel P. Berrange [Thu, 20 Sep 2012 14:52:14 +0000 (15:52 +0100)]
Convert blkid check over to use LIBVIRT_CHECK_PKG

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert HAVE_LIBBLKID to WITH_BLKID
Daniel P. Berrange [Thu, 20 Sep 2012 14:43:12 +0000 (15:43 +0100)]
Convert HAVE_LIBBLKID to WITH_BLKID

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert HAL check to use LIBVIRT_CHECK_PKG
Daniel P. Berrange [Thu, 20 Sep 2012 14:39:12 +0000 (15:39 +0100)]
Convert HAL check to use LIBVIRT_CHECK_PKG

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert HAVE_HAL to WITH_HAL
Daniel P. Berrange [Thu, 20 Sep 2012 14:38:35 +0000 (15:38 +0100)]
Convert HAVE_HAL to WITH_HAL

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert udev/pciaccess checks to use LIBVIRT_CHECK_PKG
Daniel P. Berrange [Thu, 20 Sep 2012 14:34:13 +0000 (15:34 +0100)]
Convert udev/pciaccess checks to use LIBVIRT_CHECK_PKG

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert HAVE_UDEV to WITH_UDEV
Daniel P. Berrange [Thu, 20 Sep 2012 14:24:47 +0000 (15:24 +0100)]
Convert HAVE_UDEV to WITH_UDEV

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert avahi check to use LIBVIRT_CHECK_PKG
Daniel P. Berrange [Thu, 20 Sep 2012 14:22:09 +0000 (15:22 +0100)]
Convert avahi check to use LIBVIRT_CHECK_PKG

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert HAVE_AVAHI to WITH_AVAHI
Daniel P. Berrange [Thu, 20 Sep 2012 14:21:13 +0000 (15:21 +0100)]
Convert HAVE_AVAHI to WITH_AVAHI

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert DBus check to use LIBVIRT_CHECK_PKG
Daniel P. Berrange [Thu, 20 Sep 2012 14:12:08 +0000 (15:12 +0100)]
Convert DBus check to use LIBVIRT_CHECK_PKG

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert HAVE_DBUS to WITH_DBUS
Daniel P. Berrange [Thu, 20 Sep 2012 14:05:39 +0000 (15:05 +0100)]
Convert HAVE_DBUS to WITH_DBUS

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert netcf check to use LIBVIRT_CHECK_PKG
Daniel P. Berrange [Thu, 20 Sep 2012 14:14:52 +0000 (15:14 +0100)]
Convert netcf check to use LIBVIRT_CHECK_PKG

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert cap-ng check to use LIBVIRT_CHECK_LIB
Daniel P. Berrange [Thu, 20 Sep 2012 12:58:37 +0000 (13:58 +0100)]
Convert cap-ng check to use LIBVIRT_CHECK_LIB

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert HAVE_CAPNG to WITH_CAPNG
Daniel P. Berrange [Thu, 20 Sep 2012 14:17:56 +0000 (15:17 +0100)]
Convert HAVE_CAPNG to WITH_CAPNG

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert numactl checks to use LIBVIRT_CHECK_LIB
Daniel P. Berrange [Thu, 20 Sep 2012 12:47:23 +0000 (13:47 +0100)]
Convert numactl checks to use LIBVIRT_CHECK_LIB

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert HAVE_NUMACTL to WITH_NUMACTL
Daniel P. Berrange [Thu, 20 Sep 2012 12:41:15 +0000 (13:41 +0100)]
Convert HAVE_NUMACTL to WITH_NUMACTL

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert apparmor check to use LIBVIRT_CHECK_LIB
Daniel P. Berrange [Thu, 20 Sep 2012 12:28:45 +0000 (13:28 +0100)]
Convert apparmor check to use LIBVIRT_CHECK_LIB

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert selinux check to use LIBVIRT_CHECK_LIB
Daniel P. Berrange [Thu, 20 Sep 2012 12:21:48 +0000 (13:21 +0100)]
Convert selinux check to use LIBVIRT_CHECK_LIB

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert HAVE_SELINUX to WITH_SELINUX
Daniel P. Berrange [Thu, 20 Sep 2012 12:17:58 +0000 (13:17 +0100)]
Convert HAVE_SELINUX to WITH_SELINUX

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agodocs: restrict the set of characters for info keys
Claudio Bley [Fri, 11 Jan 2013 10:39:19 +0000 (11:39 +0100)]
docs: restrict the set of characters for info keys

When parsing the top level comment of a file, apibuild.py used
to split on any ':' character of a line regarding the first part
as a key for a setting, e.g. "Summary". The second part would then
be assigned as the value for that key.

This means you could not use a ':' character inside those comments
without ill effects.

Now, a key must consist solely of alphanumeric characters, '_' or '.'.

12 years agodocs: simplify code
Claudio Bley [Thu, 10 Jan 2013 15:02:23 +0000 (16:02 +0100)]
docs: simplify code

12 years agobuild: avoid m4_expand for RHEL 5
Eric Blake [Fri, 11 Jan 2013 18:30:55 +0000 (11:30 -0700)]
build: avoid m4_expand for RHEL 5

Problem introduced in commit cd699ed.

* m4/virt-lib.m4 (LIBVIRT_CHECK_LIB, LIBVIRT_CHECK_PKG): Set up
direct expansions, since autoconf 2.59 lacked m4_expand.

12 years agodocs: mention git rename detection
Eric Blake [Fri, 11 Jan 2013 00:39:04 +0000 (17:39 -0700)]
docs: mention git rename detection

I've noticed a number of people sending patches with file
renames not compressed, so we might as well document how to
set this up.  (Git won't do it by default, for back-compat
reasons)

* docs/hacking.html.in: Add git config tip.
* HACKING: Regenerate.

12 years agodocs: add some more hacking tips
Eric Blake [Fri, 4 Jan 2013 17:27:16 +0000 (10:27 -0700)]
docs: add some more hacking tips

Based on a suggestion by John Ferlan:
https://www.redhat.com/archives/libvir-list/2013-January/msg00158.html

* docs/hacking.html.in: Add some commit message instructions.
Mention the ./run script.
* HACKING: Regenerate.

12 years agobuild: fix incomplete WITH_SASL conversion
Eric Blake [Fri, 11 Jan 2013 17:29:03 +0000 (10:29 -0700)]
build: fix incomplete WITH_SASL conversion

Commit 321a7d53 missed a spot.

* src/rpc/virnetsocket.c (virNetSocketPreExecRestart): Use right
conditional.

12 years agoqemu: Fix grouping of capabilities strings
Peter Krempa [Fri, 11 Jan 2013 16:43:49 +0000 (17:43 +0100)]
qemu: Fix grouping of capabilities strings

Commit f8d478b6dfc46a0ad2459844b96937599dec06e1 broke the grouping by
five items.

12 years agonetwork: Report real error if addition of firewall rules fails
Peter Krempa [Fri, 11 Jan 2013 10:38:30 +0000 (11:38 +0100)]
network: Report real error if addition of firewall rules fails

If addition of rules in networkAddIptablesRules() failed the real error
was masked by error reported when trying to clean up the remaining
rules.

With this patch the original error message is saved and set back after
the removal is complete.

12 years agovirsh: Reformat output of virsh net-list
Peter Krempa [Fri, 11 Jan 2013 10:14:54 +0000 (11:14 +0100)]
virsh: Reformat output of virsh net-list

This patch changes whitespace and the length of the separation line from
this format:

$ virsh net-list --all
Name                 State      Autostart     Persistent
--------------------------------------------------
default              inactive   yes           yes

to

$ virsh net-list --all
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 default              inactive   yes           yes

to match the output of virsh list.

12 years agonetwork: bridge: Fix regression when defining persistent networks
Peter Krempa [Fri, 11 Jan 2013 10:10:34 +0000 (11:10 +0100)]
network: bridge: Fix regression when defining persistent networks

Commit 0211fd6e04cdc402da20818df54299c6ded3d3cb introduced regression
where newly defined networks were not made persistent.

This patch makes the network persistent on each successful definition.

12 years agoConvert audit check to use LIBVIRT_CHECK_LIB
Daniel P. Berrange [Thu, 20 Sep 2012 12:12:40 +0000 (13:12 +0100)]
Convert audit check to use LIBVIRT_CHECK_LIB

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert HAVE_AUDIT to WITH_AUDIT
Daniel P. Berrange [Thu, 20 Sep 2012 12:00:09 +0000 (13:00 +0100)]
Convert HAVE_AUDIT to WITH_AUDIT

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert sasl check to use LIBVIRT_CHECK_LIB_ALT
Daniel P. Berrange [Thu, 20 Sep 2012 12:06:12 +0000 (13:06 +0100)]
Convert sasl check to use LIBVIRT_CHECK_LIB_ALT

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert HAVE_SASL to WITH_SASL
Daniel P. Berrange [Thu, 20 Sep 2012 11:58:29 +0000 (12:58 +0100)]
Convert HAVE_SASL to WITH_SASL

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert sanlock check to use LIBVIRT_CHECK_LIB
Daniel P. Berrange [Thu, 20 Sep 2012 12:04:57 +0000 (13:04 +0100)]
Convert sanlock check to use LIBVIRT_CHECK_LIB

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert HAVE_SANLOCK to WITH_SANLOCK
Daniel P. Berrange [Thu, 20 Sep 2012 11:58:07 +0000 (12:58 +0100)]
Convert HAVE_SANLOCK to WITH_SANLOCK

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert yajl check to use LIBVIRT_CHECK_LIB_ALT
Daniel P. Berrange [Thu, 20 Sep 2012 12:03:27 +0000 (13:03 +0100)]
Convert yajl check to use LIBVIRT_CHECK_LIB_ALT

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert HAVE_YAJL into WITH_YAJL
Daniel P. Berrange [Thu, 20 Sep 2012 11:57:13 +0000 (12:57 +0100)]
Convert HAVE_YAJL into WITH_YAJL

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd some autoconf helper macros for checking for libraries
Daniel P. Berrange [Wed, 19 Sep 2012 17:46:30 +0000 (18:46 +0100)]
Add some autoconf helper macros for checking for libraries

Most checks for libraries take the same format

  * --with-libFOO=yes|no|check|/some/path  argument
  * check for a function NNN in libFOO.so
  * check for a header file DDD/HHH.h
  * Define a WITH_FOO config.h symbol
  * Define a WITH_FOO make conditional
  * Substitute FOO_CFLAGS and FOO_LIBS make variables
  * Print CFLAGS & LIBS summary at the end

Doing all this correctly is rather difficult, typically
done by copy+paste of a previous usage. Further small
improvements people make are not applied to all previous
usages.

Improve this by creating some helper macros to apply
good practice. First, to perform the actual checks:

  LIBVIRT_CHECK_LIB([SELINUX], [selinux],
     [getfilecon], [selinux/selinux.h])

This checks for 'getfilecon' in -lselinux, and the
existence of 'selinux/selinux.h' header file. If successful
it sets SELINUX_CFLAGS and SELINUX_LIBS. The WITH_SELINUX
config.h macro and WITH_SELINUX make conditional are also
defined.

In some cases we need to check two variants of the same
library

  LIBVIRT_CHECK_LIB_ALT([SASL], [sasl2],
                        [sasl_client_init], [sasl/sasl.h],
                        [SASL1], [sasl],
                        [sasl_client_init], [sasl/sasl.h])

This checks for sasl_client_init in libsasl2, and if that
is not found, checks sasl_client_init in libsasl. If the
first check succeeds WITH_SASL is set, while if the second
check succeeds *both* WITH_SASL and WITH_SASL1 are set.

If the library supports pkg-config, then another variant
is available

  LIBVIRT_CHECK_PKG([AVAHI], [avahi-client], [0.6.0])

This checks for avahi-client >= 0.6.0 via pkg-config
and sets WITH_AVAHI if found.

Finally to print a summary of CFLAGS & LIBs found (if any):

  LIBVIRT_RESULT_LIB([SELINUX])

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agobuild: require avahi instead of avahi-libs on rhel5.
Yufang Zhang [Thu, 10 Jan 2013 12:44:01 +0000 (20:44 +0800)]
build: require avahi instead of avahi-libs on rhel5.

On rhel5, libs of avahi are packaged into avahi instead of avahi-libs.
Actually, there is no avahi-libs package shipped with rhel5. This patch
fixes this by requiring avahi on rhel5.

12 years agostorage: Resolve resource leak using 'vol' buffer
John Ferlan [Wed, 9 Jan 2013 14:54:09 +0000 (09:54 -0500)]
storage: Resolve resource leak using 'vol' buffer

12 years agophyp: Resolve some file descriptor leaks
John Ferlan [Thu, 10 Jan 2013 19:21:02 +0000 (14:21 -0500)]
phyp: Resolve some file descriptor leaks

The phypUUIDTable_Push and phypUUIDTable_Pull leaked their file descriptors
on normal return.  Each function had an unnecessary use of creating a buffer
to print conn->uri->user and needed a bit better flow control. I also noted
that the Read function had a cut-n-paste error from the write function on a
couple of VIR_WARN's.

The openSSHSession leaked the sock on the failure path.  Additionally that
turns into the internal_socket in the phypOpen code.  That was neither saved
nor closed on any path. So I used the connnection_data->sock field to save
the socket for eventual close. Of interest here is that phypExec used the
connection_data->sock field even though it had never been initialized.

12 years agomaint: don't distribute generated .def files
Eric Blake [Wed, 9 Jan 2013 22:07:30 +0000 (15:07 -0700)]
maint: don't distribute generated .def files

I ran 'make dist' in the directory left over from ./autobuild.sh
(which was configured for a mingw cross build); the resulting
tarball had more files than 'make dist' on a normal Linux build.
I traced it to the fact that we were distributing a generated
file, but only when configure said the end user had to generate
the file in the first place.  In the process, I noticed that
we had some difference in symbol file names; I added a comment
explaining why the difference exists (after first trying to
normalize the names and hitting VPATH build failures).

* configure.ac (LIBVIRT_QEMU_SYMBOL_FILE): Add some comments.
* src/Makefile.am (EXTRA_DIST): No need to ship a generated file;
particularly since which file is built depends on configure results.

12 years agospec: remove redundant %if
Eric Blake [Wed, 9 Jan 2013 18:39:45 +0000 (11:39 -0700)]
spec: remove redundant %if

The daemon-driver-{qemu,lxc} packages are only built if
%{with_driver_modules} is specified, so they do not need to
further test this condition.  Likewise, the daemon package
is only built if %{with_libvirtd} is specified, so it does
not need to further test this condition.

* libvirt.spec.in (daemon-driver-qemu, daemon-driver-lxc):
Unconditionally require libvirt-daemon-driver-network.
(daemon): Unconditionally include lock-driver files.

12 years agodocs: fix typo in isa-serial additions
Laine Stump [Thu, 10 Jan 2013 19:26:11 +0000 (14:26 -0500)]
docs: fix typo in isa-serial additions

This was preventing make rpm from completing.

12 years agoutil: reduce syscalls for virGetDeviceID
Eric Blake [Wed, 9 Jan 2013 23:34:15 +0000 (16:34 -0700)]
util: reduce syscalls for virGetDeviceID

There's no need to do lots of readlink() calls to canonicalize
a name if we're only going to use stat() on it, since stat()
already chases symlinks.

* src/util/virutil.c (virGetDeviceID): Let stat() do the symlink
chasing.

12 years agopass stub driver name instead of pciFindStubDriver
Chunyan Liu [Thu, 10 Jan 2013 07:51:43 +0000 (15:51 +0800)]
pass stub driver name instead of pciFindStubDriver

Pass stub driver name directly to pciDettachDevice and pciReAttachDevice to fit
for different libvirt drivers. For example, qemu driver prefers pci-stub, but
Xen prefers pciback.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
12 years agoqemu: add usb-net caps flag
Guannan Ren [Thu, 3 Jan 2013 07:13:05 +0000 (15:13 +0800)]
qemu: add usb-net caps flag

QEMU_CAPS_DEVICE_USB_NET /* -device usb-net */

12 years agonetwork: fix typos and docs
Guannan Ren [Thu, 3 Jan 2013 07:13:04 +0000 (15:13 +0800)]
network: fix typos and docs

12 years agoqemu: add usb-serial support
Guannan Ren [Sat, 5 Jan 2013 05:25:36 +0000 (13:25 +0800)]
qemu: add usb-serial support

Add an optional 'type' attribute to <target> element of serial port
device. There are two choices for its value, 'isa-serial' and
'usb-serial'. For backward compatibility, when attribute 'type' is
missing the 'isa-serial' will be chosen as before.

Libvirt XML sample

    <serial type='pty'>
      <target type='usb-serial' port='0'/>
      <address type='usb' bus='0' port='1'/>
    </serial>

qemu commandline:

qemu ${other_vm_args}              \
    -chardev pty,id=charserial0    \
    -device usb-serial,chardev=charserial0,id=serial0,bus=usb.0,port=1

12 years agoqemu: add usb-serial caps flag
Guannan Ren [Thu, 3 Jan 2013 06:57:25 +0000 (14:57 +0800)]
qemu: add usb-serial caps flag

QEMU_CAPS_DEVICE_USB_SERIAL /* -device usb-serial */

12 years agolibvirt.h.in: Fix indentation
Michal Privoznik [Thu, 10 Jan 2013 12:49:09 +0000 (13:49 +0100)]
libvirt.h.in: Fix indentation

With the most recent patch from Claudio, I realized how many
indentation flaws we have in the libvirt.h.in file. Even though
they are harmless, it's still worth fixing them.

12 years agoFix wrong indentation for virDomainState
Claudio Bley [Thu, 10 Jan 2013 11:44:23 +0000 (12:44 +0100)]
Fix wrong indentation for virDomainState

12 years agoqemu_agent: Remove agent reference only when disposing it
Michal Privoznik [Wed, 9 Jan 2013 11:33:45 +0000 (12:33 +0100)]
qemu_agent: Remove agent reference only when disposing it

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

With current code, if user calls virDomainPMSuspendForDuration()
followed by virDomainDestroy(), the former API checks for qemu agent
presence, which will evaluate as true (if agent is configured). While
talking to qemu agent, the qemu driver is unlocked, so the latter API
starts executing.  However, if machine dies meanwhile, libvirtd gets
EOF on the agent socket and qemuProcessHandleAgentEOF() is called. The
handler clears reference to qemu agent while the destroy API already
holding a reference to it. This leads to NULL dereferencing later in
the code. Therefore, the agent pointer should be set to NULL only if
we are the exclusive owner of it.

12 years agobuild: move file deleting action from %files list to %install
Yufang Zhang [Wed, 9 Jan 2013 12:18:35 +0000 (20:18 +0800)]
build: move file deleting action from %files list to %install

When building libvirt rpms on rhel5, I got the following error:

    File must begin with "/": rm
    File must begin with "/": -f
    File must begin with "/": $RPM_BUILD_ROOT/etc/sysctl.d/libvirtd
    Installed (but unpackaged) file(s) found:
   /etc/sysctl.d/libvirtd

It is triggerd by the %files list of libvirt daemon:

    %if 0%{?fedora} >= 14 || 0%{?rhel} >= 6
    %config(noreplace) %{_prefix}/lib/sysctl.d/libvirtd.conf
    %else
    rm -f $RPM_BUILD_ROOT%{_prefix}/lib/sysctl.d/libvirtd.conf
    %endif

After checking document of rpm spec file, I think it would be better
to move the file deleting line from %files list to %install script.

Bug introduced in commit a1fd56c.

12 years agomaint: fix comment typo
Eric Blake [Wed, 9 Jan 2013 23:39:18 +0000 (16:39 -0700)]
maint: fix comment typo

While OOM can have knock-on effects that trash a system, generally
the first symptom is one of memory thrashing.

* src/qemu/qemu_cgroup.c (qemuSetupCgroup): Reword slightly.

12 years agomaint: distribute libvirtd.service.in
Eric Blake [Wed, 9 Jan 2013 21:36:25 +0000 (14:36 -0700)]
maint: distribute libvirtd.service.in

I did a build --without-libvirtd, then ran 'make dist'.  The
resulting tarball was broken, with a complaint that make did not
know how to create libvirtd.service.in.  I traced it to a use
of EXTRA_DIST inside a conditional.

* daemon/Makefile.am (EXTRA_DIST): Hoist libvirtd.service.in
outside of WITH_LIBVIRTD conditional.

12 years agolibvirt: lxc: fix incorrect parameter of lxcContainerMountProcFuse
Gao feng [Wed, 9 Jan 2013 11:01:11 +0000 (19:01 +0800)]
libvirt: lxc: fix incorrect parameter of lxcContainerMountProcFuse

when we has no host's src mapped to container.
there is no .oldroot dir,so libvirt lxc will fail
to start when mouting meminfo.

in this case,the parameter srcprefix of function
lxcContainerMountProcFuse should be NULL.and make
this method handle NULL correctly.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
12 years agoAdd RESUME event listener to qemu monitor.
Andres Lagar-Cavilla [Mon, 7 Jan 2013 21:25:01 +0000 (16:25 -0500)]
Add RESUME event listener to qemu monitor.

Perform all the appropriate plumbing.

When qemu/KVM VMs are paused manually through a monitor not-owned by libvirt,
libvirt will think of them as "paused" event after they are resumed and
effectively running. With this patch the discrepancy goes away.

This is meant to address bug 892791.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
12 years agodocs: break longer text into paragraphs in HTML
Claudio Bley [Tue, 8 Jan 2013 13:55:12 +0000 (14:55 +0100)]
docs: break longer text into paragraphs in HTML

Libvirt's HTML documentation is not as easy to the eyes as it could
be since long text has no visual breaks.

Take advantage of the formatting in documentation comments and wrap
each part separated by two consecutive \n into a HTML <p> element.

12 years agotests: Remove remnants of removing the fake emulator output
John Ferlan [Tue, 8 Jan 2013 21:21:51 +0000 (16:21 -0500)]
tests: Remove remnants of removing the fake emulator output

Coverity determined that 'emulator' could no longer be set and determined the
code was dead.  Looking through the history, I discovered commit-id ed769e18
removed code originally added by commit-id 9237e955 and further modified by
commit-id 6a7e7c4f.

12 years agonwfilter: Remove unprivileged code path to set base
John Ferlan [Tue, 8 Jan 2013 21:21:50 +0000 (16:21 -0500)]
nwfilter: Remove unprivileged code path to set base

Commit id f8ab364c removed ability to run this driver unprivileged. Coverity
detected the check and flagged it.

12 years agophyp: Remove deadcode referencing exit_status
John Ferlan [Tue, 8 Jan 2013 21:21:49 +0000 (16:21 -0500)]
phyp: Remove deadcode referencing exit_status

Remove remnants from commit id '89144534'

12 years agoMake TLS support conditional
Daniel P. Berrange [Mon, 7 Jan 2013 14:54:18 +0000 (14:54 +0000)]
Make TLS support conditional

Add checks for existence of GNUTLS and automatically disable
it if not found.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>