This proposed patch attempts to load vmm.ko if it's not already present in the kernel. If vmm.ko fails to load, an error message is produced and bhyveload exits.
I wonder if it makes more sense to do this in vmrun.sh? OTOH, it's probably fine to do this. We should also probably do it in bhyverun.c since bhyveload isn't used in the UEFI case. Another option would be to do this in the vm_create() wrapper in libvmmapi in which case that would fix bhyveload, grub2-bhyve, and bhyve all in one place.
Yes, I agree to do that on libvmmapi!!! I was actually think about that, because at the end I would repeat code on bhyveload and bhyverun.c
Ok, let me update this patch with the libvmmapi approach.