initial checkin
[util-vserver.git] / util-vserver / scripts / vserver.functions
index 94f59e4..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 || {
@@ -455,7 +459,7 @@ function mountVserver
     $_CHBIND "${CHBIND_OPTS[@]}" \
        $_SECURE_MOUNT -a --chroot "$vdir" --fstab "$cfgdir"/fstab
 
-    test -e "$cfgdir"/nonamespace || \
+    isAvoidNamespace "$cfgdir" || \
        $_SECURE_MOUNT --rbind -n "$vdir" "/"
 }
 
@@ -466,9 +470,9 @@ function umountVserver
 
     is_ok=1
 
-    test -e "$cfgdir"/nonamespace || return 0
-    test -e "$cfgdir"/fstab       || return 0
-    test "$_HAVE_CHBIND_OPTIONS"  || _generateChbindOptions "$cfgdir"
+    isAvoidNamespace "$cfgdir"  || return 0
+    test -e "$cfgdir"/fstab      || return 0
+    test "$_HAVE_CHBIND_OPTIONS" || _generateChbindOptions "$cfgdir"
     
     pushd "$vdir/" >/dev/null
     tac "$cfgdir"/fstab | while read src dst tmp; do