Destroy the bhyve vm after exit.
This commit is contained in:
parent
3dd710eab6
commit
e43fa0eab3
@ -52,7 +52,9 @@ function start_vm {
|
||||
# -s 29,fbuf,tcp=0.0.0.0:5900,w=1920,h=1080,wait \
|
||||
while true; do
|
||||
set -x
|
||||
set +e
|
||||
bhyve \
|
||||
-D \
|
||||
-c $CPU_CORES \
|
||||
-m $MEMORY \
|
||||
-H \
|
||||
@ -65,6 +67,7 @@ function start_vm {
|
||||
-l "bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd,${mount_path}/BHYVE_UEFI_VARS.fd" \
|
||||
"$name"
|
||||
exit_code=$?
|
||||
set -e
|
||||
set +x
|
||||
if [ $exit_code -eq 0 ]; then
|
||||
echo "Rebooting."
|
||||
@ -82,6 +85,9 @@ function start_vm {
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
bhyvectl "--vm=$name" --destroy
|
||||
echo "Destroyed bhyve vm."
|
||||
}
|
||||
|
||||
function detect_available_link {
|
||||
|
Loading…
Reference in New Issue
Block a user