svn commit: r271496 - head/share/examples/bhyve
Craig Rodrigues
rodrigc at FreeBSD.org
Sat Sep 13 05:08:35 UTC 2014
Author: rodrigc
Date: Sat Sep 13 05:08:35 2014
New Revision: 271496
URL: http://svnweb.freebsd.org/changeset/base/271496
Log:
Propagate the error status of /usr/sbin/bhyve out of the vmrun.sh script.
Clean up the /dev/vmm entry for this VM when vmrun.sh exits.
Reviewed by: neel
Phabric: D767
Modified:
head/share/examples/bhyve/vmrun.sh
Modified: head/share/examples/bhyve/vmrun.sh
==============================================================================
--- head/share/examples/bhyve/vmrun.sh Sat Sep 13 03:10:02 2014 (r271495)
+++ head/share/examples/bhyve/vmrun.sh Sat Sep 13 05:08:35 2014 (r271496)
@@ -204,7 +204,8 @@ while [ 1 ]; do
${LOADER} -c ${console} -m ${memsize} -d ${BOOTDISK} ${loader_opt} \
${vmname}
- if [ $? -ne 0 ]; then
+ bhyve_exit=$?
+ if [ $bhyve_exit -ne 0 ]; then
break
fi
@@ -239,6 +240,7 @@ while [ 1 ]; do
${installer_opt} \
${vmname}
+ bhyve_exit=$?
# bhyve returns the following status codes:
# 0 - VM has been reset
# 1 - VM has been powered off
@@ -246,9 +248,18 @@ while [ 1 ]; do
# 3 - VM generated a triple fault
# all other non-zero status codes are errors
#
- if [ $? -ne 0 ]; then
+ if [ $bhyve_exit -ne 0 ]; then
break
fi
done
-exit 99
+
+case $bhyve_exit in
+ 0|1|2)
+ # Cleanup /dev/vmm entry when bhyve did not exit
+ # due to an error.
+ ${BHYVECTL} --vm=${vmname} --destroy > /dev/null 2>&1
+ ;;
+esac
+
+exit $bhyve_exit
More information about the svn-src-all
mailing list