libvirt and rebooting of a bhyve VM
Craig Rodrigues
rodrigc at FreeBSD.org
Tue Aug 19 18:33:23 UTC 2014
On Tue, Aug 19, 2014 at 10:32 AM, John Baldwin <jhb at freebsd.org> 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
More information about the freebsd-virtualization
mailing list