svn commit: r272058 - stable/10/share/examples/bhyve
Craig Rodrigues
rodrigc at FreeBSD.org
Wed Sep 24 07:29:08 UTC 2014
Author: rodrigc
Date: Wed Sep 24 07:29:07 2014
New Revision: 272058
URL: http://svnweb.freebsd.org/changeset/base/272058
Log:
MFC r271447, r271496
- Attach the ISO to an ahci-cd emulated device
- Propagate the error status of /usr/sbin/bhyve
Approved by:re (delphij)
Modified:
stable/10/share/examples/bhyve/vmrun.sh
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/share/examples/bhyve/vmrun.sh
==============================================================================
--- stable/10/share/examples/bhyve/vmrun.sh Wed Sep 24 07:00:35 2014 (r272057)
+++ stable/10/share/examples/bhyve/vmrun.sh Wed Sep 24 07:29:07 2014 (r272058)
@@ -196,7 +196,7 @@ while [ 1 ]; do
exit 1
fi
BOOTDISK=${isofile}
- installer_opt="-s 31:0,virtio-blk,${BOOTDISK}"
+ installer_opt="-s 31:0,ahci-cd,${BOOTDISK}"
else
BOOTDISK=${virtio_diskdev}
installer_opt=""
@@ -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-stable-10
mailing list