new case: support "rhev" virtualization by RedHat (ovirt based, but branded). Test cases included and passed. --- tests/rhev/proc/cpuinfo | 25 +++++ tests/rhev/sbin/dmidecode | 114 ++++++++++++++++++++ tests/rhev/sbin/uname | 2 + tests/rhev/sbin/virt-what-cpuid-helper | 2 + tests/rhev/sys/devices/virtual/dmi/id/product_name | 1 + tests/test-rhev.sh | 21 ++++ virt-what.in | 7 ++ 7 files changed, 172 insertions(+), 0 deletions(-) create mode 100644 tests/rhev/proc/cpuinfo create mode 100644 tests/rhev/proc/self/status create mode 100755 tests/rhev/sbin/dmidecode create mode 100755 tests/rhev/sbin/uname create mode 100755 tests/rhev/sbin/virt-what-cpuid-helper create mode 100644 tests/rhev/sys/devices/virtual/dmi/id/product_name create mode 100755 tests/test-rhev.sh
diff --git a/tests/rhev/proc/cpuinfo b/tests/rhev/proc/cpuinfo new file mode 100644 index 0000000..a36c629 --- /dev/null +++ b/tests/rhev/proc/cpuinfo @@ -0,0 +1,25 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 42 +model name : Intel Xeon E312xx (Sandy Bridge) +stepping : 1 +microcode : 0x1 +cpu MHz : 2599.998 +cache size : 4096 KB +physical id : 2 +siblings : 1 +core id : 0 +cpu cores : 1 +apicid : 2 +initial apicid : 2 +fpu : yes +fpu_exception : yes +cpuid level : 13 +wp : yes +flags : fpu 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 eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx hypervisor lahf_lm xsaveopt +bogomips : 5199.99 +clflush size : 64 +cache_alignment : 64 +address sizes : 46 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 index 0000000..e69de29 diff --git a/tests/rhev/sbin/dmidecode b/tests/rhev/sbin/dmidecode new file mode 100755 index 0000000..851562e --- /dev/null +++ b/tests/rhev/sbin/dmidecode @@ -0,0 +1,114 @@ +#!/bin/sh - +cat <<'EOF' +# dmidecode 2.11 +SMBIOS 2.4 present. +25 structures occupying 1035 bytes. +Table at 0x7E7FFBF0. + +Handle 0x0000, DMI type 0, 24 bytes +BIOS Information + Vendor: Seabios + Version: 0.5.1 + Release Date: 01/01/2011 + Address: 0xE8000 + Runtime Size: 96 kB + ROM Size: 64 kB + Characteristics: + BIOS characteristics not supported + Targeted content distribution is supported + BIOS Revision: 1.0 + +Handle 0x0100, DMI type 1, 27 bytes +System Information + Manufacturer: Red Hat + Product Name: RHEV Hypervisor + Version: 7.2-20151129.1.el7ev + Serial Number: 30313436-3631-5A43-3333-33374E33454B + UUID: 0B4DFC1D-7159-46C8-B41D-FC61B85B5952 + Wake-up Type: Power Switch + SKU Number: Not Specified + Family: Red Hat Enterprise Linux + +Handle 0x0300, DMI type 3, 20 bytes +Chassis Information + Manufacturer: Bochs + Type: Other + Lock: Not Present + Version: Not Specified + 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 + +Handle 0x0401, DMI type 4, 32 bytes +Processor Information + Socket Designation: CPU 1 + Type: Central Processor + Family: Other + Manufacturer: Bochs + ID: A1 06 02 00 FD FB 8B 07 + Version: Not Specified + 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 + +Handle 0x1000, DMI type 16, 15 bytes +Physical Memory Array + Location: Other + Use: System Memory + Error Correction Type: Multi-bit ECC + Maximum Capacity: 2024 MB + Error Information Handle: Not Provided + Number Of Devices: 1 + +Handle 0x1100, DMI type 17, 21 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: 0x0000 + Total Width: 64 bits + Data Width: 64 bits + Size: 2024 MB + Form Factor: DIMM + Set: None + Locator: DIMM 0 + Bank Locator: Not Specified + Type: RAM + Type Detail: None + +Handle 0x1300, DMI type 19, 15 bytes +Memory Array Mapped Address + Starting Address: 0x00000000000 + Ending Address: 0x0007E7FFFFF + Range Size: 2024 MB + Physical Array Handle: 0x1000 + Partition Width: 1 + +Handle 0x1400, DMI type 20, 19 bytes +Memory Device Mapped Address + Starting Address: 0x00000000000 + Ending Address: 0x0007E7FFFFF + Range Size: 2024 MB + Physical Device Handle: 0x1100 + Memory Array Mapped Address Handle: 0x1300 + Partition Row Position: 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 + +# dmidecode 2.11 +EOF diff --git a/tests/rhev/sbin/uname b/tests/rhev/sbin/uname new file mode 100755 index 0000000..ab0ec89 --- /dev/null +++ b/tests/rhev/sbin/uname @@ -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 index 0000000..4209d83 --- /dev/null +++ b/tests/rhev/sbin/virt-what-cpuid-helper @@ -0,0 +1,2 @@ +: +echo KVMKVMKVM diff --git a/tests/rhev/sys/devices/virtual/dmi/id/product_name b/tests/rhev/sys/devices/virtual/dmi/id/product_name new file mode 100644 index 0000000..b6e5ab5 --- /dev/null +++ b/tests/rhev/sys/devices/virtual/dmi/id/product_name @@ -0,0 +1 @@ +RHEV Hypervisor diff --git a/tests/test-rhev.sh b/tests/test-rhev.sh new file mode 100755 index 0000000..77b5541 --- /dev/null +++ b/tests/test-rhev.sh @@ -0,0 +1,21 @@ +# Test for RHEV +# Author: otheus <[email protected]> +# License: Public domain + +root=tests/rhev + +output="$(./virt-what --test-root=$root 2>&1)" +expected="rhev" + +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/virt-what.in b/virt-what.in index 776bfde..67bbc67 100644 --- a/virt-what.in +++ b/virt-what.in @@ -114,6 +114,13 @@ elif echo "$dmi" | grep -q 'Manufacturer: VMware'; then echo vmware fi +# Check for RedHat Virtualization +if grep -q 'RHEV Hypervisor' "${root}/sys/devices/virtual/dmi/id/product_name"; then + echo rhev; exit; +elif echo "$dmi" | grep -q '[[:space:]]Product Name: RHEV Hypervisor'; then + echo rhev; exit; +fi 2>/dev/null + # Check for Hyper-V. # http://blogs.msdn.com/b/sqlosteam/archive/2010/10/30/is-this-real-the-metaphysics-of-hardware-virtualization.aspx if [ "$cpuid" = "Microsoft Hv" ]; then -- 1.7.1 -- Otheus [email protected] [email protected]
_______________________________________________ virt-tools-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/virt-tools-list
