diff options
author | rodrigc <rodrigc@FreeBSD.org> | 2014-09-24 07:29:07 +0000 |
---|---|---|
committer | rodrigc <rodrigc@FreeBSD.org> | 2014-09-24 07:29:07 +0000 |
commit | 75fc77c650f092b9b0d781995762db3c5cfd007a (patch) | |
tree | c7c54a00df8c9e1ccc68940a725f71f46582b10c /share/examples | |
parent | a5b312526c9512781aedad6e8020b94871274dba (diff) | |
download | FreeBSD-src-75fc77c650f092b9b0d781995762db3c5cfd007a.zip FreeBSD-src-75fc77c650f092b9b0d781995762db3c5cfd007a.tar.gz |
MFC r271447, r271496
- Attach the ISO to an ahci-cd emulated device
- Propagate the error status of /usr/sbin/bhyve
Approved by:re (delphij)
Diffstat (limited to 'share/examples')
-rwxr-xr-x | share/examples/bhyve/vmrun.sh | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/share/examples/bhyve/vmrun.sh b/share/examples/bhyve/vmrun.sh index 793a63d..f7bb2a0 100755 --- a/share/examples/bhyve/vmrun.sh +++ b/share/examples/bhyve/vmrun.sh @@ -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 |