[PC-BSD Commits] r18084 - pcbsd/current/src-sh/warden/scripts/backend

svn at pcbsd.org svn at pcbsd.org
Wed Aug 1 17:37:45 PDT 2012


Author: kris
Date: 2012-08-02 00:37:45 +0000 (Thu, 02 Aug 2012)
New Revision: 18084

Modified:
   pcbsd/current/src-sh/warden/scripts/backend/deletejail.sh
   pcbsd/current/src-sh/warden/scripts/backend/functions.sh
   pcbsd/current/src-sh/warden/scripts/backend/startjail.sh
Log:

Improve removing jails on ZFS, and do some error checking when a jail fails
to start, so we unmount the leftovers



Modified: pcbsd/current/src-sh/warden/scripts/backend/deletejail.sh
===================================================================
--- pcbsd/current/src-sh/warden/scripts/backend/deletejail.sh	2012-08-02 00:26:30 UTC (rev 18083)
+++ pcbsd/current/src-sh/warden/scripts/backend/deletejail.sh	2012-08-02 00:37:45 UTC (rev 18084)
@@ -53,6 +53,7 @@
   # Create ZFS mount
   tank=`getZFSTank "$JDIR"`
   zfs destroy -r ${tank}${JDIR}/${IP}
+  rmdir ${JDIR}/${IP}
 else
   chflags -R noschg "${JDIR}/${IP}"
   rm -rf "${JDIR}/${IP}"

Modified: pcbsd/current/src-sh/warden/scripts/backend/functions.sh
===================================================================
--- pcbsd/current/src-sh/warden/scripts/backend/functions.sh	2012-08-02 00:26:30 UTC (rev 18083)
+++ pcbsd/current/src-sh/warden/scripts/backend/functions.sh	2012-08-02 00:37:45 UTC (rev 18084)
@@ -184,6 +184,8 @@
     umount -f ${mountpoint}
     if [ $? -ne 0 ] ; then status="1" ; fi
   done
+  # Now try to umount /dev
+  umount -f ${JDIR}/${1}/dev 2>/dev/null >/dev/null
   return $status
 }
 

Modified: pcbsd/current/src-sh/warden/scripts/backend/startjail.sh
===================================================================
--- pcbsd/current/src-sh/warden/scripts/backend/startjail.sh	2012-08-02 00:26:30 UTC (rev 18083)
+++ pcbsd/current/src-sh/warden/scripts/backend/startjail.sh	2012-08-02 00:37:45 UTC (rev 18084)
@@ -123,6 +123,11 @@
 # Start the jail now
 echo "jail -c name=${HOST} path=${JDIR}/${IP} host.hostname=${HOST} ${_ipflags} ${jFlags} persist"
 jail -c name=${HOST} path=${JDIR}/${IP} host.hostname=${HOST} ${_ipflags} ${jFlags} persist
+if [ $? -ne 0 ] ; then
+   echo "ERROR: Failed starting jail with above command..."
+   umountjailxfs "${IP}"
+   exit 1
+fi
 
 JID="`jls | grep ${JDIR}/${IP} | tr -s " " | cut -d " " -f 2`"
 



More information about the Commits mailing list