summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Brondani Schenkel <leonardo@schenkel.net>2016-08-01 15:04:49 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-08-01 09:04:49 -0400
commitaa0c34279ee40bce2f9681b496922dedbadfca19 (patch)
tree15129a8df310a6ba2e88563930260ac1d9cacbf3
parent494294d6f88612c20339cc34e4ef893a14565a0f (diff)
virt: detect bhyve (FreeBSD hypervisor) (#3840)
The CPUID and DMI vendor strings do not seem to be documented. Values were found experimentally and by inspecting the source code.
-rw-r--r--man/systemd-detect-virt.xml7
-rw-r--r--src/basic/virt.c5
-rw-r--r--src/basic/virt.h1
3 files changed, 12 insertions, 1 deletions
diff --git a/man/systemd-detect-virt.xml b/man/systemd-detect-virt.xml
index 2b7f4e69ab..61a5f8937f 100644
--- a/man/systemd-detect-virt.xml
+++ b/man/systemd-detect-virt.xml
@@ -88,7 +88,7 @@
</thead>
<tbody>
<row>
- <entry valign="top" morerows="9">VM</entry>
+ <entry valign="top" morerows="10">VM</entry>
<entry><varname>qemu</varname></entry>
<entry>QEMU software virtualization</entry>
</row>
@@ -138,6 +138,11 @@
<entry>Parallels Desktop, Parallels Server</entry>
</row>
+ <row>
+ <entry><varname>bhyve</varname></entry>
+ <entry>bhyve, FreeBSD hypervisor</entry>
+ </row>
+
<row>
<entry valign="top" morerows="5">Container</entry>
<entry><varname>openvz</varname></entry>
diff --git a/src/basic/virt.c b/src/basic/virt.c
index dace1f4328..10a2043746 100644
--- a/src/basic/virt.c
+++ b/src/basic/virt.c
@@ -49,6 +49,8 @@ static int detect_vm_cpuid(void) {
{ "VMwareVMware", VIRTUALIZATION_VMWARE },
/* http://msdn.microsoft.com/en-us/library/ff542428.aspx */
{ "Microsoft Hv", VIRTUALIZATION_MICROSOFT },
+ /* https://wiki.freebsd.org/bhyve */
+ { "bhyve bhyve ", VIRTUALIZATION_BHYVE },
};
uint32_t eax, ecx;
@@ -178,6 +180,8 @@ static int detect_vm_dmi(void) {
{ "Xen", VIRTUALIZATION_XEN },
{ "Bochs", VIRTUALIZATION_BOCHS },
{ "Parallels", VIRTUALIZATION_PARALLELS },
+ /* https://wiki.freebsd.org/bhyve */
+ { "BHYVE", VIRTUALIZATION_BHYVE },
};
unsigned i;
int r;
@@ -502,6 +506,7 @@ static const char *const virtualization_table[_VIRTUALIZATION_MAX] = {
[VIRTUALIZATION_MICROSOFT] = "microsoft",
[VIRTUALIZATION_ZVM] = "zvm",
[VIRTUALIZATION_PARALLELS] = "parallels",
+ [VIRTUALIZATION_BHYVE] = "bhyve",
[VIRTUALIZATION_VM_OTHER] = "vm-other",
[VIRTUALIZATION_SYSTEMD_NSPAWN] = "systemd-nspawn",
diff --git a/src/basic/virt.h b/src/basic/virt.h
index a538f07f6b..bc5b3ae94d 100644
--- a/src/basic/virt.h
+++ b/src/basic/virt.h
@@ -37,6 +37,7 @@ enum {
VIRTUALIZATION_MICROSOFT,
VIRTUALIZATION_ZVM,
VIRTUALIZATION_PARALLELS,
+ VIRTUALIZATION_BHYVE,
VIRTUALIZATION_VM_OTHER,
VIRTUALIZATION_VM_LAST = VIRTUALIZATION_VM_OTHER,