Date: Sun, 9 Feb 2014 13:11:00 -0800 From: Craig Rodrigues <rodrigc@FreeBSD.org> To: "freebsd-virtualization@freebsd.org" <freebsd-virtualization@freebsd.org> Subject: Detect of BHyve VM was powered off or rebooted? Message-ID: <CAG=rPVcfYQ2nUaZYuc6teL2r%2BQZzxhuoV052zgf6=Dxh8MeNcA@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi, I posted some rc.d scripts that I am using to boot a BHyve VM and send the output to a serial console using the /dev/nmdm driver: http://lists.freebsd.org/pipermail/freebsd-virtualization/2014-January/002040.html It works quite well. There is some things I would like to improve, and would like some advice on the best way to do it. (1) If the VM was destroyed with bhyvectl --destroy --vm ${VM_NAME}, then I do not want to automatically restart the VM in the script. User should manually: service bhyvevm start (2) If the VM was powered down, via shutdown -p, or halt -p, then in my script I do not want to restart the VM in the script. User should manually: service bhyvevm start (3) If the VM was rebooted via "reboot" or "shutdown -r", then I *do* want the script to restart the VM. I think if I change my start_vm.sh script to do something like: ( while [ -e /dev/vmm/${VM} ]; do /usr/sbin/bhyve -c 16 -m 8G -A -H -P -g 0 -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,${TAP} -s 3:0,virtio-blk,${IMG} -l com1,${CONS_A} ${VM}" done ) & then this might cover cases (1) and (3), but what will cover case (2)? Thanks for any advice. -- Craig
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG=rPVcfYQ2nUaZYuc6teL2r%2BQZzxhuoV052zgf6=Dxh8MeNcA>