Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Sep 2014 07:29:08 +0000 (UTC)
From:      Craig Rodrigues <rodrigc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r272058 - stable/10/share/examples/bhyve
Message-ID:  <201409240729.s8O7T87F012531@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409240729.s8O7T87F012531>