Fix vserver ... stop --rescue-init.
authorDaniel Hokka Zakrisson <daniel@hozac.com>
Sun, 16 Mar 2008 03:30:22 +0000 (03:30 +0000)
committerDaniel Hokka Zakrisson <daniel@hozac.com>
Sun, 16 Mar 2008 03:30:22 +0000 (03:30 +0000)
Use it in stopSleepingGuest, to prevent races and to do proper cleanup.
If vserver ... stop has already been invoked, remove SC_HELPER from the context.

git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2704 94cd875c-1c1d-0410-91d2-eb244daf1a30

scripts/vserver-build.functions
scripts/vserver.stop

index 4993c5c..3e2b4f9 100644 (file)
@@ -282,5 +282,5 @@ function startSleepingGuest
 function stopSleepingGuest
 {
     local guest="$1"
-    $_VKILL --xid "$guest" -s INT -- 1
+    $_VSERVER "$guest" stop --rescue-init
 }
index 586adda..07e189f 100644 (file)
@@ -50,7 +50,7 @@ OPTION_FORCE_SYNC=1
 
 while test "$#" -gt 0; do
     case "$1" in
-       (--rescue-init) _IS_FAKEINIT=1;;
+       (--rescue-init) shift; _IS_FAKEINIT=1;;
        (--)            shift; break;;
        (-*)            panic $"vserver ... stop: unknown option '$1'";;
     esac
@@ -70,6 +70,8 @@ cd "$VSERVER_DIR"/vdir/
 
 test -z "$OPTION_DEFAULTTTY" || setDefaultTTY "$VSERVER_DIR"
 
+$_VATTRIBUTE --set --xid "$S_CONTEXT" --flag !SC_HELPER
+
 fail=
 initWait          "$VSERVER_DIR" "$S_CONTEXT" vwait_statdir
 if test -n "$_IS_FAKEINIT" && \