[vserver] Small problem with vserver and network namespace

From: Artur Kaszuba <artur_at_netmix.pl>
Date: Wed 23 Apr 2014 - 16:54:14 BST
Message-ID: <5357E226.2060705@netmix.pl>

Hi

I have a problem with new util-vserver and network namespace. When i use
vserver exec or vapt-get i got errors:

root@netmix-u3:~# vserver www exec w
seting the network namespace "wiki" failed: Invalid argument

I found a fast and simple fix, but i'm not sure is it correct :)

When we use netns, links and mounts from "ip netns" are created in
vserver mount namespace. Then we should enter to correct namespace
before execute any command inside. In /usr/sbin/vserver i add "early
namespace" also for exec command. Could someone check it?

--- vserver.org 2014-04-23 17:07:13.215393367 +0200
+++ vserver 2014-04-23 17:26:50.775394838 +0200
@@ -206,7 +206,7 @@
     exec $_VNAMESPACE --new -- $_VSERVER ----nonamespace
"${OPTIONS_ORIG[@]}"

 # Enter the namespace early so we can test for files inside the guest
-test "$cmd" != enter -a "$cmd" != stop || \
+test "$cmd" != enter -a "$cmd" != stop -a "$cmd" != exec || \
     test -n "$OPTION_NONAMESPACE" || isAvoidNamespace "$VSERVER_DIR" || \
     ! isVserverRunning "$VSERVER_DIR" || \
     exec $_VNAMESPACE --enter "$VSERVER_DIR" -- $_VSERVER
----nonamespace "${OPTIONS_ORIG[@]}"

Best regards

--
Artur Kaszuba
www.netmix.pl
Received on Wed Apr 23 16:54:09 2014
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Wed 23 Apr 2014 - 16:54:09 BST by hypermail 2.1.8