From owner-freebsd-virtualization@FreeBSD.ORG Tue Aug 19 19:04:06 2014 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A548538F; Tue, 19 Aug 2014 19:04:06 +0000 (UTC) Received: from mail-la0-x234.google.com (mail-la0-x234.google.com [IPv6:2a00:1450:4010:c03::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 01B47348B; Tue, 19 Aug 2014 19:04:05 +0000 (UTC) Received: by mail-la0-f52.google.com with SMTP id b17so6330770lan.11 for ; Tue, 19 Aug 2014 12:04:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=FXYbrObEiscD1nh4Nb76Dd8740pYn9NPTv1gqH/A72Y=; b=YPt0I5QRi5ku9erbz3Z/kGrOoItRlkBiRu322Pfm854pbDswptKnzZXK5iI/lmejtK 3wbovhEE0qAmJgNGCtgCYRQC8heWNOS3SOFp0SH5wHT53035d83zCVjYTGKbeaTWXWpm XhymvrMdebDxa5/Dm8++WO+Kl43qkYwfZBYaDqHNMK+HvhyieKN2KEq0NLyUMZtUvfGS egDEbqOyf7pK9C87EQXOVpXmlri127zNSNCWLqyY3jUpt0UpzkQYplr5up4HZL4P7l+W 6U4qRm0HqFZqGk5jFdBA7XfmN4BIcILZi+/BjjXEFHsJSF5+u83DvC/ZmzIuMIJSNs3R BymA== MIME-Version: 1.0 X-Received: by 10.112.163.103 with SMTP id yh7mr36424960lbb.73.1408475043873; Tue, 19 Aug 2014 12:04:03 -0700 (PDT) Sender: crodr001@gmail.com Received: by 10.112.197.107 with HTTP; Tue, 19 Aug 2014 12:04:03 -0700 (PDT) In-Reply-To: <53F37A6F.90405@freebsd.org> References: <20140819154035.GA62903@kloomba> <53F37A6F.90405@freebsd.org> Date: Tue, 19 Aug 2014 12:04:03 -0700 X-Google-Sender-Auth: ppR8RayrXc2wILKycRKXkCJm9p0 Message-ID: Subject: Re: libvirt and rebooting of a bhyve VM From: Craig Rodrigues To: Allan Jude Content-Type: text/plain; charset=ISO-8859-1 Cc: "freebsd-virtualization@freebsd.org" X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.18-1 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: Tue, 19 Aug 2014 19:04:06 -0000 On Tue, Aug 19, 2014 at 9:25 AM, Allan Jude wrote: > > Yes, this revision adds the ability to 'reboot'. This does not exit > bhyve at all, so there is no exit level > > You can 'reboot' a bhyve externally using: > bhyvectl --force-reset --vm=xxx > > or force a poweroff with: bhyvectl --force-reset --vm=xxx > > SIGTERM simulates an ACPI shutdown > > > the bhyvectl --destroy is to clean up, the instance remains even after a > clean shutdown. In the past, it had to be destroyed and recreated to > start the VM again, although now with reboot support, that may not be > required. Thanks for that information. It's very useful. There doesn't seem to be a bhyvectl man page. Do you have the bandwidth to write one up and check it into the tree? That would be very helpful. I ran some experiments with bhyvectl --force-reset and --force-poweroff. They work as expected. There doesn't seem to be a bhyvectl command which simulates ACPI shutdown. If I have the name of the bhyve VM, is there a way that I can obtain the pid of the bhyve process which started the VM, so I can send it a SIGTERM, or do I need to keep track of that myself when starting the bhyve process? > > > the bhyvectl --destroy is to clean up, the instance remains even after a > clean shutdown. In the past, it had to be destroyed and recreated to > start the VM again, although now with reboot support, that may not be > required. You are right, calling bhyvectl --destroy does not seem to be required. I ran some experiments: DOESN'T WORK ============== bhyvectl --destroy ...... bhyveload ..... while true; do byve ...... if [ $? -ne 0 ]; then break fi done if I do a shutdown -r inside the VM, then when the VM reboots, I get: Assertion failed: (error == 0), function fbsdrun_addcpu, file /usr/src/usr.sbin/bhyve/bhyverun.c, line 266. WORKING ======== bhyvectl --destroy ...... while true; do bhyveload ..... byve ...... if [ $? -ne 0 ]; then break fi done This combination seems to work fine. I can do "shutdown -r" inside the VM, and it reboots fine. I can also do "shutdown -p", and the VM shuts down. So I think vmrun.sh can be changed to accomodate this new behavior, and make it more clear to people writing scripts on top of bhyve. -- Craig