From owner-freebsd-virtualization@freebsd.org Sun Aug 26 19:04:16 2018 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4C32107F41B for ; Sun, 26 Aug 2018 19:04:15 +0000 (UTC) (envelope-from vixie@fsi.io) Received: from mail.fsi.io (mail.fsi.io [104.244.13.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8AECD8D780 for ; Sun, 26 Aug 2018 19:04:15 +0000 (UTC) (envelope-from vixie@fsi.io) X-Virus-Scanned: amavisd-new at fsi.io Sender: vixie@fsi.io Received: from linux-9daj.localnet (dhcp-181.access.lah1.vix.su [24.104.150.181]) (Authenticated sender: vixie) by mail.fsi.io (Postfix) with ESMTPSA id E2A8A604F2; Sun, 26 Aug 2018 19:04:09 +0000 (UTC) From: Paul Vixie To: Paul Webster Cc: "freebsd-virtua." Subject: Re: Query regarding tutorials (Please have a quick read of me!) Date: Sun, 26 Aug 2018 19:04:08 +0000 Message-ID: <3626542.UnW4ZVN1pJ@linux-9daj> Organization: Farsight Security, Inc. In-Reply-To: References: <6699362.kGnQbBhLUH@linux-9daj> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.27 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, 26 Aug 2018 19:04:16 -0000 On Sunday, August 26, 2018 4:25:13 PM UTC Paul Webster wrote: > howto start stuff auto: > https://www.youtube.com/watch?v=MidLqBs4_B8&feature=youtu.be very entertaining. some notes: note that rc.local is executed by the "." command from the /bin/sh instance that runs /etc/rc.d/local, and so, #! isn't relevant there, nor is "chmod +x". net.link.ether.inet.proxyall is documented in arp(4) and just means don't drop arp requests about addresses that aren't local. i prefer to let the bhyve guests answer for themselves, which they'll do, because the arp request is sent to the all ones address, and thus reaches all the guests. i do not use daemon -r for bhyve, because it ignores the the exit status. if bhyve exits with 0 i want to loop (recreate bhyve), if it's nonzero i want it to exit (poweroff, shutdown, or kernel panic). according to bhyve(8): > EXIT STATUS > > Exit status indicates how the VM was terminated: > > 0 rebooted > 1 powered off > 2 halted > 3 triple fault you might be planning to explain how you interpret these exit statuses in the shell script you run from daemon, which in turn starts bhyve. however, it looks as if daemon -r only avoids the restart loop if it receives a SIGTERM, and i don't know how you'll deliver that. my /etc/rc.local script looks like this: > while true; do > > ... > > # we're using file descriptor #3 to get the bhyve exit code out. ugly. > set $( ( ( sh vmrun.sh \ > -c $cpucount \ > -m $memorysize \ > -t tap$tapif \ > -d /dev/zvol/$zvol \ > -C /dev/$cons \ > -x \ > $@ $vm \ > 2>&1; \ > echo $? >&3; ) | logger -t "$tag" ) 3>&1 ) > bhyve_exit=$1 > > echo === $bhyve_exit > if [ "$bhyve_exit" -ne 0 ]; then > break > fi > > sleep 10 > done -- Vixie