Author: arekm
Date: Sat Nov  6 10:57:01 2010
New Revision: 11893

Modified:
   rc-scripts/trunk/rc.d/init.d/functions
   rc-scripts/trunk/rc.d/init.d/network
   rc-scripts/trunk/sysconfig/system
Log:
Detect isolation only vserver networking. New variable - VSERVER_ISOLATION_NET.

Modified: rc-scripts/trunk/rc.d/init.d/functions
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/functions      (original)
+++ rc-scripts/trunk/rc.d/init.d/functions      Sat Nov  6 10:57:01 2010
@@ -73,6 +73,22 @@
        unset _f _ctx
 fi
 
+# VSERVER_ISOLATION_NET = isolation only inside of vserver guests
+if [ -z "$VSERVER_ISOLATION_NET" -o "$VSERVER_ISOLATION_NET" = "detect" ]; then
+       VSERVER_ISOLATION_NET=no
+       if [ "$VSERVER" = "yes" ]; then
+               {
+                       while read _t _data; do
+                               [ "$_t" = "net:" ] && break
+                       done < /proc/self/nsproxy
+               } 2> /dev/null
+               if [ "${_data##*\(}" = "I)" ]; then
+                       VSERVER_ISOLATION_NET=yes
+               fi
+               unset _f _data
+       fi
+fi
+
 # we need to know in functions if we were called from a terminal
 if [ -z "$ISATTY" ]; then
        [ -t ] && ISATTY=yes || ISATTY=no

Modified: rc-scripts/trunk/rc.d/init.d/network
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/network        (original)
+++ rc-scripts/trunk/rc.d/init.d/network        Sat Nov  6 10:57:01 2010
@@ -333,7 +333,7 @@
 # See how we were called.
 case "$1" in
   start)
-       if is_yes "$VSERVER"; then
+       if is_yes "$VSERVER_ISOLATION_NET"; then
                emit pld.network-starting
                touch /var/lock/subsys/network
                emit pld.network-started
@@ -343,7 +343,7 @@
        ;;
 
   stop)
-       if is_yes "$VSERVER"; then
+       if is_yes "$VSERVER_ISOLATION_NET"; then
                emit pld.network-stopping
                rm -f /var/lock/subsys/network >/dev/null 2>&1
                emit pld.network-stopped
@@ -365,7 +365,7 @@
        ;;
 
   reload)
-       if is_yes "$VSERVER"; then
+       if is_yes "$VSERVER_ISOLATION_NET"; then
                exit 0
        fi
        shift
@@ -373,7 +373,7 @@
        ;;
 
   restart)
-       if is_yes "$VSERVER"; then
+       if is_yes "$VSERVER_ISOLATION_NET"; then
                exit 0
        fi
 

Modified: rc-scripts/trunk/sysconfig/system
==============================================================================
--- rc-scripts/trunk/sysconfig/system   (original)
+++ rc-scripts/trunk/sysconfig/system   Sat Nov  6 10:57:01 2010
@@ -106,6 +106,9 @@
 # Enable vserver support? (yes/no/detect)
 VSERVER=detect
 
+# Vserver isolation only networking inside of guest (yes/no/detect)
+VSERVER_ISOLATION_NET=detect
+
 # Enable syslogging for rc-scripts
 RC_LOGGING=yes
 
_______________________________________________
pld-cvs-commit mailing list
pld-cvs-commit@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to