diff --git a/ansible/roles/bhyve/files/bhyve_netgraph_bridge.bash b/ansible/roles/bhyve/files/bhyve_netgraph_bridge.bash index ca90800..7741002 100644 --- a/ansible/roles/bhyve/files/bhyve_netgraph_bridge.bash +++ b/ansible/roles/bhyve/files/bhyve_netgraph_bridge.bash @@ -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 {