added some '>&2'
[util-vserver.git] / util-vserver / scripts / vserver.functions
index a9159f4..9db6007 100644 (file)
@@ -228,6 +228,7 @@ function _generateFlagOptions
     while read flag; do
        case x"$flag" in
            x|x#)               ;;
+           xnamespace)         ;;
            xfakeinit)
                CHCONTEXT_INIT_OPTS=( --disconnect --flag fakeinit )
                ;;
@@ -237,6 +238,9 @@ function _generateFlagOptions
                ;;
        esac
     done <"$vdir"/flags
+
+    isAvoidNamespace "$cfgdir" || \
+       CHCONTEXT_FLAG_OPTS=( "${CHCONTEXT_FLAG_OPTS[@]}" --flag namespace )
 }
 
 function _generateChcontextOptions
@@ -323,7 +327,7 @@ function _processSingleInterface
     _getInterfaceValue name   '' "$iface"
     _getInterfaceValue scope  '' "$iface" "$iface/.."
 
-    test "$ip" || { echo $"Can not read ip for '$iface'"; return 1; }
+    test "$ip" || { echo $"Can not read ip for '$iface'"  >&2; return 1; }
     
     test ! -e "$iface"/only_ip   || unset dev
     
@@ -333,7 +337,7 @@ function _processSingleInterface
        case "$dev" in
            *.*)
                test -d /proc/net/vlan || {
-                   echo -e $"VLAN device-name used, but vlan subsystem not enabled.\nTry to execute 'modprobe 8021q' before starting the vservers"
+                   echo -e $"VLAN device-name used, but vlan subsystem not enabled.\nTry to execute 'modprobe 8021q' before starting the vservers"  >&2
                    return 1
                }
                test -f /proc/net/vlan || {
@@ -439,6 +443,7 @@ function generateOptions
 function mountVserver
 {
     local cfgdir=$1
+    local ns_opt=$2
     local vdir=$1/vdir
     local mtab_src
 
@@ -453,6 +458,9 @@ function mountVserver
     test "$_HAVE_CHBIND_OPTIONS" || _generateChbindOptions "$cfgdir"
     $_CHBIND "${CHBIND_OPTS[@]}" \
        $_SECURE_MOUNT -a --chroot "$vdir" --fstab "$cfgdir"/fstab
+
+    isAvoidNamespace "$cfgdir" || \
+       $_SECURE_MOUNT --rbind -n "$vdir" "/"
 }
 
 function umountVserver
@@ -462,7 +470,8 @@ function umountVserver
 
     is_ok=1
 
-    test -e "$cfgdir"/fstab || return 0
+    isAvoidNamespace "$cfgdir"  || return 0
+    test -e "$cfgdir"/fstab      || return 0
     test "$_HAVE_CHBIND_OPTIONS" || _generateChbindOptions "$cfgdir"
     
     pushd "$vdir/" >/dev/null