svn commit: r271106 - stable/10/share/examples/bhyve

Craig Rodrigues rodrigc at FreeBSD.org
Thu Sep 4 16:55:02 UTC 2014


Author: rodrigc
Date: Thu Sep  4 16:55:01 2014
New Revision: 271106
URL: http://svnweb.freebsd.org/changeset/base/271106

Log:
  MFC r270512 r270513 r270754
     - add comments which describe exit status codes of /usr/sbin/bhyve
     - move bhyvectl --destroy outside of the while loop
     - Use "file -s" so that we can run vmrun.sh against special devces such as
       /dev/md memory files systems or zvols

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	Thu Sep  4 16:51:45 2014	(r271105)
+++ stable/10/share/examples/bhyve/vmrun.sh	Thu Sep  4 16:55:01 2014	(r271106)
@@ -173,13 +173,14 @@ echo "Launching virtual machine \"$vmnam
 
 virtio_diskdev="$disk_dev0"
 
+${BHYVECTL} --vm=${vmname} --destroy > /dev/null 2>&1
+
 while [ 1 ]; do
-	${BHYVECTL} --vm=${vmname} --destroy > /dev/null 2>&1
 
-	file ${virtio_diskdev} | grep "boot sector" > /dev/null
+	file -s ${virtio_diskdev} | grep "boot sector" > /dev/null
 	rc=$?
 	if [ $rc -ne 0 ]; then
-		file ${virtio_diskdev} | grep ": Unix Fast File sys" > /dev/null
+		file -s ${virtio_diskdev} | grep ": Unix Fast File sys" > /dev/null
 		rc=$?
 	fi
 	if [ $rc -ne 0 ]; then
@@ -237,6 +238,14 @@ while [ 1 ]; do
 		-l com1,${console}					\
 		${installer_opt}					\
 		${vmname}
+
+	# bhyve returns the following status codes:
+	#  0 - VM has been reset
+	#  1 - VM has been powered off
+	#  2 - VM has been halted
+	#  3 - VM generated a triple fault
+	#  all other non-zero status codes are errors
+	#
 	if [ $? -ne 0 ]; then
 		break
 	fi


More information about the svn-src-all mailing list