Subject: Small problem with vserver and network namespace
From: Artur Kaszuba <artur@netmix.pl>
Date: Wed, 23 Apr 2014 17:54:14 +0200

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