Allow sysctl kern.vm_guest to return bhyve when running under bhyve.

Submitted by:	Sean Fagan <sef@ixsystems.com>
Reviewed by:	grehan
MFH:		4 weeks.
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D11090
This commit is contained in:
Marcelo Araujo 2017-06-08 04:02:14 +00:00
parent 7ce44f08f5
commit e0a6a23c6d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=319678
3 changed files with 4 additions and 1 deletions

View File

@ -149,6 +149,7 @@ static const char *const vm_guest_sysctl_names[] = {
"hv",
"vmware",
"kvm",
"bhyve",
NULL
};
CTASSERT(nitems(vm_guest_sysctl_names) - 1 == VM_LAST);

View File

@ -76,7 +76,7 @@ extern int vm_guest; /* Running as virtual machine guest? */
* Keep in sync with vm_guest_sysctl_names[].
*/
enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV,
VM_GUEST_VMWARE, VM_GUEST_KVM, VM_LAST };
VM_GUEST_VMWARE, VM_GUEST_KVM, VM_GUEST_BHYVE, VM_LAST };
#if defined(WITNESS) || defined(INVARIANT_SUPPORT)
void kassert_panic(const char *fmt, ...) __printflike(1, 2);

View File

@ -1282,6 +1282,8 @@ identify_hypervisor(void)
vm_guest = VM_GUEST_HV;
else if (strcmp(hv_vendor, "KVMKVMKVM") == 0)
vm_guest = VM_GUEST_KVM;
else if (strcmp(hv_vendor, "bhyve bhyve") == 0)
vm_guest = VM_GUEST_BHYVE;
}
return;
}