virt: detect bhyve (FreeBSD hypervisor) (#3840)
authorLeonardo Brondani Schenkel <leonardo@schenkel.net>
Mon, 1 Aug 2016 13:04:49 +0000 (15:04 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 1 Aug 2016 13:04:49 +0000 (09:04 -0400)
The CPUID and DMI vendor strings do not seem to be documented.
Values were found experimentally and by inspecting the source code.

man/systemd-detect-virt.xml
src/basic/virt.c
src/basic/virt.h

index 2b7f4e6..61a5f89 100644 (file)
@@ -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>
             <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>
index dace1f4..10a2043 100644 (file)
@@ -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",
index a538f07..bc5b3ae 100644 (file)
@@ -37,6 +37,7 @@ enum {
         VIRTUALIZATION_MICROSOFT,
         VIRTUALIZATION_ZVM,
         VIRTUALIZATION_PARALLELS,
+        VIRTUALIZATION_BHYVE,
         VIRTUALIZATION_VM_OTHER,
         VIRTUALIZATION_VM_LAST = VIRTUALIZATION_VM_OTHER,