From owner-freebsd-virtualization@FreeBSD.ORG Tue Aug 19 18:33:23 2014 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0EF32384; Tue, 19 Aug 2014 18:33:23 +0000 (UTC) Received: from mail-la0-x22b.google.com (mail-la0-x22b.google.com [IPv6:2a00:1450:4010:c03::22b]) (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 32F33312E; Tue, 19 Aug 2014 18:33:22 +0000 (UTC) Received: by mail-la0-f43.google.com with SMTP id gi9so3776211lab.16 for ; Tue, 19 Aug 2014 11:33:20 -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=t+mWDlNzPdv7la/MLUBG2Ptgm3fkrznLVJMWqk3eVXs=; b=CuAG0vSnhzo+qrpr74lnH+C1IxN9m/B9BGNrarHbjDbZdP3V88rlrw2MA3cSc3DqMn Vgix/nK6MB88sWFFXssjEsXqfbdIFbsLpRA9m1M+fb9SKeb6EGZB0voVuU8VW79hkS25 yZmQyFgLgNPkETq0eysmP9OCqzVbxa2PGQWRr7CZR5w4U/8hYE624GnQT3KWPyzbBM95 /amANUGadCdLTG/GRYcZFhD81uaYBrH27opNcmNS7IjYduLQvV3imlUsi86XpkRdSbLD uHQVXL4zw1C2H8YUp5F3+sCyctmKIPArpxxl0ug7fWla/EBW5IThOiuDDoOmr4f+Qedt Fu+Q== MIME-Version: 1.0 X-Received: by 10.152.22.165 with SMTP id e5mr16913535laf.57.1408473200068; Tue, 19 Aug 2014 11:33:20 -0700 (PDT) Sender: crodr001@gmail.com Received: by 10.112.197.107 with HTTP; Tue, 19 Aug 2014 11:33:19 -0700 (PDT) In-Reply-To: <201408191332.48730.jhb@freebsd.org> References: <20140819154035.GA62903@kloomba> <201408191332.48730.jhb@freebsd.org> Date: Tue, 19 Aug 2014 11:33:19 -0700 X-Google-Sender-Auth: UEKJh_0oC43nIRPXhlZl0dqJNW4 Message-ID: Subject: Re: libvirt and rebooting of a bhyve VM From: Craig Rodrigues To: John Baldwin 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 18:33:23 -0000 On Tue, Aug 19, 2014 at 10:32 AM, John Baldwin wrote: > The exit code is different. An ACPI shutdown uses an exit code of 1 whereas a > reboot uses an exit code of 0 IIRC. Hi, I have a CURRENT system, and ran some tests doing a "shutdown -r" and "shutdown -p" verified that you are right, with respect to the exit codes. Looking at src/usr.sbin/bhyve/bhyverun.c, I see that fbsdrun_start_thread() -> vm_loop() Inside vm_loop(), there is this line: rc = (*handler[exitcode])(ctx, &vmexit[vcpu], &vcpu); That line ends up calling vmexit_suspend(). In vmexit_suspend() there is this: switch (how) { case VM_SUSPEND_RESET: exit(0); case VM_SUSPEND_POWEROFF: exit(1); case VM_SUSPEND_HALT: exit(2); case VM_SUSPEND_TRIPLEFAULT: exit(3); default: fprintf(stderr, "vmexit_suspend: invalid reason %d\n", how); exit(100); } I think that: (1) vmrun.sh should be changed a little bit to accomodate this new logic (2) the bhyve man page should document these return codes. -- Craig