virt-what: recognize OpenBSD vmm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Please find attached a patch for virt-what to recognize the OpenBSD VMM
hypervisor.

For more information on vmm, please refer to:
- http://man.openbsd.org/vmm.4
- https://www.openbsd.org/papers/asiabsdcon2017-vmm-slides.pdf


>From 837390b5afbb9253a62b15208d6fb4cbbbecabf1 Mon Sep 17 00:00:00 2001
From: Jasper Lievisse Adriaanse <j@xxxxxxxxx>
Date: Sat, 17 Jun 2017 21:17:39 +0200
Subject: [PATCH] vmm detection (OpenBSD hypervisor)

---
 Makefile.am                           |  7 +++++++
 tests/test-vmm.sh                     | 34 ++++++++++++++++++++++++++++++++++
 tests/vmm/proc/cpuinfo                | 25 +++++++++++++++++++++++++
 tests/vmm/sbin/dmidecode              |  7 +++++++
 tests/vmm/sbin/uname                  |  2 ++
 tests/vmm/sbin/virt-what-cpuid-helper |  2 ++
 virt-what.in                          |  5 +++++
 virt-what.pod                         |  6 ++++++
 8 files changed, 88 insertions(+)
 create mode 100755 tests/test-vmm.sh
 create mode 100644 tests/vmm/proc/cpuinfo
 create mode 100755 tests/vmm/sbin/dmidecode
 create mode 100755 tests/vmm/sbin/uname
 create mode 100755 tests/vmm/sbin/virt-what-cpuid-helper

diff --git a/Makefile.am b/Makefile.am
index e32c07c..5cdb943 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -65,6 +65,7 @@ TESTS = \
 	tests/test-rhel5-xen-domU-hvm-ia64.sh \
 	tests/test-rhel5-xen-domU-pv.sh \
 	tests/test-rhev.sh \
+	tests/test-vmm.sh \
 	tests/test-xen-arm.sh \
 	tests/test-zvm.sh
 
@@ -244,6 +245,12 @@ EXTRA_DIST = \
 	tests/rhev/sbin/dmidecode \
 	tests/rhev/sbin/uname \
 	tests/rhev/sbin/virt-what-cpuid-helper \
+	tests/vmm/proc/cpuinfo \
+	tests/vvm/proc/self/status \
+	tests/vvm/proc/sysinfo \
+	tests/vvm/sbin/dmidecode \
+	tests/vvm/sbin/uname \
+	tests/vvm/sbin/virt-what-cpuid-helper \
 	tests/xen-arm/proc/cpuinfo \
 	tests/xen-arm/proc/device-tree/hypervisor/compatible \
 	tests/xen-arm/proc/self/status \
diff --git a/tests/test-vmm.sh b/tests/test-vmm.sh
new file mode 100755
index 0000000..e1de60a
--- /dev/null
+++ b/tests/test-vmm.sh
@@ -0,0 +1,34 @@
+# Test for vmm
+# Copyright (C) 2008-2011 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+root=tests/vmm
+
+output="$(./virt-what --test-root=$root 2>&1)"
+expected="vmm"
+
+if [ "$output" != "$expected" ]; then
+    echo "$0: test failed because output did not match expected"
+    echo "Expected output was:"
+    echo "----------------------------------------"
+    echo "$expected"
+    echo "----------------------------------------"
+    echo "But the actual output of the program was:"
+    echo "----------------------------------------"
+    echo "$output"
+    echo "----------------------------------------"
+    exit 1
+fi
diff --git a/tests/vmm/proc/cpuinfo b/tests/vmm/proc/cpuinfo
new file mode 100644
index 0000000..77e142c
--- /dev/null
+++ b/tests/vmm/proc/cpuinfo
@@ -0,0 +1,25 @@
+processor	: 0
+vendor_id	: GenuineIntel
+cpu family	: 6
+model		: 61
+model name	: Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
+stepping	: 4
+cache size	: 3072 KB
+physical id	: 0
+siblings	: 1
+core id		: 0
+cpu cores	: 1
+apicid		: 0
+initial apicid	: 0
+fpu		: yes
+fpu_exception	: yes
+cpuid level	: 13
+wp		: yes
+flags		: fpu vme de pse msr pae mce cx8 sep pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx pdpe1gb lm constant_tsc nopl eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase tsc_adjust bmi1 avx2 smep bmi2 rdseed adx smap
+bugs		:
+bogomips	: 11431.11
+clflush size	: 64
+cache_alignment	: 64
+address sizes	: 36 bits physical, 48 bits virtual
+power management:
+
diff --git a/tests/vmm/sbin/dmidecode b/tests/vmm/sbin/dmidecode
new file mode 100755
index 0000000..c10a540
--- /dev/null
+++ b/tests/vmm/sbin/dmidecode
@@ -0,0 +1,7 @@
+#!/bin/sh -
+cat <<'EOF'
+# dmidecode 3.1
+Scanning /dev/mem for entry point.
+# No SMBIOS nor DMI entry point found, sorry.
+
+EOF
diff --git a/tests/vmm/sbin/uname b/tests/vmm/sbin/uname
new file mode 100755
index 0000000..ab0ec89
--- /dev/null
+++ b/tests/vmm/sbin/uname
@@ -0,0 +1,2 @@
+#!/bin/sh -
+echo x86_64
diff --git a/tests/vmm/sbin/virt-what-cpuid-helper b/tests/vmm/sbin/virt-what-cpuid-helper
new file mode 100755
index 0000000..bbf0530
--- /dev/null
+++ b/tests/vmm/sbin/virt-what-cpuid-helper
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo 'OpenBSDVMM58'
diff --git a/virt-what.in b/virt-what.in
index 1a373ed..d7c8bbd 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -338,3 +338,8 @@ if [ "$arch" = "ppc64" ]; then
         fi
     fi
 fi
+
+# Check for OpenBSD/VMM
+if [ "$cpuid" = "OpenBSDVMM58" ]; then
+        echo vmm
+fi
diff --git a/virt-what.pod b/virt-what.pod
index 272be70..1371c18 100644
--- a/virt-what.pod
+++ b/virt-what.pod
@@ -207,6 +207,12 @@ The guest appears to be running on Microsoft VirtualPC.
 
 Status: not confirmed
 
+=item B<vmm>
+
+This is a vmm (OpenBSD hypervisor) guest.
+
+Status: contributed by Jasper Lievisse Adriaanse.
+
 =item B<vmware>
 
 The guest appears to be running on VMware hypervisor.
-- 
2.13.1


-- 
jasper

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux