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>

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

--k1lZvvs/B4yU6o8G
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

  Matt Churchyard wrote:

> As I understand it
>=20
> 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)
>=20
> 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 installin=
g and enabling?!, and my Win2012R2 machine will only shutdown if I send the=
 signal twice.
>=20
> 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 kno=
w 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 shutdow=
n. Bhyve exits either way and the only difference is the exit code. When us=
ing one of the bhyve management tools that support reboots (such as vmrun.s=
h/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-re=
set will cause it to immediately reboot.
>=20
> From a host, the only safe choice is 'kill <pid>' (possibly multiple time=
s) and wait for bhyve process to (hopefully) exit. If that doesn't work eit=
her the acpi issue needs fixing or ideally the guest needs to be stopped us=
ing its built-in shutdown function.
>=20
> The devs will have to confirm why they're implemented the way they are. M=
y 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 expo=
sed. The ACPI shutdown event likely needs to be initiated by the bhyve proc=
ess itself, hence using a signal to it. /end-speculation
>=20
> 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 th=
e handbook documentation of the base commands shouldn't be as complete/corr=
ect 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

--k1lZvvs/B4yU6o8G
Content-Type: application/pgp-signature; name="signature.asc"

-----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-----

--k1lZvvs/B4yU6o8G--



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