From owner-freebsd-virtualization@freebsd.org Sun Apr 17 04:03:47 2016 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B4E5AEDC7F for ; Sun, 17 Apr 2016 04:03:47 +0000 (UTC) (envelope-from bogorodskiy@gmail.com) Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B349F1692; Sun, 17 Apr 2016 04:03:46 +0000 (UTC) (envelope-from bogorodskiy@gmail.com) Received: by mail-lf0-x243.google.com with SMTP id e190so21686068lfe.1; Sat, 16 Apr 2016 21:03:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=KUNxs619jafCZnOx2wYyZxnmz8MkSVnYgchQC4VLkZc=; b=nIAQZhOuCKV8IFDzvR3aBuZF87dO4hARu6ISZPnepsPss6ilA2rdFYMUhk/zxodr2E kDDUKnN1i2PeUOApClJu//BF/6BWQQJzwTiuHPWZ/4FQOumI6w6nCtJg9nrllh/910XG Vo5WrnKJeahXwbfIDAfYINwWrUaJ7FKswJofYTdSIte9o08qInFT4ik2xjLhf28Tiejb th2MX+x69T+8QMGrX2N9fGoAWH9b/4UAfyrw/wnuMjGnGn1epsB8Of7EwUGC6j+uRv27 Bgu73Pb4apNoOM6u8T4TAvIF4QlwhdqBX8kUOwHrRVXWnOkAGzyjTcCjOijJLjYtv0Wg uouA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=KUNxs619jafCZnOx2wYyZxnmz8MkSVnYgchQC4VLkZc=; b=GQvRTzSstqVT0Cr0AodqG3gQbsXE4p4Xw0jOV94qx7Hesr1MG91Gc/oRWI+Med42Ga nzkV7AORjZQvlRS8s/Umv7x1SxdLeyZ/dbCCR9RtqVCxiOZ23Ue2Me3K4xolrgiRNu2V kwQwvGZ/slTwl/OJxr8jxnBYOUHuNe5iarkvk5V2WXXdP+4htwCUz0F0uVrrOZDF7KxD n+9DsKAtsqrzQZOmcasrAZHX5aP/Udy/XvRouvEXSdMAdxORFo8t9VFnlmwXYQC+KC9O WYFfCkJuHZGeA9adXXHYdoS2pxS8/8X0AeX6sffeaPg9KCtscrGfHbAfV5Y3Fnqxglz2 L+lQ== X-Gm-Message-State: AOPr4FVYHVGQN1tnUOpjaZcaVGE9ch1OLcMuFWlz5kN51yahc+vwlBq/2ProP9wllhfO3A== X-Received: by 10.112.171.161 with SMTP id av1mr12146740lbc.82.1460865825005; Sat, 16 Apr 2016 21:03:45 -0700 (PDT) Received: from kloomba ([213.147.222.31]) by smtp.gmail.com with ESMTPSA id bd5sm7582608lbc.12.2016.04.16.21.03.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Apr 2016 21:03:44 -0700 (PDT) Sender: Roman Bogorodskiy Date: Sun, 17 Apr 2016 07:03:39 +0300 From: Roman Bogorodskiy To: Matt Churchyard Cc: Roman Bogorodskiy , FreeBSD virtualization , Peter Grehan , Neel Natu Subject: Re: Understanding Bhyve shutdown Message-ID: <20160417040337.GA2106@kloomba> References: <20160413105520.GB84953@dev.san.ru> <548d6c81c4784447b91f6f1459863eed@SERVER.ad.usd-group.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k1lZvvs/B4yU6o8G" Content-Disposition: inline In-Reply-To: <548d6c81c4784447b91f6f1459863eed@SERVER.ad.usd-group.com> User-Agent: Mutt/1.6.0 (2016-04-01) X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Apr 2016 04:03:47 -0000 --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 ' -> 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 ' (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--