Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Apr 2016 07:03:39 +0300
From:      Roman Bogorodskiy <novel@FreeBSD.org>
To:        Matt Churchyard <matt.churchyard@userve.net>
Cc:        Roman Bogorodskiy <bogorodskiy@gmail.com>, FreeBSD virtualization <freebsd-virtualization@freebsd.org>, Peter Grehan <grehan@freebsd.org>, Neel Natu <neel@freebsd.org>
Subject:   Re: Understanding Bhyve shutdown
Message-ID:  <20160417040337.GA2106@kloomba>
In-Reply-To: <548d6c81c4784447b91f6f1459863eed@SERVER.ad.usd-group.com>
References:  <20160413105520.GB84953@dev.san.ru> <548d6c81c4784447b91f6f1459863eed@SERVER.ad.usd-group.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
  Matt Churchyard wrote:

> As I understand it
> 
> 1) shutdown from guest
> 2) 'kill <pid>' -> pressing the power button once.
> 3) --force-poweroff -> holding power button in
> 4) --force-reset -> pressing the reset button
> 5) bhyvectl --destroy -> same as 3? (although vmm is destroyed as well)
> 
> 1 or 2 are obviously preferred. I've found however that some guests don't respond that well to the apci event. CentOS 6 seems to need apci installing and enabling?!, and my Win2012R2 machine will only shutdown if I send the signal twice.
> 
> The rest are all hard shutdowns that should not be seen as a way to stop the guest, just a last resort if it can't be stopped correctly. I don't know the practical difference between poweroff&destroy vs just destroy.

I CCed Peter and Neel, probably they'll shed some light on 'bhyvectl
--force-poweroff && bhyvectl --destroy' vs just 'bhyvectl --destroy'.

> I see no reason why the documentation suggests reboot rather than shutdown. Bhyve exits either way and the only difference is the exit code. When using one of the bhyve management tools that support reboots (such as vmrun.sh/vm-bhyve/iohyve) however, a "restart" exit code (0) will cause the guest to restart automatically; If a guest is locked up for example, a --force-reset will cause it to immediately reboot.
> 
> From a host, the only safe choice is 'kill <pid>' (possibly multiple times) and wait for bhyve process to (hopefully) exit. If that doesn't work either the acpi issue needs fixing or ideally the guest needs to be stopped using its built-in shutdown function.
> 
> The devs will have to confirm why they're implemented the way they are. My instinct is that bhyvectl works on the vmm device, and reset/poweroff are just functions that are possible via that interface, and so have been exposed. The ACPI shutdown event likely needs to be initiated by the bhyve process itself, hence using a signal to it. /end-speculation
> 
> I think most users will want to use a bhyve tool so the raw specifics of the bhyve/bhyvectl commands are glossed over, although that doesn't mean the handbook documentation of the base commands shouldn't be as complete/correct as possible of course.

FWIW, I've created a patch:

https://reviews.freebsd.org/D5982

which at least documents exit codes and the SIGTERM thing.

Roman Bogorodskiy

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJXEwsZAAoJEMltX/4IwiJqqU8IAKTGTwtWrbHxRWxXp43rrVoS
OkZh9HfBF6JX2H4UkTyLc3+jaFVFo1avQlp3jpAPus5nmlkw+vFZePbYyYdz6boW
YzVntRzPcu1GbnlXJsX9XHrGJnyMjzIofP4rKp89s9sLQ1tisajf7ukzcVOv7ZQg
7LOlOad0zh+xAfwE012M7KIrp80GW32BRKVCl7f5lu97kUppafBfw7DFsvGTA611
Z7C6NdfUoVn/jubfgjO5ProtF/u/bsWNSslL87wBCQU5h4VOaiH8Ufjm84qfp/ER
VIozyAYgOQ/Gaq+FadW1FPpoCt3/KJRCKpY540aFgVP6PTXjdekv9bhBqb1RI3I=
=/Qtd
-----END PGP SIGNATURE-----
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160417040337.GA2106>