Add detection of Red Hat Enterprise Virtualization hypervisor (RHBZ#1249438).
authorRichard W.M. Jones <rjones@redhat.com>
Mon, 22 Aug 2016 11:30:25 +0000 (12:30 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Mon, 31 Oct 2016 10:16:49 +0000 (06:16 -0400)
Thanks: Xianghua Chen
(cherry picked from commit 73f639241174bde5066838ed67e959ef047da144)

Makefile.am
tests/rhev/proc/cpuinfo [new file with mode: 0644]
tests/rhev/proc/self/status [new file with mode: 0644]
tests/rhev/sbin/dmidecode [new file with mode: 0755]
tests/rhev/sbin/uname [new file with mode: 0755]
tests/rhev/sbin/virt-what-cpuid-helper [new file with mode: 0755]
tests/test-rhev.sh [new file with mode: 0755]
virt-what.in
virt-what.pod

index 73dfc7b..d5ee027 100644 (file)
@@ -63,6 +63,7 @@ TESTS = \
        tests/test-rhel5-xen-domU-hvm.sh \
        tests/test-rhel5-xen-domU-hvm-ia64.sh \
        tests/test-rhel5-xen-domU-pv.sh \
+       tests/test-rhev.sh \
        tests/test-xen-arm.sh \
        tests/test-zvm.sh
 
@@ -237,6 +238,11 @@ EXTRA_DIST = \
        tests/rhel5-xen-domU-pv/sys/hypervisor/compilation/compiled_by \
        tests/rhel5-xen-domU-pv/sys/hypervisor/compilation/compile_date \
        tests/rhel5-xen-domU-pv/sys/hypervisor/uuid \
+       tests/rhev/proc/cpuinfo \
+       tests/rhev/proc/self/status \
+       tests/rhev/sbin/dmidecode \
+       tests/rhev/sbin/uname \
+       tests/rhev/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/rhev/proc/cpuinfo b/tests/rhev/proc/cpuinfo
new file mode 100644 (file)
index 0000000..6dba878
--- /dev/null
@@ -0,0 +1,26 @@
+processor      : 0
+vendor_id      : GenuineIntel
+cpu family     : 6
+model          : 15
+model name     : Intel Celeron_4x0 (Conroe/Merom Class Core 2)
+stepping       : 3
+microcode      : 0x1
+cpu MHz                : 3392.302
+cache size     : 4096 KB
+physical id    : 0
+siblings       : 1
+core id                : 0
+cpu cores      : 1
+apicid         : 0
+initial apicid : 0
+fpu            : yes
+fpu_exception  : yes
+cpuid level    : 10
+wp             : yes
+flags          : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm constant_tsc rep_good nopl pni ssse3 x2apic hypervisor lahf_lm
+bogomips       : 6784.60
+clflush size   : 64
+cache_alignment        : 64
+address sizes  : 36 bits physical, 48 bits virtual
+power management:
+
diff --git a/tests/rhev/proc/self/status b/tests/rhev/proc/self/status
new file mode 100644 (file)
index 0000000..5d1fe13
--- /dev/null
@@ -0,0 +1,41 @@
+Name:  cat
+State: R (running)
+Tgid:  32687
+Ngid:  0
+Pid:   32687
+PPid:  32670
+TracerPid:     0
+Uid:   0       0       0       0
+Gid:   0       0       0       0
+FDSize:        256
+Groups:        0 
+VmPeak:          107916 kB
+VmSize:          107916 kB
+VmLck:        0 kB
+VmPin:        0 kB
+VmHWM:      348 kB
+VmRSS:      348 kB
+VmData:             180 kB
+VmStk:      136 kB
+VmExe:       44 kB
+VmLib:     1880 kB
+VmPTE:       44 kB
+VmSwap:               0 kB
+Threads:       1
+SigQ:  0/3883
+SigPnd:        0000000000000000
+ShdPnd:        0000000000000000
+SigBlk:        0000000000000000
+SigIgn:        0000000000000000
+SigCgt:        0000000000000000
+CapInh:        0000000000000000
+CapPrm:        0000001fffffffff
+CapEff:        0000001fffffffff
+CapBnd:        0000001fffffffff
+Seccomp:       0
+Cpus_allowed:  ffff
+Cpus_allowed_list:     0-15
+Mems_allowed:  00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
+Mems_allowed_list:     0
+voluntary_ctxt_switches:       0
+nonvoluntary_ctxt_switches:    0
diff --git a/tests/rhev/sbin/dmidecode b/tests/rhev/sbin/dmidecode
new file mode 100755 (executable)
index 0000000..d44f172
--- /dev/null
@@ -0,0 +1,123 @@
+#!/bin/sh -
+cat <<'EOF'
+# dmidecode 3.0
+Scanning /dev/mem for entry point.
+SMBIOS 2.8 present.
+9 structures occupying 481 bytes.
+Table at 0x000F1D20.
+
+Handle 0x0000, DMI type 0, 24 bytes
+BIOS Information
+       Vendor: SeaBIOS
+       Version: seabios-1.7.5-11.el7
+       Release Date: 04/01/2014
+       Address: 0xE8000
+       Runtime Size: 96 kB
+       ROM Size: 64 kB
+       Characteristics:
+               BIOS characteristics not supported
+               Targeted content distribution is supported
+       BIOS Revision: 0.0
+
+Handle 0x0100, DMI type 1, 27 bytes
+System Information
+       Manufacturer: Red Hat
+       Product Name: RHEV Hypervisor
+       Version: 4.0-2.el7
+       Serial Number: 4C4C4544-004C-4B10-8036-C7C04F4A5931
+       UUID: 469665C0-69F7-436B-BBF3-6632988BEDC8
+       Wake-up Type: Power Switch
+       SKU Number: Not Specified
+       Family: Red Hat Enterprise Linux
+
+Handle 0x0300, DMI type 3, 21 bytes
+Chassis Information
+       Manufacturer: Red Hat
+       Type: Other
+       Lock: Not Present
+       Version: RHEL 7.2.0 PC (i440FX + PIIX, 1996)
+       Serial Number: Not Specified
+       Asset Tag: Not Specified
+       Boot-up State: Safe
+       Power Supply State: Safe
+       Thermal State: Safe
+       Security Status: Unknown
+       OEM Information: 0x00000000
+       Height: Unspecified
+       Number Of Power Cords: Unspecified
+       Contained Elements: 0
+
+Handle 0x0400, DMI type 4, 42 bytes
+Processor Information
+       Socket Designation: CPU 0
+       Type: Central Processor
+       Family: Other
+       Manufacturer: Red Hat
+       ID: F3 06 00 00 FF FB 8B 07
+       Version: RHEL 7.2.0 PC (i440FX + PIIX, 1996)
+       Voltage: Unknown
+       External Clock: Unknown
+       Max Speed: 2000 MHz
+       Current Speed: 2000 MHz
+       Status: Populated, Enabled
+       Upgrade: Other
+       L1 Cache Handle: Not Provided
+       L2 Cache Handle: Not Provided
+       L3 Cache Handle: Not Provided
+       Serial Number: Not Specified
+       Asset Tag: Not Specified
+       Part Number: Not Specified
+       Core Count: 1
+       Core Enabled: 1
+       Thread Count: 1
+       Characteristics: None
+
+Handle 0x1000, DMI type 16, 23 bytes
+Physical Memory Array
+       Location: Other
+       Use: System Memory
+       Error Correction Type: Multi-bit ECC
+       Maximum Capacity: 1 GB
+       Error Information Handle: Not Provided
+       Number Of Devices: 1
+
+Handle 0x1100, DMI type 17, 40 bytes
+Memory Device
+       Array Handle: 0x1000
+       Error Information Handle: Not Provided
+       Total Width: Unknown
+       Data Width: Unknown
+       Size: 1024 MB
+       Form Factor: DIMM
+       Set: None
+       Locator: DIMM 0
+       Bank Locator: Not Specified
+       Type: RAM
+       Type Detail: Other
+       Speed: Unknown
+       Manufacturer: Red Hat
+       Serial Number: Not Specified
+       Asset Tag: Not Specified
+       Part Number: Not Specified
+       Rank: Unknown
+       Configured Clock Speed: Unknown
+       Minimum Voltage: Unknown
+       Maximum Voltage: Unknown
+       Configured Voltage: Unknown
+
+Handle 0x1300, DMI type 19, 31 bytes
+Memory Array Mapped Address
+       Starting Address: 0x00000000000
+       Ending Address: 0x0003FFFFFFF
+       Range Size: 1 GB
+       Physical Array Handle: 0x1000
+       Partition Width: 1
+
+Handle 0x2000, DMI type 32, 11 bytes
+System Boot Information
+       Status: No errors detected
+
+Handle 0x7F00, DMI type 127, 4 bytes
+End Of Table
+
+EOF
diff --git a/tests/rhev/sbin/uname b/tests/rhev/sbin/uname
new file mode 100755 (executable)
index 0000000..ab0ec89
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh -
+echo x86_64
diff --git a/tests/rhev/sbin/virt-what-cpuid-helper b/tests/rhev/sbin/virt-what-cpuid-helper
new file mode 100755 (executable)
index 0000000..86e1188
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh -
+echo 'KVMKVMKVM'
diff --git a/tests/test-rhev.sh b/tests/test-rhev.sh
new file mode 100755 (executable)
index 0000000..76be547
--- /dev/null
@@ -0,0 +1,35 @@
+# Test for rhev
+# Copyright (C) 2008-2016 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/rhev
+
+output="$(./virt-what --test-root=$root 2>&1)"
+expected="rhev
+kvm"
+
+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
index 0e048a2..761fc1b 100644 (file)
@@ -203,10 +203,13 @@ if echo "$dmi" | grep -q 'Vendor: Parallels'; then
     skip_qemu_kvm=true
 fi
 
-# Check for oVirt.
+# Check for oVirt/RHEV.
 if echo "$dmi" | grep -q 'Manufacturer: oVirt'; then
     echo ovirt
 fi
+if echo "$dmi" | grep -q 'Product Name: RHEV Hypervisor'; then
+    echo rhev
+fi
 
 # Check for Xen.
 
index fe9567f..c7a211b 100644 (file)
@@ -133,7 +133,8 @@ Status: contributed by Evgeniy Sokolov
 
 =item B<ovirt>
 
-The guest is running on an oVirt or RHEV node.
+The guest is running on an oVirt node.
+(See also C<rhev> below).
 
 Status: contributed by RWMJ, not confirmed
 
@@ -160,6 +161,12 @@ this.
 
 Status: confirmed by RWMJ.
 
+=item B<rhev>
+
+The guest is running on a Red Hat Enterprise Virtualization (RHEV) node.
+
+Status: confirmed by RWMJ
+
 =item B<uml>
 
 This is a User-Mode Linux (UML) guest.