comparison files/fbhyve.in @ 476:c3ad1105c746

Implement a "kill" extra-commant for fbhyve to do an immediate poweroff of a VM
author Franz Glasner <fzglas.hg@dom66.de>
date Tue, 27 Aug 2024 22:33:57 +0200
parents 827371176fec
children 3f187ec5c4d9
comparison
equal deleted inserted replaced
475:827371176fec 476:c3ad1105c746
32 32
33 name="fbhyve" 33 name="fbhyve"
34 desc="Manage system bhyve virtual machines" 34 desc="Manage system bhyve virtual machines"
35 rcvar="fbhyve_enable" 35 rcvar="fbhyve_enable"
36 36
37 extra_commands="kill"
37 start_precmd="fbhyve_pre_start" 38 start_precmd="fbhyve_pre_start"
38 stop_postcmd="fbhyve_post_stop" 39 stop_postcmd="fbhyve_post_stop"
39 status_cmd="fbhyve_status" 40 status_cmd="fbhyve_status"
41 kill_cmd="fbhyve_kill"
40 42
41 43
42 load_rc_config $name 44 load_rc_config $name
43 45
44 : ${fbhyve_enable:="NO"} 46 : ${fbhyve_enable:="NO"}
152 rm -f "${pidfile}" 154 rm -f "${pidfile}"
153 return 0 155 return 0
154 } 156 }
155 157
156 158
159 fbhyve_kill()
160 {
161 # Just kill without terminating
162 if [ -e "/dev/vmm/${_vm}" ]; then
163 /usr/sbin/bhyvectl --vm="${_vm}" --force-poweroff 2>/dev/null 1>/dev/null
164 fi
165 # and do the normal cleanup
166 fbhyve_post_stop
167 }
168
169
157 run_rc_command "$1" 170 run_rc_command "$1"