[libvirt] [PATCHv2] build: add configure option to disable gnulib tests
by Eric Blake
The gnulib testsuite is relatively stable - the only times it is
likely to have a test change from pass to fail is on a gnulib
submodule update or a major system change (such as moving from
Fedora 18 to 19, or other large change to libc). While it is an
important test for end users on arbitrary machines (to make sure
that the portability glue works for their machine), it mostly
wastes time for development testing (as most developers aren't
making any of the major changes that would cause gnulib tests
to alter behavior). Thus, it pays to make the tests optional
at configure time, defaulting to off for development, on for
tarballs, with autobuilders requesting it to be on. It also
helps to allow a make-time override, via VIR_TEST_EXPENSIVE=[01]
(much the way automake sets up V=[01] for overriding the configure
time default of how verbose to be).
Automake has some pretty hard-coded magic with regards to the
TESTS variable; I had quite a job figuring out how to keep
'make distcheck' passing regardless of the configure option
setting in use, while still disabling the tests at runtime
when I did not configure them on and did not use the override
variable. Thankfully, we require GNU make, which lets me
hide some information from Automake's magic handling of TESTS.
* bootstrap.conf (bootstrap_epilogue): Munge gnulib test variable.
* configure.ac (--enable-expensive-tests): Add new enable switch.
(VIR_TEST_EXPENSIVE_DEFAULT, WITH_EXPENSIVE_TESTS): Set new
witnesses.
* gnulib/tests/Makefile.am (TESTS): Make tests conditional on
configure settings and the VIR_TEST_EXPENSIVE variable.
* tests/Makefile.am (TESTS_ENVIRONMENT): Expose VIR_TEST_EXPENSIVE
to all tests.
* autobuild.sh: Enable all tests during autobuilds.
* libvirt.spec.in (%configure): Likewise.
* mingw-libvirt.spec.in (%mingw_configure): Likewise.
* docs/hacking.html.in: Document the option.
* HACKING: Regenerate.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
v2: Change the configure name from --enable-gnulib-tests
to --enable-expensive-tests; make VIR_TEST_EXPENSIVE=0
work to give a one-shot disable of tests at make time;
export the configure default on to all tests
HACKING | 9 +++++++++
autobuild.sh | 3 +++
bootstrap.conf | 3 ++-
configure.ac | 21 +++++++++++++++++++++
docs/hacking.html.in | 12 ++++++++++++
gnulib/tests/Makefile.am | 15 ++++++++++++++-
libvirt.spec.in | 1 +
mingw-libvirt.spec.in | 4 ++--
tests/Makefile.am | 2 ++
9 files changed, 66 insertions(+), 4 deletions(-)
diff --git a/HACKING b/HACKING
index 207b9ed..256e8ae 100644
--- a/HACKING
+++ b/HACKING
@@ -107,6 +107,15 @@ and run the tests:
Valgrind <http://valgrind.org/> is a test that checks for memory management
issues, such as leaks or use of uninitialized variables.
+Some tests are skipped by default in a development environment, based on the
+time they take in comparison to the likelihood that those tests will turn up
+problems during incremental builds. These tests default to being run when when
+building from a tarball or with the configure option --enable-expensive-tests;
+you can also force a one-time toggle of these tests by setting
+VIR_TEST_EXPENSIVE to 0 or 1 at make time, as in:
+
+ make check VIR_TEST_EXPENSIVE=1
+
If you encounter any failing tests, the VIR_TEST_DEBUG environment variable
may provide extra information to debug the failures. Larger values of
VIR_TEST_DEBUG may provide larger amounts of information:
diff --git a/autobuild.sh b/autobuild.sh
index 7da8cb5..e5aa35c 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -18,6 +18,7 @@ cd build
# Run with options not normally exercised by the rpm build, for
# more complete code coverage.
../autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \
+ --enable-expensive-tests \
--enable-test-coverage \
--disable-nls \
--enable-werror \
@@ -76,6 +77,7 @@ if test -x /usr/bin/i686-w64-mingw32-gcc ; then
--build=$(uname -m)-w64-linux \
--host=i686-w64-mingw32 \
--prefix="$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw" \
+ --enable-expensive-tests \
--enable-werror \
--without-libvirtd \
--without-python
@@ -96,6 +98,7 @@ if test -x /usr/bin/x86_64-w64-mingw32-gcc ; then
--build=$(uname -m)-w64-linux \
--host=x86_64-w64-mingw32 \
--prefix="$AUTOBUILD_INSTALL_ROOT/x86_64-w64-mingw32/sys-root/mingw" \
+ --enable-expensive-tests \
--enable-werror \
--without-libvirtd \
--without-python
diff --git a/bootstrap.conf b/bootstrap.conf
index f166a53..a1d1f07 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -244,9 +244,10 @@ gnulib_extra_files="
bootstrap_epilogue()
{
# Change paths in gnulib/tests/gnulib.mk from "../../.." to "../..",
+ # and make tests conditional by changing "TESTS" to "GNULIB_TESTS",
# then ensure that gnulib/tests/Makefile.in is up-to-date.
m=gnulib/tests/gnulib.mk
- sed 's,\.\./\.\./\.\.,../..,g' $m > $m-t
+ sed 's,\.\./\.\./\.\.,../..,g; s/^TESTS /GNULIB_TESTS /' $m > $m-t
mv -f $m-t $m
${AUTOMAKE-automake} gnulib/tests/Makefile
}
diff --git a/configure.ac b/configure.ac
index a155790..2c8cb86 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1987,6 +1987,27 @@ fi
AC_MSG_RESULT([$withval])
AM_CONDITIONAL([WITH_TESTS], [test "$withval" = "yes"])
+AC_ARG_ENABLE([expensive-tests],
+ [AC_HELP_STRING([--enable-expensive-tests],
+ [set the default for enabling expensive tests (gnulib and long timeouts) ]
+ [@<:@default=check@:>@; use VIR_TEST_EXPENSIVE to override during make])],
+ [case $enableval in
+ 0|no) VIR_TEST_EXPENSIVE_DEFAULT=0 ;;
+ 1|yes) VIR_TEST_EXPENSIVE_DEFAULT=1 ;;
+ check) ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for enable-expensive-tests option])
+ ;;
+ esac], [enableval=check])
+if test "$enableval" = check; then
+ if test -d $srcdir/.git ; then
+ VIR_TEST_EXPENSIVE_DEFAULT=0
+ else
+ VIR_TEST_EXPENSIVE_DEFAULT=1
+ fi
+fi
+AC_SUBST([VIR_TEST_EXPENSIVE_DEFAULT])
+AM_CONDITIONAL([WITH_EXPENSIVE_TESTS], [test $VIR_TEST_EXPENSIVE_DEFAULT = 1])
+
AC_ARG_ENABLE([test-coverage],
AC_HELP_STRING([--enable-test-coverage], [turn on code coverage instrumentation @<:@default=no@:>@]),
[case "${enableval}" in
diff --git a/docs/hacking.html.in b/docs/hacking.html.in
index 8120b19..0892b73 100644
--- a/docs/hacking.html.in
+++ b/docs/hacking.html.in
@@ -119,6 +119,18 @@
</p>
<p>
+ Some tests are skipped by default in a development environment,
+ based on the time they take in comparison to the likelihood
+ that those tests will turn up problems during incremental builds.
+ These tests default to being run when when building from a
+ tarball or with the configure option --enable-expensive-tests;
+ you can also force a one-time toggle of these tests by
+ setting VIR_TEST_EXPENSIVE to 0 or 1 at make time, as in:
+ </p>
+<pre>
+ make check VIR_TEST_EXPENSIVE=1
+</pre>
+ <p>
If you encounter any failing tests, the VIR_TEST_DEBUG
environment variable may provide extra information to debug
the failures. Larger values of VIR_TEST_DEBUG may provide
diff --git a/gnulib/tests/Makefile.am b/gnulib/tests/Makefile.am
index 6a2f51b..74d71e9 100644
--- a/gnulib/tests/Makefile.am
+++ b/gnulib/tests/Makefile.am
@@ -1,4 +1,4 @@
-## Makefile for gnulib/lib -*-Makefile-*-
+## Makefile for gnulib/lib
## Copyright (C) 2011, 2013 Red Hat, Inc.
##
@@ -19,3 +19,16 @@
include gnulib.mk
INCLUDES = $(GETTEXT_CPPFLAGS)
+
+GNULIB_TESTS0 =
+GNULIB_TESTS1 = $(GNULIB_TESTS)
+if WITH_EXPENSIVE_TESTS
+## Automake requires that at least one conditional call out all tests to
+## be run, for those tests to be shipped in the tarball
+TESTS = $(GNULIB_TESTS)
+endif
+## However, we want to change the set of tests based on the make environment,
+## where the default was set at configure time. Use GNU make constructs to
+## hide our actions from Automake, so we don't get it too confused.
+VIR_TEST_EXPENSIVE ?= $(VIR_TEST_EXPENSIVE_DEFAULT)
+$(eval TESTS=$(GNULIB_TESTS$(VIR_TEST_EXPENSIVE)))
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 79c5a2c..114b144 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1408,6 +1408,7 @@ of recent versions of Linux (and other OSes).
--with-qemu-user=%{qemu_user} \
--with-qemu-group=%{qemu_group} \
%{?enable_werror} \
+ --enable-expensive-tests \
%{init_scripts}
make %{?_smp_mflags}
gzip -9 ChangeLog
diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in
index aa39231..e13407e 100644
--- a/mingw-libvirt.spec.in
+++ b/mingw-libvirt.spec.in
@@ -156,8 +156,8 @@ autoreconf -if
--without-parallels \
--without-netcf \
--without-audit \
- --without-dtrace
-
+ --without-dtrace \
+ --enable-expensive-tests
%mingw_make %{?_smp_mflags}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 789de9f..66ae610 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -307,6 +307,7 @@ lv_abs_top_builddir=`cd '$(top_builddir)'; pwd`
path_add = $(subst :,$(PATH_SEPARATOR),\
$(subst !,$(lv_abs_top_builddir)/,!daemon:!tools:!tests))
+VIR_TEST_EXPENSIVE ?= $(VIR_TEST_EXPENSIVE_DEFAULT)
TESTS_ENVIRONMENT = \
abs_top_builddir=$(lv_abs_top_builddir) \
abs_top_srcdir=`cd '$(top_srcdir)'; pwd` \
@@ -318,6 +319,7 @@ TESTS_ENVIRONMENT = \
LIBVIRT_DRIVER_DIR="$(abs_top_builddir)/src/.libs" \
LIBVIRT_AUTOSTART=0 \
LC_ALL=C \
+ VIR_TEST_EXPENSIVE=$(VIR_TEST_EXPENSIVE) \
$(VG)
--
1.8.3.1
11 years, 3 months
[libvirt] [PATCHv3] build: avoid -lgcrypt with newer gnutls
by Eric Blake
https://bugzilla.redhat.com/show_bug.cgi?id=951637
Newer gnutls uses nettle, rather than gcrypt, which is a lot nicer
regarding initialization. Yet we were unconditionally initializing
gcrypt even when gnutls wouldn't be using it, and having two crypto
libraries linked into libvirt.so is pointless, but mostly harmless
(it doesn't crash, but does interfere with certification efforts).
There are three distinct version ranges to worry about when
determining which crypto lib gnutls uses, per these gnutls mails:
2.12: http://lists.gnu.org/archive/html/gnutls-devel/2011-03/msg00034.html
3.0: http://lists.gnu.org/archive/html/gnutls-devel/2011-07/msg00035.html
If pkg-config can prove version numbers and/or list the crypto
library used for static linking, we have our proof; if not, it
is safer (even if pointless) to continue to use gcrypt ourselves.
* configure.ac (WITH_GNUTLS): Probe whether to add -lgcrypt, and
define a witness WITH_GNUTLS_GCRYPT.
* src/libvirt.c (virTLSMutexInit, virTLSMutexDestroy)
(virTLSMutexLock, virTLSMutexUnlock, virTLSThreadImpl)
(virGlobalInit): Honor the witness.
* libvirt.spec.in (BuildRequires): Make gcrypt usage conditional,
no longer needed in Fedora 19.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
v3: configure logic is enhanced to try harder to get the
right answer for gentoo. I tested with Fedora 19 and RHEL 6,
but need feedback from a gentoo tester before this can go in.
configure.ac | 37 ++++++++++++++++++++++++++++++-------
libvirt.spec.in | 2 ++
src/libvirt.c | 10 ++++++----
3 files changed, 38 insertions(+), 11 deletions(-)
diff --git a/configure.ac b/configure.ac
index 1817126..e3d148c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1076,12 +1076,26 @@ if test "x$with_gnutls" != "xno"; then
LIBS="$LIBS $GNUTLS_LIBS"
GNUTLS_FOUND=no
+ GNUTLS_GCRYPT=unknown
if test -x "$PKG_CONFIG" ; then
+ dnl Triple probe: gnutls < 2.12 only used gcrypt, gnutls >= 3.0 uses
+ dnl only nettle, and versions in between had a configure option.
+ dnl Our goal is to avoid gcrypt if we can prove gnutls uses nettle,
+ dnl but it is a safe fallback to use gcrypt if we can't prove anything.
+ if $PKG_CONFIG --exists 'gnutls >= 3.0'; then
+ GNUTLS_GCRYPT=no
+ elif $PKG_CONFIG --exists 'gnutls >= 2.12'; then
+ GNUTLS_GCRYPT=probe
+ else
+ GNUTLS_GCRYPT=yes
+ fi
PKG_CHECK_MODULES(GNUTLS, gnutls >= $GNUTLS_REQUIRED,
[GNUTLS_FOUND=yes], [GNUTLS_FOUND=no])
fi
if test "$GNUTLS_FOUND" = "no"; then
+ dnl pkg-config couldn't help us, assume gcrypt is necessary
fail=0
+ GNUTLS_GCRYPT=yes
AC_CHECK_HEADER([gnutls/gnutls.h], [], [fail=1])
AC_CHECK_LIB([gnutls], [gnutls_handshake],[], [fail=1], [-lgcrypt])
@@ -1098,13 +1112,22 @@ if test "x$with_gnutls" != "xno"; then
AC_MSG_ERROR([You must install the GnuTLS library in order to compile and run libvirt])
fi
else
- dnl Not all versions of gnutls include -lgcrypt, and so we add
- dnl it explicitly for the calls to gcry_control/check_version
- GNUTLS_LIBS="$GNUTLS_LIBS -lgcrypt"
-
- dnl We're not using gcrypt deprecated features so define
- dnl GCRYPT_NO_DEPRECATED to avoid deprecated warnings
- GNUTLS_CFLAGS="$GNUTLS_CFLAGS -DGCRYPT_NO_DEPRECATED"
+ dnl See comments above about when to use gcrypt.
+ if test "$GNUTLS_GCRYPT" = probe; then
+ case `$PKG_CONFIG --libs --static gnutls` in
+ *gcrypt*) GNUTLS_GCRYPT=yes ;;
+ *nettle*) GNUTLS_GCRYPT=no ;;
+ *) GNUTLS_GCRYPT=unknown ;;
+ esac
+ fi
+ if test "$GNUTLS_GCRYPT" = yes || test "$GNUTLS_GCRYPT" = unknown; then
+ GNUTLS_LIBS="$GNUTLS_LIBS -lgcrypt"
+ dnl We're not using gcrypt deprecated features so define
+ dnl GCRYPT_NO_DEPRECATED to avoid deprecated warnings
+ GNUTLS_CFLAGS="$GNUTLS_CFLAGS -DGCRYPT_NO_DEPRECATED"
+ AC_DEFINE_UNQUOTED([WITH_GNUTLS_GCRYPT], 1,
+ [set to 1 if it is known or assumed that GNUTLS uses gcrypt])
+ fi
dnl gnutls 3.x moved some declarations to a new header
AC_CHECK_HEADERS([gnutls/crypto.h], [], [], [[
diff --git a/libvirt.spec.in b/libvirt.spec.in
index fce7f91..7fd3c85 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -438,7 +438,9 @@ BuildRequires: readline-devel
BuildRequires: ncurses-devel
BuildRequires: gettext
BuildRequires: libtasn1-devel
+%if (0%{?rhel} && 0%{?rhel} < 7) || (0%{?fedora} && 0%{?fedora} < 19)
BuildRequires: libgcrypt-devel
+%endif
BuildRequires: gnutls-devel
BuildRequires: libattr-devel
%if %{with_libvirtd}
diff --git a/src/libvirt.c b/src/libvirt.c
index 8157488..66e8248 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -55,7 +55,9 @@
#include "intprops.h"
#include "virconf.h"
#if WITH_GNUTLS
-# include <gcrypt.h>
+# if WITH_GNUTLS_GCRYPT
+# include <gcrypt.h>
+# endif
# include "rpc/virnettlscontext.h"
#endif
#include "vircommand.h"
@@ -270,7 +272,7 @@ winsock_init(void)
#endif
-#ifdef WITH_GNUTLS
+#ifdef WITH_GNUTLS_GCRYPT
static int virTLSMutexInit(void **priv)
{
virMutexPtr lock = NULL;
@@ -323,7 +325,7 @@ static struct gcry_thread_cbs virTLSThreadImpl = {
virTLSMutexUnlock,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
-#endif
+#endif /* WITH_GNUTLS_GCRYPT */
/* Helper macros to implement VIR_DOMAIN_DEBUG using just C99. This
* assumes you pass fewer than 15 arguments to VIR_DOMAIN_DEBUG, but
@@ -407,7 +409,7 @@ virGlobalInit(void)
virErrorInitialize() < 0)
goto error;
-#ifdef WITH_GNUTLS
+#ifdef WITH_GNUTLS_GCRYPT
/*
* This sequence of API calls it copied exactly from
* gnutls 2.12.23 source lib/gcrypt/init.c, with
--
1.7.1
11 years, 3 months
[libvirt] [PATCH] Document use of systemd socket activation
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Add to the docs/drvlxc.html.in documentation to describe how to
configure systemd to auto-activate a container when a client
connects to a socket
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
docs/drvlxc.html.in | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 119 insertions(+)
diff --git a/docs/drvlxc.html.in b/docs/drvlxc.html.in
index d5b003e..7e77bdf 100644
--- a/docs/drvlxc.html.in
+++ b/docs/drvlxc.html.in
@@ -172,6 +172,125 @@ Further block or character devices will be made available to containers
depending on their configuration.
</p>
+<h2><a name="activation">Systemd Socket Activation Integration</a></h2>
+
+<p>
+The libvirt LXC driver provides the ability to pass across pre-opened file
+descriptors when starting LXC guests. This allows for libvirt LXC to support
+systemd's <a href="http://0pointer.de/blog/projects/socket-activated-containers.html">socket
+activation capability</a>, where an incoming client connection
+in the host OS will trigger the startup of a container, which runs another
+copy of systemd which gets passed the server socket, and then activates the
+actual service handler in the container.
+</p>
+
+<p>
+Lets assume that you already have a LXC guest created, running
+a systemd instance as PID 1 inside the container, which has an
+SSHD service configured. The goal is to automatically activate
+the container when the first SSH connection is made. The first
+step is to create a couple of unit files for the host OS systemd
+instance. The <code>/etc/systemd/system/mycontainer.service</code>
+unit file specifies how systemd will start the libvirt LXC container
+</p>
+
+<pre>
+[Unit]
+Description=My little container
+
+[Service]
+[Service]
+ExecStart=/usr/bin/virsh -c lxc:/// start --pass-fds 3 mycontainer
+ExecStop=/usr/bin/virsh -c lxc:/// destroy mycontainer
+Type=oneshot
+RemainAfterExit=yes
+KillMode=none
+</pre>
+
+<p>
+The <code>--pass-fds 3</code> argument specifies that the file
+descriptor number 3 that <code>virsh</code> inherits from systemd,
+is to be passed into the container. Since <code>virsh</code> will
+exit immediately after starting the container, the <code>RemainAfterExit</code>
+and <code>KillMode</code> settings must be altered from their defaults.
+</p>
+
+<p>
+Next, the <code>/etc/systemd/system/mycontainer.socket</code> unit
+file is created to get the host systemd to listen on port 23 for
+TCP connections. When this unit file is activated by the first
+incoming connection, it will cause the <code>mycontainer.service</code>
+unit to be activated with the FD coresponding to the listening TCP
+socket passed in as FD 3.
+</p>
+
+<pre>
+[Unit]
+Description=The SSH socket of my little container
+
+[Socket]
+ListenStream=23
+</pre>
+
+<p>
+Port 23 was picked here so that the container doesn't conflict
+with the host's SSH which is on the normal port 22. That's it
+in terms of host side configuration.
+</p>
+
+<p>
+Inside the container, the <code>/etc/systemd/system/sshd.socket</code>
+unit file must be created
+</p>
+
+<pre>
+[Unit]
+Description=SSH Socket for Per-Connection Servers
+
+[Socket]
+ListenStream=23
+Accept=yes
+</pre>
+
+<p>
+The <code>ListenStream</code> value listed in this unit file, must
+match the value used in the host file. When systemd in the container
+receives the pre-opened FD from libvirt during container startup, it
+looks at the <code>ListenStream</code> values to figure out which
+FD to give to which servie. The actual service to start is defined
+by a correspondingly named <code>/etc/systemd/system/sshd@.service</code>
+</p>
+
+<pre>
+[Unit]
+Description=SSH Per-Connection Server for %I
+
+[Service]
+ExecStart=-/usr/sbin/sshd -i
+StandardInput=socket
+</pre>
+
+<p>
+Finally, make sure this SSH service is set to start on boot of the container,
+by running the following command inside the container:
+</p>
+
+<pre>
+# mkdir -p /etc/systemd/system/sockets.target.wants/
+# ln -s /etc/systemd/system/sshd.socket /etc/systemd/system/sockets.target.wants/
+</pre>
+
+<p>
+This example shows how to activate the container based on an incoming
+SSH connection. If the container was also configured to have an httpd
+service, it may be desirable to activate it upon either an httpd or a
+sshd connection attempt. In this case, the <code>mycontainer.socket</code>
+file in the host would simply list multiple socket ports. Inside the
+container a separate <code>xxxxx.socket</code> file would need to be
+created for each service, with a corresponding <code>ListenStream</code>
+value set.
+</p>
+
<!--
<h2>Container configuration</h2>
--
1.8.3.1
11 years, 3 months
[libvirt] virsh list shows first domain twice
by Stefan Scheglmann
Hi,
do not know since when but i recently realized that the 'virsh list' command shows me the first dom (the one with id 1) twice in the output List, e.g.
virsh # list
Id Name Status
----------------------------------
1 essir laufend
1 essir laufend
2 mobile-sensing laufend
3 related-work laufend
4 elisa laufend
5 lehre1 laufend
7 carina laufend
VirtManager for instance does not show the dom twice, but i encounter that several stopped machines, especially if they are newly cloned, are not shown in the VirtManager application. A restart/reload of libvirt-bin does not change this issue.
Checking with 'ps aux | grep essir' shows that the dom is only running one time.
#ps aux | grep essir
104 2156 0.4 5.6 2741560 926164 ? Sl Jun29 293:58 /usr/bin/kvm -S -M pc-0.14 -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name essir -uuid e5abcb27-eab5-b271-3476-0c9c29eb005c -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/essir.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -drive file=/lvm-volumes/vms-sas/essir.img,if=none,id=drive-virtio-disk0,format=raw -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=18,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:2a:24:65,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -vnc 127.0.0.1:0 -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
root 9840 0.0 0.0 10912 928 pts/0 S+ 10:53 0:00 grep --color=auto essir
Not a serious issue but i encounter it on several hypervisors. All hypervisors running 3.2.0-40-generic with libvirt version 0.9.8.
Stefan Scheglmann
WeST Research Group
University of Koblenz-Landau
Universitaetsstrasse 1
D-56070 Koblenz
Tel.: + 49 261 287 2718
Fax: + 49 261 287 100 2718
schegi(a)uni-koblenz.de
http://west.uni-koblenz.de
11 years, 3 months
[libvirt] [PATCH 0/2] Add support for adjusting the 64-bit PCI hole size
by Ján Tomko
https://bugzilla.redhat.com/show_bug.cgi?id=990418
Ján Tomko (2):
Add pcihole64 element to domain features
Build QEMU command line for pcihole64
docs/formatdomain.html.in | 8 +++++
docs/schemas/domaincommon.rng | 7 ++++
src/conf/domain_conf.c | 13 ++++++-
src/conf/domain_conf.h | 2 ++
src/qemu/qemu_capabilities.c | 14 ++++++++
src/qemu/qemu_capabilities.h | 2 ++
src/qemu/qemu_command.c | 41 ++++++++++++++++++++++
.../qemuxml2argv-pcihole64-none.args | 4 +++
.../qemuxml2argv-pcihole64-none.xml | 24 +++++++++++++
.../qemuxml2argv-pcihole64-q35.args | 9 +++++
.../qemuxml2argv-pcihole64-q35.xml | 34 ++++++++++++++++++
tests/qemuxml2argvdata/qemuxml2argv-pcihole64.args | 5 +++
tests/qemuxml2argvdata/qemuxml2argv-pcihole64.xml | 24 +++++++++++++
tests/qemuxml2argvtest.c | 10 ++++++
tests/qemuxml2xmltest.c | 4 +++
15 files changed, 200 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64-none.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64-none.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64.xml
--
1.8.1.5
11 years, 3 months
[libvirt] [PATCH] Remove leftovers from hyperv spinlocks documentation
by Ján Tomko
Somehow I managed to leave this monstrosity in.
Introduced by 800b51d.
---
Pushed as trivial.
docs/formatdomain.html.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index dd22b6d..83d551a 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1175,7 +1175,7 @@
<hyperv>
<relaxed state='on'/>
<vapic state='on'/>
- <spinlocks state='on' retries='4096'</spinlocks>
+ <spinlocks state='on' retries='4096'/>
</hyperv>
</features>
--
1.8.1.5
11 years, 3 months
[libvirt] [PATCH] libxl: Create per-domain log file
by Jim Fehlig
Currently, only one log file is created by the libxl driver, with
all output from libxl for all domains going to this one file.
Create a per-domain log file based on domain name, making sifting
through the logs a bit easier. This required deferring libxl_ctx
allocation until starting the domain, which is fine since the
ctx is not used when the domain is inactive.
---
src/libxl/libxl_conf.h | 5 +--
src/libxl/libxl_driver.c | 88 +++++++++++++++++++++++++++++-------------------
2 files changed, 57 insertions(+), 36 deletions(-)
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index aa57710..78133b9 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -57,8 +57,6 @@ struct _libxlDriverPrivate {
virDomainXMLOptionPtr xmlopt;
unsigned int version;
- FILE *logger_file;
- xentoollog_logger *logger;
/* libxl ctx for driver wide ops; getVersion, getNodeInfo, ... */
libxl_ctx *ctx;
@@ -93,6 +91,9 @@ typedef libxlDomainObjPrivate *libxlDomainObjPrivatePtr;
struct _libxlDomainObjPrivate {
virObjectLockable parent;
+ /* per domain log stream for libxl messages */
+ FILE *logger_file;
+ xentoollog_logger *logger;
/* per domain libxl ctx */
libxl_ctx *ctx;
/* console */
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 9e9bc89..8e9a3d0 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -398,6 +398,51 @@ static const libxl_osevent_hooks libxl_event_callbacks = {
.timeout_deregister = libxlTimeoutDeregisterEventHook,
};
+static int
+libxlDomainObjPrivateInitCtx(virDomainObjPtr vm)
+{
+ libxlDomainObjPrivatePtr priv = vm->privateData;
+ char *log_file;
+ int ret = -1;
+
+ if (priv->ctx)
+ return 0;
+
+ if (virAsprintf(&log_file, "%s/%s.log", LIBXL_LOG_DIR, vm->def->name) < 0)
+ return -1;
+
+ if ((priv->logger_file = fopen(log_file, "a")) == NULL) {
+ virReportSystemError(errno,
+ _("failed to open logfile %s"),
+ log_file);
+ goto cleanup;
+ }
+
+ priv->logger =
+ (xentoollog_logger *)xtl_createlogger_stdiostream(priv->logger_file,
+ XTL_DEBUG, 0);
+ if (!priv->logger) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot create libxenlight logger for domain %s"),
+ vm->def->name);
+ goto cleanup;
+ }
+
+ if (libxl_ctx_alloc(&priv->ctx, LIBXL_VERSION, 0, priv->logger)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed libxl context initialization"));
+ goto cleanup;
+ }
+
+ libxl_osevent_register_hooks(priv->ctx, &libxl_event_callbacks, priv);
+
+ ret = 0;
+
+cleanup:
+ VIR_FREE(log_file);
+ return ret;
+}
+
static void *
libxlDomainObjPrivateAlloc(void)
{
@@ -409,14 +454,6 @@ libxlDomainObjPrivateAlloc(void)
if (!(priv = virObjectLockableNew(libxlDomainObjPrivateClass)))
return NULL;
- if (libxl_ctx_alloc(&priv->ctx, LIBXL_VERSION, 0, libxl_driver->logger)) {
- VIR_ERROR(_("Failed libxl context initialization"));
- virObjectUnref(priv);
- return NULL;
- }
-
- libxl_osevent_register_hooks(priv->ctx, &libxl_event_callbacks, priv);
-
if (!(priv->devs = virChrdevAlloc()))
return NULL;
@@ -432,6 +469,11 @@ libxlDomainObjPrivateDispose(void *obj)
libxl_evdisable_domain_death(priv->ctx, priv->deathW);
virChrdevFree(priv->devs);
+
+ xtl_logger_destroy(priv->logger);
+ if (priv->logger_file)
+ VIR_FORCE_FCLOSE(priv->logger_file);
+
libxl_ctx_free(priv->ctx);
}
@@ -929,6 +971,9 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
int managed_save_fd = -1;
libxlDomainObjPrivatePtr priv = vm->privateData;
+ if (libxlDomainObjPrivateInitCtx(vm) < 0)
+ goto error;
+
/* If there is a managed saved state restore it instead of starting
* from scratch. The old state is removed once the restoring succeeded. */
if (restore_fd < 0) {
@@ -1135,9 +1180,6 @@ libxlStateCleanup(void)
virObjectUnref(libxl_driver->xmlopt);
virObjectUnref(libxl_driver->domains);
libxl_ctx_free(libxl_driver->ctx);
- xtl_logger_destroy(libxl_driver->logger);
- if (libxl_driver->logger_file)
- VIR_FORCE_FCLOSE(libxl_driver->logger_file);
virObjectUnref(libxl_driver->reservedVNCPorts);
@@ -1187,7 +1229,6 @@ libxlStateInitialize(bool privileged,
void *opaque ATTRIBUTE_UNUSED)
{
const libxl_version_info *ver_info;
- char *log_file = NULL;
virCommandPtr cmd;
int status, ret = 0;
unsigned int free_mem;
@@ -1267,17 +1308,6 @@ libxlStateInitialize(bool privileged,
goto error;
}
- if (virAsprintf(&log_file, "%s/libxl.log", libxl_driver->logDir) < 0)
- goto error;
-
- if ((libxl_driver->logger_file = fopen(log_file, "a")) == NULL) {
- virReportSystemError(errno,
- _("failed to create logfile %s"),
- log_file);
- goto error;
- }
- VIR_FREE(log_file);
-
/* read the host sysinfo */
if (privileged)
libxl_driver->hostsysinfo = virSysinfoRead();
@@ -1286,16 +1316,7 @@ libxlStateInitialize(bool privileged,
if (!libxl_driver->domainEventState)
goto error;
- libxl_driver->logger =
- (xentoollog_logger *)xtl_createlogger_stdiostream(libxl_driver->logger_file, XTL_DEBUG, 0);
- if (!libxl_driver->logger) {
- VIR_INFO("cannot create logger for libxenlight, disabling driver");
- goto fail;
- }
-
- if (libxl_ctx_alloc(&libxl_driver->ctx,
- LIBXL_VERSION, 0,
- libxl_driver->logger)) {
+ if (libxl_ctx_alloc(&libxl_driver->ctx, LIBXL_VERSION, 0, NULL)) {
VIR_INFO("cannot initialize libxenlight context, probably not running in a Xen Dom0, disabling driver");
goto fail;
}
@@ -1362,7 +1383,6 @@ libxlStateInitialize(bool privileged,
error:
ret = -1;
fail:
- VIR_FREE(log_file);
if (libxl_driver)
libxlDriverUnlock(libxl_driver);
libxlStateCleanup();
--
1.8.1.4
11 years, 3 months
[libvirt] [test-API][PATCH] Add network update test case
by hongming zhang
The patch add network update test case to cover network update api.
modified: cases/basic_network.conf
- The test suite covers add/modify/delete ip-dhcp-host in network. For other test
scenario, they can be test via customing the conf file.
new file: repos/network/update.py
- So far the network update test case only checking when flag is live or current.
new file: repos/network/xmls/ip-dhcp-host.xml
- Create the ip-dhcp-host sample xml file for adding/deleting ip-dhcp-host
new file: repos/network/xmls/modify-ip-dhcp-host.xml
- Create the ip-dhcp-host sample xml file for modifying ip-dhcp-host
Known bug:
- Bug 985782 - Some flag values of method are missing in libvirt-python bindings
---
cases/basic_network.conf | 28 ++++++++++
repos/network/update.py | 82 ++++++++++++++++++++++++++++
repos/network/xmls/ip-dhcp-host.xml | 1 +
repos/network/xmls/modify-ip-dhcp-host.xml | 1 +
4 files changed, 112 insertions(+), 0 deletions(-)
create mode 100644 repos/network/update.py
create mode 100644 repos/network/xmls/ip-dhcp-host.xml
create mode 100644 repos/network/xmls/modify-ip-dhcp-host.xml
diff --git a/cases/basic_network.conf b/cases/basic_network.conf
index 91d7f21..e9abd57 100644
--- a/cases/basic_network.conf
+++ b/cases/basic_network.conf
@@ -32,6 +32,34 @@ network:autostart
autostart
enable
+network:update
+ networkname
+ $defaultnetname
+ command
+ add-first
+ section
+ ip-dhcp-host
+
+network:update
+ networkname
+ $defaultnetname
+ command
+ modify
+ section
+ ip-dhcp-host
+ xml
+ xmls/modify-ip-dhcp-host.xml
+
+network:update
+ networkname
+ $defaultnetname
+ command
+ delete
+ section
+ ip-dhcp-host
+ xml
+ xmls/modify-ip-dhcp-host.xml
+
network:destroy
networkname
$defaultnetname
diff --git a/repos/network/update.py b/repos/network/update.py
new file mode 100644
index 0000000..0024a5e
--- /dev/null
+++ b/repos/network/update.py
@@ -0,0 +1,82 @@
+#!/usr/bin/evn python
+#Update a network
+
+import libvirt
+from libvirt import libvirtError
+from src import sharedmod
+
+COMMANDDICT = {"none":0, "modify":1, "delete":2, "add-first":4}
+SECTIONDICT = {"none":0, "bridge":1, "domain":2, "ip":3, "ip-dhcp-host":4, \
+ "ip-dhcp-range":5, "forward":6, "forward-interface":7,\
+ "forward-pf":8, "portgroup":9, "dns-host":10, "dns-txt":11,\
+ "dns-srv":12}
+FLAGSDICT = {"current":0, "live":1, "config": 2}
+
+required_params = ('networkname', )
+optional_params = {
+ 'command': 'add-first',
+ 'section': 'ip-dhcp-host',
+ 'parentIndex': 0,
+ 'xml': 'xmls/ip-dhcp-host.xml',
+ 'flag': 'current',
+ }
+
+def update(params):
+ """Update a network from xml"""
+ global logger
+ logger = params['logger']
+ networkname = params['networkname']
+ conn = sharedmod.libvirtobj['conn']
+
+ command = params['command']
+ logger.info("The specified command is %s" % command)
+ section = params['section']
+ logger.info("The specified section is %s" % section)
+ parentIndex = int(params.get('parentIndex', 0))
+ logger.info("The specified parentIndex is %d" % parentIndex)
+ xmlstr = params.get('xml', 'xmls/ip-dhcp-host.xml').replace('\"','\'')
+ logger.info("The specified updatexml is %s" % xmlstr)
+ flag = params.get('flag', 'current')
+ logger.info("The specified flag is %s" % flag)
+
+ command_val = 0
+ section_val = 0
+ flag_val = 0
+ if COMMANDDICT.has_key(command):
+ command_val = COMMANDDICT.get(command)
+ if SECTIONDICT.has_key(section):
+ section_val = SECTIONDICT.get(section)
+ if FLAGSDICT.has_key(flag):
+ flag_val = FLAGSDICT.get(flag)
+
+ try:
+ network = conn.networkLookupByName(networkname)
+ logger.info("The original network xml is %s" % network.XMLDesc(0))
+ network.update(command_val, section_val, parentIndex, xmlstr, \
+ flag_val)
+ updated_netxml = network.XMLDesc(0)
+ logger.info("The updated network xml is %s" % updated_netxml)
+ #The check only works when flag isn't set as config
+ if flag_val !=2:
+ if command_val == 0 or command_val == 2:
+ if xmlstr not in updated_netxml:
+ logger.info("Successfully update network")
+ return 0
+ else:
+ logger.error("Failed to update network")
+ return 1
+
+ elif command_val == 1 or command_val == 4:
+ if xmlstr in updated_netxml:
+ logger.info("Successfully update network")
+ return 0
+ else:
+ logger.error("Failed to update network")
+ return 1
+
+ except libvirtError, e:
+ logger.error("API error message: %s, error code is %s" \
+ % (e.message, e.get_error_code()))
+ return 1
+
+ return 0
diff --git a/repos/network/xmls/ip-dhcp-host.xml b/repos/network/xmls/ip-dhcp-host.xml
new file mode 100644
index 0000000..50e7908
--- /dev/null
+++ b/repos/network/xmls/ip-dhcp-host.xml
@@ -0,0 +1 @@
+<host mac="00:16:3e:77:e2:ed" name="foo.example.com" ip="192.168.122.10" />
diff --git a/repos/network/xmls/modify-ip-dhcp-host.xml b/repos/network/xmls/modify-ip-dhcp-host.xml
new file mode 100644
index 0000000..a10e9fa
--- /dev/null
+++ b/repos/network/xmls/modify-ip-dhcp-host.xml
@@ -0,0 +1 @@
+<host mac="00:16:3e:77:e2:ed" name="beijing.redhat.com" ip="192.168.122.101" />
--
1.7.1
11 years, 3 months
[libvirt] [PATCHv3] build: more workarounds for if_bridge.h
by Eric Blake
This is a second attempt at fixing the problem first attempted
in commit 2df8d99; basically undoing the fact that it was
reverted in commit 43cee32f, plus fixing two more issues: the
code in configure.ac has to EXACTLY match virnetdevbridge.c
with regards to declaring in6 types before using if_bridge.h,
and the fact that RHEL 5 has even more conflicts:
In file included from util/virnetdevbridge.c:49:
/usr/include/linux/in6.h:47: error: conflicting types for 'in6addr_any'
/usr/include/netinet/in.h:206: error: previous declaration of 'in6addr_any' was here
/usr/include/linux/in6.h:49: error: conflicting types for 'in6addr_loopback'
/usr/include/netinet/in.h:207: error: previous declaration of 'in6addr_loopback' was here
The rest of this commit message borrows from the original try
of 2df8d99:
A fresh checkout on a RHEL 6 machine with these packages:
kernel-headers-2.6.32-405.el6.x86_64
glibc-2.12-1.128.el6.x86_64
failed to configure with this message:
checking for linux/if_bridge.h... no
configure: error: You must install kernel-headers in order to compile libvirt with QEMU or LXC support
Digging in config.log, we see that the problem is identical to
what we fixed earlier in commit d12c2811:
configure:98831: checking for linux/if_bridge.h
configure:98853: gcc -std=gnu99 -c -g -O2 conftest.c >&5
In file included from /usr/include/linux/if_bridge.h:17,
from conftest.c:559:
/usr/include/linux/in6.h:31: error: redefinition of 'struct in6_addr'
/usr/include/linux/in6.h:48: error: redefinition of 'struct sockaddr_in6'
/usr/include/linux/in6.h:56: error: redefinition of 'struct ipv6_mreq'
configure:98860: $? = 1
I had not hit it earlier because I was using incremental builds,
where config.cache had shielded me from the kernel-headers breakage.
* configure.ac (if_bridge.h): Avoid conflicting type definitions.
* src/util/virnetdevbridge.c (includes): Also sanitize for RHEL 5.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Good thing I'm waiting for a review - that waiting time was enough
for me to test on RHEL 5 and find another issue.
v3: also work around RHEL 5 - yet ANOTHER symptom of broken if_bridge.h
configure.ac | 12 +++++++++++-
src/util/virnetdevbridge.c | 4 ++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index a155790..d3219ce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -997,7 +997,17 @@ if test "$with_linux" = "yes"; then
if test "$with_qemu" = "yes" || test "$with_lxc" = "yes" ; then
AC_CHECK_HEADERS([linux/param.h linux/sockios.h linux/if_bridge.h linux/if_tun.h],,
[AC_MSG_ERROR([You must install kernel-headers in order to compile libvirt with QEMU or LXC support])],
- [[#include <netinet/in.h>
+ [[/* The kernel folks broke their headers when used with particular
+ * glibc versions; although the structs are ABI compatible, the
+ * C type system doesn't like struct redefinitions. We work around
+ * the problem here in the same manner as in virnetdevbridge.c. */
+ #include <netinet/in.h>
+ #define in6_addr in6_addr_
+ #define sockaddr_in6 sockaddr_in6_
+ #define ipv6_mreq ipv6_mreq_
+ #define in6addr_any in6addr_any_
+ #define in6addr_loopback in6addr_loopback_
+ #include <linux/in6.h>
]])
fi
fi
diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c
index 5d52e23..e4daa27 100644
--- a/src/util/virnetdevbridge.c
+++ b/src/util/virnetdevbridge.c
@@ -46,11 +46,15 @@
# define in6_addr in6_addr_
# define sockaddr_in6 sockaddr_in6_
# define ipv6_mreq ipv6_mreq_
+# define in6addr_any in6addr_any_
+# define in6addr_loopback in6addr_loopback_
# include <linux/in6.h>
# include <linux/if_bridge.h> /* SYSFS_BRIDGE_ATTR */
# undef in6_addr
# undef sockaddr_in6
# undef ipv6_mreq
+# undef in6addr_any
+# undef in6addr_loopback
# define JIFFIES_TO_MS(j) (((j)*1000)/HZ)
# define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)
--
1.8.3.1
11 years, 3 months
[libvirt] [PATCH] bridge driver: implement networkEnableIpForwarding for BSD
by Roman Bogorodskiy
Implement networkEnableIpForwarding() using BSD style sysctl.
---
configure.ac | 7 ++++---
src/network/bridge_driver.c | 14 ++++++++++++++
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index d3219ce..cc2213d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -207,7 +207,8 @@ dnl Availability of various common functions (non-fatal if missing),
dnl and various less common threadsafe functions
AC_CHECK_FUNCS_ONCE([cfmakeraw geteuid getgid getgrnam_r getmntent_r \
getpwuid_r getuid kill mmap newlocale posix_fallocate posix_memalign \
- prlimit regexec sched_getaffinity setgroups setns setrlimit symlink])
+ prlimit regexec sched_getaffinity setgroups setns setrlimit symlink \
+ sysctlbyname])
dnl Availability of pthread functions (if missing, win32 threading is
dnl assumed). Because of $LIB_PTHREAD, we cannot use AC_CHECK_FUNCS_ONCE.
@@ -220,8 +221,8 @@ LIBS=$old_libs
dnl Availability of various common headers (non-fatal if missing).
AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/un.h \
sys/poll.h syslog.h mntent.h net/ethernet.h linux/magic.h \
- sys/un.h sys/syscall.h netinet/tcp.h ifaddrs.h libtasn1.h \
- sys/ucred.h sys/mount.h])
+ sys/un.h sys/syscall.h sys/sysctl.h netinet/tcp.h ifaddrs.h \
+ libtasn1.h sys/ucred.h sys/mount.h])
dnl Check whether endian provides handy macros.
AC_CHECK_DECLS([htole64], [], [], [[#include <endian.h>]])
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index dd30244..9d070b8 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -41,6 +41,9 @@
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <net/if.h>
+#if HAVE_SYS_SYSCTL_H
+# include <sys/sysctl.h>
+#endif
#include "virerror.h"
#include "datatypes.h"
@@ -1537,10 +1540,21 @@ static int
networkEnableIpForwarding(bool enableIPv4, bool enableIPv6)
{
int ret = 0;
+ int enabled = 1;
if (enableIPv4)
+#ifdef HAVE_SYSCTLBYNAME
+ ret = sysctlbyname("net.inet.ip.forwarding", NULL, 0,
+ &enabled, sizeof(enabled));
+#else
ret = virFileWriteStr("/proc/sys/net/ipv4/ip_forward", "1\n", 0);
+#endif
if (enableIPv6 && ret == 0)
+#ifdef HAVE_SYSCTLBYNAME
+ ret = sysctlbyname("net.inet6.ip6.forwarding", NULL, 0,
+ &enabled, sizeof(enabled));
+#else
ret = virFileWriteStr("/proc/sys/net/ipv6/conf/all/forwarding", "1\n", 0);
+#endif
return ret;
}
--
1.8.2.3
11 years, 3 months