Use the state change helper to stop the guest when the last process exits.
authorDaniel Hokka Zakrisson <daniel@hozac.com>
Sat, 21 Apr 2007 14:06:26 +0000 (14:06 +0000)
committerDaniel Hokka Zakrisson <daniel@hozac.com>
Sat, 21 Apr 2007 14:06:26 +0000 (14:06 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2533 94cd875c-1c1d-0410-91d2-eb244daf1a30

lib/cflags-v13.c
scripts/vshelper

index e9c6a9d..2329ca0 100644 (file)
@@ -68,7 +68,7 @@ static struct Mapping_uint64 const VALUES[] = {
 
     // Some pseudo flags
   DECL("secure",        VC_VXF_HIDE_NETIF),
-  DECL("default",       VC_VXF_VIRT_UPTIME),
+  DECL("default",       VC_VXF_VIRT_UPTIME|VC_VXF_SC_HELPER),
 
     // Aliases for the legacy flags
   DECL("info_lock",    VC_VXF_INFO_LOCK),
index 7a7b2d4..0b44e22 100755 (executable)
@@ -80,6 +80,10 @@ function doInternalMethod
                    exit 0
                    ;;
                (restart2)      ;;
+               (shutdown)
+                   logging $"Cleaning up after vserver '$VSERVER'"
+                   spawn $_VSERVER --defaulttty "$VSERVER" stop
+                   ;;
                (*)
                    warning $"Unknown action '$ACTION' for vserver '$VSERVER'"
                    exit 1
@@ -178,7 +182,7 @@ while true; do
     responsible_xid=$pxid
 done
 
-vserver_id=$($_VSERVER_INFO "$responsible_xid" ID) ||
+vserver_id=$($_VSERVER_INFO "$responsible_xid" ID) || test "$ACTION" = "shutdown" ||
     panic $"No responsible vserver found for xid '$responsible_xid' ($XID); aborting..."
     
 test "$XID" = "$responsible_xid" || {