[Bug 262113] bhyve fails every other attempt to run

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 22 Feb 2022 07:49:32 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262113

Aleksandr Fedorov <afedorov@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |afedorov@FreeBSD.org

--- Comment #1 from Aleksandr Fedorov <afedorov@FreeBSD.org> ---
The main problem is that the VM is destroyed asynchronously via sysctl:
https://github.com/freebsd/freebsd-src/blob/main/usr.sbin/bhyvectl/bhyvectl.c#L2397
https://github.com/freebsd/freebsd-src/blob/main/lib/libvmmapi/vmmapi.c#L88
https://github.com/freebsd/freebsd-src/blob/main/sys/amd64/vmm/vmm_dev.c#L1080

Therefore, bhyvectl --destroy --vm=test0 completes before the VM is actually
destroyed.

Moreover, even the /dev/vmm/test0 device is removed before the actual
destruction of the VM occurs.

And I don't know of a guaranteed way to check if a VM is destroyed from
userspace.

As workaround you can use:
bhyvectl --destroy --vm=test0
sleep [N[
bhyve -AHP -c 1 -m 1024M ...


But this is not a 100% reliable solution.

-- 
You are receiving this mail because:
You are the assignee for the bug.