]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Change at compilation time the destruction of the network devices
authordlezcano <dlezcano>
Fri, 14 Nov 2008 16:16:35 +0000 (16:16 +0000)
committerdlezcano <dlezcano>
Fri, 14 Nov 2008 16:16:35 +0000 (16:16 +0000)
From: Daniel Lezcano <dlezcano@fr.ibm.com>

The future kernel version will automatically autodestroy the network devices
when the network namespace exits. This is not the case for the current version.
In order to handle the both cases, I added a configuration option to disable
the network destruction when the container exits:
--disable-network-destroy

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
configure.in
src/lxc/start.c

index ebeca46d88060a51b38a6417897ae6d1111f37c5..7a187f22a9923b670a1b02d641bf5e2eaea672f9 100644 (file)
@@ -1,7 +1,7 @@
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 
-AC_INIT([lxc], [0.4.0])
+AC_INIT([lxc], [0.4.1])
 
 AC_CONFIG_SRCDIR([configure.in])
 AC_CONFIG_AUX_DIR([config])
@@ -28,6 +28,11 @@ LXC_MAJOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f1)
 LXC_MINOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f2)
 LXC_MICRO_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f3)
 
+AC_ARG_ENABLE(network_destroy, [  --disable-network-destroy  disable network destruction at exit [default=no]],, enable_network_destroy=yes)
+if test "x$enable_network_destroy" = "xyes"; then
+   CFLAGS="$CFLAGS -DNETWORK_DESTROY"
+fi
+
 AC_SUBST(LXC_MAJOR_VERSION)
 AC_SUBST(LXC_MINOR_VERSION)
 AC_SUBST(LXC_MICRO_VERSION)
index 225cb1a32c6f4ecf8846ceb55348aa4691226272..bf233cd2efc481dcf875384f9da1d8d4d5b2906f 100644 (file)
@@ -218,8 +218,10 @@ wait_again:
        if (lxc_setstate(name, STOPPING))
                lxc_log_error("failed to set state %s", lxc_state2str(STOPPING));
 
+#ifdef NETWORK_DESTROY
        if (clone_flags & CLONE_NEWNET && conf_destroy_network(name))
                lxc_log_error("failed to destroy the network");
+#endif
 
        err = 0;
 out:
@@ -242,8 +244,10 @@ err_state_failed:
 err_child_failed:
 err_pipe_read2:
 err_pipe_write:
+#ifdef NETWORK_DESTROY
        if (clone_flags & CLONE_NEWNET)
                conf_destroy_network(name);
+#endif
 err_create_network:
 err_pipe_read:
 err_waitpid_failed: