Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Sep 2014 16:55:02 +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: r271106 - stable/10/share/examples/bhyve
Message-ID:  <201409041655.s84Gt2QI027846@svn.freebsd.org>

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



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