From 6f8ba4682611dbacca765dab21d96ac937570d9b Mon Sep 17 00:00:00 2001 From: rodrigc Date: Thu, 4 Sep 2014 16:55:01 +0000 Subject: 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 --- share/examples/bhyve/vmrun.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'share/examples') diff --git a/share/examples/bhyve/vmrun.sh b/share/examples/bhyve/vmrun.sh index 33d0db9..793a63d 100755 --- a/share/examples/bhyve/vmrun.sh +++ b/share/examples/bhyve/vmrun.sh @@ -173,13 +173,14 @@ echo "Launching virtual machine \"$vmname\" ..." 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 -- cgit v1.1