changeset 477:3f187ec5c4d9

Extra support for "forcestart" in fbhyve
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 28 Aug 2024 09:08:32 +0200
parents c3ad1105c746
children ce46191f24d6
files docs/man/man8/fbhyve.rst files/fbhyve.in
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/docs/man/man8/fbhyve.rst	Tue Aug 27 22:33:57 2024 +0200
+++ b/docs/man/man8/fbhyve.rst	Wed Aug 28 09:08:32 2024 +0200
@@ -23,6 +23,8 @@
 ~~~~~~~~~~~~~~
 
 The extra command ``kill`` is like switching the power off immediately.
+It can also be used to cleanup if some spurious artifacts have been left
+around that hinder normal starts.
 
 The ``stop`` command initiates a clean shutdown by properly terminating
 :manpage:`bhyve(8)` with `SIGTERM`.
--- a/files/fbhyve.in	Tue Aug 27 22:33:57 2024 +0200
+++ b/files/fbhyve.in	Wed Aug 28 09:08:32 2024 +0200
@@ -127,17 +127,24 @@
 
 fbhyve_pre_start()
 {
+    local _level
+
+    if [ -z "${rc_force}" ]; then
+        _level="ERROR:"
+    else
+        _level="WARNING:"
+    fi
     if ! load_kld -m vmm vmm.ko; then
         echo "ERROR: Cannot load kernel module \`vmm'" 1>&2
-        return 1
+        [ -z "${rc_force}" ] && return 1
     fi
     if [ -e "/dev/vmm/${_vm}" ]; then
-        echo "ERROR: VM \`${_vm}' already created in the VM monitor" 1>&2
-        return 1
+        echo "${_level} VM \`${_vm}' already created in the VM monitor" 1>&2
+        [ -z "${rc_force}" ] && return 1        
     fi
     if ${command} has-session -t "${_session}" 2>/dev/null; then
-        echo "ERROR: tmux session \`${_session}' already exists" 1>&2
-        return 1
+        echo "${_level} tmux session \`${_session}' already exists" 1>&2
+        [ -z "${rc_force}" ] && return 1        
     fi
     return 0
 }