On Sat, Feb 17, 2018 at 10:10:37AM +0000, Stuart Henderson wrote:
> On 2018/02/16 17:55, Aaron Bieber wrote:
> > Hola,
> >
> > Here is a stab at telling /etc/rc.d/vmd to wait for vms to shutdown
> > before killing vmd.
> >
> > Since there is no linux vmmci layer - linux machines still get killed.
>
> Simpler and less busy-waiting. Do we need a timeout though?
>
vmmci auto shutdown will just kill the OpenBSD guests after 30 seconds if
they don't shutdown on their own.
That means we would need 30*n seconds, where n is the number of active
OpenBSD guests, plus a small amount of time for each not-OpenBSD guest.
Is this the timeout you were referring to?
PS - not to bikeshed here, but would it be worthwhile to print a list
of which VMs are being shutdown?
-ml
> Index: vmd
> ===================================================================
> RCS file: /cvs/src/etc/rc.d/vmd,v
> retrieving revision 1.6
> diff -u -p -r1.6 vmd
> --- vmd 11 Jan 2018 22:44:44 -0000 1.6
> +++ vmd 17 Feb 2018 10:09:10 -0000
> @@ -11,4 +11,20 @@ rc_pre() {
> ${daemon} -n ${daemon_flags}
> }
>
> +list_running() {
> + vmctl status | awk '$2 ~ "[0-9]" {print $NF}'
> +}
> +
> +rc_stop() {
> + for vm in $(list_running); do
> + vmctl stop "$vm"
> + done
> +
> + while [[ -n $(list_running) ]]; do
> + sleep .1
> + done
> +
> + pkill -T "${daemon_rtable}" -xf "${pexp}"
> +}
> +
> rc_cmd $1
>