From 01ea13d9813df93e294b0d9776d4cefd54b1609b Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 4 Oct 2019 16:25:55 +0300 Subject: [PATCH] Add support for Nutanix Acropolis Hypervisor (AHV) (RHBZ#1756381). Thanks: Cristian Seres for providing access to a guest. --- configure.ac | 2 + tests/nutanix-ahv/Makefile.am | 28 ++++++ tests/nutanix-ahv/proc/cpuinfo | 27 ++++++ tests/nutanix-ahv/proc/self/status | 55 ++++++++++++ tests/nutanix-ahv/sbin/dmidecode | 123 ++++++++++++++++++++++++++ tests/nutanix-ahv/sbin/uname | 2 + tests/nutanix-ahv/sbin/virt-what-cpuid-helper | 2 + tests/nutanix-ahv/test.sh | 32 +++++++ virt-what.in | 10 ++- virt-what.pod | 6 ++ 10 files changed, 286 insertions(+), 1 deletion(-) create mode 100644 tests/nutanix-ahv/Makefile.am create mode 100644 tests/nutanix-ahv/proc/cpuinfo create mode 100644 tests/nutanix-ahv/proc/self/status create mode 100755 tests/nutanix-ahv/sbin/dmidecode create mode 100755 tests/nutanix-ahv/sbin/uname create mode 100755 tests/nutanix-ahv/sbin/virt-what-cpuid-helper create mode 100755 tests/nutanix-ahv/test.sh diff --git a/configure.ac b/configure.ac index 5e0d9c4..f246e34 100644 --- a/configure.ac +++ b/configure.ac @@ -51,6 +51,7 @@ tests="\ lkvm-arm \ lx86 \ lxc \ + nutanix-ahv \ parallels-desktop \ ppc64-baremetal \ ppc64-kvm \ @@ -93,6 +94,7 @@ AC_CONFIG_FILES([Makefile tests/lkvm-arm/Makefile tests/lx86/Makefile tests/lxc/Makefile + tests/nutanix-ahv/Makefile tests/parallels-desktop/Makefile tests/ppc64-baremetal/Makefile tests/ppc64-kvm/Makefile diff --git a/tests/nutanix-ahv/Makefile.am b/tests/nutanix-ahv/Makefile.am new file mode 100644 index 0000000..b748df8 --- /dev/null +++ b/tests/nutanix-ahv/Makefile.am @@ -0,0 +1,28 @@ +# Makefile for virt-what +# 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. + +CLEANFILES = *~ + +TESTS = test.sh + +EXTRA_DIST = \ + test.sh \ + proc/cpuinfo \ + proc/self/status \ + sbin/dmidecode \ + sbin/uname \ + sbin/virt-what-cpuid-helper diff --git a/tests/nutanix-ahv/proc/cpuinfo b/tests/nutanix-ahv/proc/cpuinfo new file mode 100644 index 0000000..d7a1f68 --- /dev/null +++ b/tests/nutanix-ahv/proc/cpuinfo @@ -0,0 +1,27 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 15 +model : 6 +model name : Intel(R) Xeon(R) Silver 4114 CPU @ 2.20GHz +stepping : 1 +microcode : 0x1 +cpu MHz : 2199.998 +cache size : 16384 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 tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc nopl cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 arat md_clear +bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs +bogomips : 4399.99 +clflush size : 64 +cache_alignment : 128 +address sizes : 46 bits physical, 48 bits virtual +power management: + diff --git a/tests/nutanix-ahv/proc/self/status b/tests/nutanix-ahv/proc/self/status new file mode 100644 index 0000000..7b4eed0 --- /dev/null +++ b/tests/nutanix-ahv/proc/self/status @@ -0,0 +1,55 @@ +Name: cat +Umask: 0022 +State: R (running) +Tgid: 18508 +Ngid: 0 +Pid: 18508 +PPid: 18506 +TracerPid: 0 +Uid: 0 0 0 0 +Gid: 0 0 0 0 +FDSize: 64 +Groups: 0 +NStgid: 18508 +NSpid: 18508 +NSpgid: 18506 +NSsid: 1945 +VmPeak: 5392 kB +VmSize: 5392 kB +VmLck: 0 kB +VmPin: 0 kB +VmHWM: 760 kB +VmRSS: 760 kB +RssAnon: 68 kB +RssFile: 692 kB +RssShmem: 0 kB +VmData: 312 kB +VmStk: 132 kB +VmExe: 28 kB +VmLib: 1456 kB +VmPTE: 48 kB +VmSwap: 0 kB +HugetlbPages: 0 kB +CoreDumping: 0 +THP_enabled: 1 +Threads: 1 +SigQ: 3/7359 +SigPnd: 0000000000000000 +ShdPnd: 0000000000000000 +SigBlk: 0000000000000000 +SigIgn: 0000000000000000 +SigCgt: 0000000000000000 +CapInh: 0000000000000000 +CapPrm: 0000003fffffffff +CapEff: 0000003fffffffff +CapBnd: 0000003fffffffff +CapAmb: 0000000000000000 +NoNewPrivs: 0 +Seccomp: 0 +Speculation_Store_Bypass: thread vulnerable +Cpus_allowed: ffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff +Cpus_allowed_list: 0-239 +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: 2 diff --git a/tests/nutanix-ahv/sbin/dmidecode b/tests/nutanix-ahv/sbin/dmidecode new file mode 100755 index 0000000..3774819 --- /dev/null +++ b/tests/nutanix-ahv/sbin/dmidecode @@ -0,0 +1,123 @@ +#!/bin/sh - +cat <<'EOF' +i# dmidecode 3.2 +Getting SMBIOS data from sysfs. +SMBIOS 2.8 present. +9 structures occupying 486 bytes. +Table at 0x000F73C0. + +Handle 0x0000, DMI type 0, 24 bytes +BIOS Information + Vendor: SeaBIOS + Version: 1.9.1-5.el6 + 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: Nutanix + Product Name: AHV + Version: RHEL 7.3.0 PC (i440FX + PIIX, 1996) + Serial Number: B913C223-EEDE-4DFC-BB43-BE1495F4388D + UUID: b913c223-eede-4dfc-bb43-be1495f4388d + 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.3.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: 61 0F 00 00 FF FB 8B 0F + Version: RHEL 7.3.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: 2 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: 2048 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 Memory 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: 0x0007FFFFFFF + Range Size: 2 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/nutanix-ahv/sbin/uname b/tests/nutanix-ahv/sbin/uname new file mode 100755 index 0000000..ab0ec89 --- /dev/null +++ b/tests/nutanix-ahv/sbin/uname @@ -0,0 +1,2 @@ +#!/bin/sh - +echo x86_64 diff --git a/tests/nutanix-ahv/sbin/virt-what-cpuid-helper b/tests/nutanix-ahv/sbin/virt-what-cpuid-helper new file mode 100755 index 0000000..f52a9d7 --- /dev/null +++ b/tests/nutanix-ahv/sbin/virt-what-cpuid-helper @@ -0,0 +1,2 @@ +#!/bin/sh - +echo KVMKVMKVM diff --git a/tests/nutanix-ahv/test.sh b/tests/nutanix-ahv/test.sh new file mode 100755 index 0000000..3d934b2 --- /dev/null +++ b/tests/nutanix-ahv/test.sh @@ -0,0 +1,32 @@ +# Test for Nutanix AHV +# Copyright (C) 2019 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. + +output="$(PATH=../..:$PATH virt-what --test-root=. 2>&1)" +expected="nutanix_ahv" + +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 f685461..9eafa05 100644 --- a/virt-what.in +++ b/virt-what.in @@ -1,6 +1,6 @@ #!/bin/sh - # @configure_input@ -# Copyright (C) 2008-2017 Red Hat Inc. +# Copyright (C) 2008-2019 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 @@ -220,6 +220,14 @@ if echo "$dmi" | grep -q 'Vendor: Parallels'; then skip_qemu_kvm=true fi +# Check for Nutanix AHV. +# This is sufficiently different from KVM and has Viridian extensions, +# so skip the KVM test. +if echo "$dmi" | grep -q 'Manufacturer: Nutanix'; then + echo nutanix_ahv + skip_qemu_kvm=true +fi + # Check for oVirt/RHEV. if echo "$dmi" | grep -q 'Manufacturer: oVirt'; then echo ovirt diff --git a/virt-what.pod b/virt-what.pod index 5a0bdfc..ea5cb77 100644 --- a/virt-what.pod +++ b/virt-what.pod @@ -177,6 +177,12 @@ is lkvm (a.k.a kvmtool). Status: contributed by Andrew Jones +=item B + +The guest is running inside Nutanix Acropolis Hypervisor (AHV). + +Status: confirmed by RWMJ. + =item B The guest appears to be running inside an OpenVZ or Virtuozzo -- 1.8.3.1