Date: Wed, 13 Apr 2016 15:36:41 +0300 From: Nikos Vassiliadis <nvass@gmx.com> To: Roman Bogorodskiy <bogorodskiy@gmail.com>, freebsd-virtualization@FreeBSD.org Subject: Re: Understanding Bhyve shutdown Message-ID: <570E3D59.5090609@gmx.com> In-Reply-To: <20160413105520.GB84953@dev.san.ru> References: <20160413105520.GB84953@dev.san.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Roman, On 04/13/16 13:55, Roman Bogorodskiy wrote: > Q1: Is there a way to know if a guest reacted to power button but > waiting for the bhyve process to terminate? I just signal repeatedly $bhyve_pid until it's gone. For what it's worth, I use this /etc/rc.shutdown.local: PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin # shutdown VMs for sig in TERM KILL; do for f in 1 2 3 4 5 6 7 8 9 10; do cmds=`killall -${sig} -q -s bhyve | sed 's/$/;/'` test -z "$cmds" && exit sh -c "$cmds" sleep 1 done done When a VM is hang, it won't respond to TERM, so you might want to use something like, 'for sig in TERM HUP KILL'. It works ok in my experience and I do have some VMs running Java which take a while to shutdown. Our VMs usually shut down within one or two seconds, the Java ones need more but still within ten seconds everything is gone. Experiment a bit and give it enough time to shutdown gracefully and if it's still alive SIGHUP $bhyve_pid. HTH, Nikos
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?570E3D59.5090609>