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