New upstream version 1.21.
This commit is contained in:
parent
fdac88bb69
commit
8f53b993c1
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
/virt-what-*.tar.gz
|
||||
/virt-what-1.21.tar.gz.sig
|
||||
|
@ -1,118 +0,0 @@
|
||||
From 0a0d9fa7c85c5474870cae37832d28ccd899d4ee Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Fri, 4 Oct 2019 15:57:42 +0300
|
||||
Subject: [PATCH 1/8] Fix virt-what-cpuid-helper.
|
||||
|
||||
The value returned in %eax is the max_entry (eg. 0x40000000
|
||||
if there are no further leafs). However it is not reliable.
|
||||
In addition if there are multiple leafs we should probably
|
||||
only print the highest one.
|
||||
|
||||
Also use uint32_t instead of unsigned int.
|
||||
|
||||
Thanks: Paolo Bonzini.
|
||||
---
|
||||
virt-what-cpuid-helper.c | 67 ++++++++++++++++++++++++++++------------
|
||||
1 file changed, 48 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/virt-what-cpuid-helper.c b/virt-what-cpuid-helper.c
|
||||
index 7812545..0cd4a6f 100644
|
||||
--- a/virt-what-cpuid-helper.c
|
||||
+++ b/virt-what-cpuid-helper.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/* virt-what-cpuid-helper: Are we running inside KVM or Xen HVM?
|
||||
- * Copyright (C) 2008 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
|
||||
@@ -21,14 +21,35 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
|
||||
-static unsigned int
|
||||
-cpuid (unsigned int eax, char *sig)
|
||||
+/* Known x86 hypervisor signatures. Note that if you add a new test
|
||||
+ * to virt-what.in you may need to update this list. The signature is
|
||||
+ * always 12 bytes except in the case of KVM.
|
||||
+ */
|
||||
+static int
|
||||
+known_signature (char *sig)
|
||||
{
|
||||
- unsigned int *sig32 = (unsigned int *) sig;
|
||||
+ return
|
||||
+ strcmp (sig, "bhyve bhyve ") == 0 ||
|
||||
+ strcmp (sig, "KVMKVMKVM") == 0 ||
|
||||
+ strcmp (sig, "LKVMLKVMLKVM") == 0 ||
|
||||
+ strcmp (sig, "Microsoft Hv") == 0 ||
|
||||
+ strcmp (sig, "OpenBSDVMM58") == 0 ||
|
||||
+ strcmp (sig, "TCGTCGTCGTCG") == 0 ||
|
||||
+ strcmp (sig, "VMwareVMware") == 0 ||
|
||||
+ strcmp (sig, "XenVMMXenVMM") == 0 ||
|
||||
+ 0;
|
||||
+}
|
||||
+
|
||||
+static uint32_t
|
||||
+cpuid (uint32_t eax, char *sig)
|
||||
+{
|
||||
+ uint32_t *sig32 = (uint32_t *) sig;
|
||||
|
||||
asm volatile (
|
||||
"xchgl %%ebx,%1; xor %%ebx,%%ebx; cpuid; xchgl %%ebx,%1"
|
||||
@@ -43,24 +64,32 @@ static void
|
||||
cpu_sig (void)
|
||||
{
|
||||
char sig[13];
|
||||
- unsigned int base = 0x40000000, leaf = base;
|
||||
- unsigned int max_entries;
|
||||
+ const uint32_t base = 0x40000000;
|
||||
+ uint32_t leaf;
|
||||
|
||||
- memset (sig, 0, sizeof sig);
|
||||
- max_entries = cpuid (leaf, sig);
|
||||
- puts (sig);
|
||||
-
|
||||
- /* Most hypervisors only have information in leaf 0x40000000, but
|
||||
- * upstream Xen contains further leaf entries (in particular when
|
||||
- * used with Viridian [HyperV] extensions). CPUID is supposed to
|
||||
- * return the maximum leaf offset in %eax, so that's what we use,
|
||||
- * but only if it looks sensible.
|
||||
+ /* Most hypervisors only have information in leaf 0x40000000.
|
||||
+ *
|
||||
+ * Some hypervisors have "Viridian [HyperV] extensions", and those
|
||||
+ * must appear in slot 0x40000000, but they will also have the true
|
||||
+ * hypervisor in a higher slot.
|
||||
+ *
|
||||
+ * CPUID is supposed to return the maximum leaf offset in %eax, but
|
||||
+ * this is not reliable. Instead we check the returned signatures
|
||||
+ * against a known list (the others will be empty or garbage) and
|
||||
+ * only print the ones we know about. This is OK because if we add
|
||||
+ * a new test in virt-what we can update the list.
|
||||
+ *
|
||||
+ * By searching backwards we only print the highest entry, thus
|
||||
+ * ignoring Viridian for Xen (and Nutanix). If we ever encounter a
|
||||
+ * hypervisor that has more than 2 entries we may need to revisit
|
||||
+ * this.
|
||||
*/
|
||||
- if (max_entries > 3 && max_entries < 0x10000) {
|
||||
- for (leaf = base + 0x100; leaf <= base + max_entries; leaf += 0x100) {
|
||||
- memset (sig, 0, sizeof sig);
|
||||
- cpuid (leaf, sig);
|
||||
+ for (leaf = base + 0xff00; leaf >= base; leaf -= 0x100) {
|
||||
+ memset (sig, 0, sizeof sig);
|
||||
+ cpuid (leaf, sig);
|
||||
+ if (known_signature (sig)) {
|
||||
puts (sig);
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
}
|
||||
--
|
||||
2.29.0.rc2
|
||||
|
@ -1,405 +0,0 @@
|
||||
From f317e788dd7c2a35c2ae0f64fa50ab720382ebf5 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Fri, 4 Oct 2019 16:25:55 +0300
|
||||
Subject: [PATCH 2/8] 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 c45f469..58b3d77 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<nutanix_ahv>
|
||||
+
|
||||
+The guest is running inside Nutanix Acropolis Hypervisor (AHV).
|
||||
+
|
||||
+Status: confirmed by RWMJ.
|
||||
+
|
||||
=item B<openvz>
|
||||
|
||||
The guest appears to be running inside an OpenVZ or Virtuozzo
|
||||
--
|
||||
2.29.0.rc2
|
||||
|
@ -1,38 +0,0 @@
|
||||
From 5cdf740942a4f443977344428dfe6c43f232f0eb Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Fri, 4 Oct 2019 18:30:01 +0100
|
||||
Subject: [PATCH 3/8] helper: Fix KVM signature.
|
||||
|
||||
Thanks: Paolo Bonzini.
|
||||
---
|
||||
virt-what-cpuid-helper.c | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/virt-what-cpuid-helper.c b/virt-what-cpuid-helper.c
|
||||
index 0cd4a6f..9c6cdb2 100644
|
||||
--- a/virt-what-cpuid-helper.c
|
||||
+++ b/virt-what-cpuid-helper.c
|
||||
@@ -28,15 +28,16 @@
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
|
||||
/* Known x86 hypervisor signatures. Note that if you add a new test
|
||||
- * to virt-what.in you may need to update this list. The signature is
|
||||
- * always 12 bytes except in the case of KVM.
|
||||
+ * to virt-what.in you may need to update this list. Note the
|
||||
+ * signature is always 12 bytes long, plus we add \0 to the end to
|
||||
+ * make it 13 bytes.
|
||||
*/
|
||||
static int
|
||||
-known_signature (char *sig)
|
||||
+known_signature (const char *sig)
|
||||
{
|
||||
return
|
||||
strcmp (sig, "bhyve bhyve ") == 0 ||
|
||||
- strcmp (sig, "KVMKVMKVM") == 0 ||
|
||||
+ memcmp (sig, "KVMKVMKVM\0\0\0", 12) == 0 ||
|
||||
strcmp (sig, "LKVMLKVMLKVM") == 0 ||
|
||||
strcmp (sig, "Microsoft Hv") == 0 ||
|
||||
strcmp (sig, "OpenBSDVMM58") == 0 ||
|
||||
--
|
||||
2.29.0.rc2
|
||||
|
@ -1,27 +0,0 @@
|
||||
From 3aa4ad0f81c35a56960871b68731b6e948d95f56 Mon Sep 17 00:00:00 2001
|
||||
From: willem van de velde <williamvdvelde@gmail.com>
|
||||
Date: Tue, 22 Oct 2019 11:58:01 +0100
|
||||
Subject: [PATCH 4/8] Fix incorrect detection of MS Surfacebook 2 as a virtual
|
||||
machine.
|
||||
|
||||
---
|
||||
virt-what.in | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/virt-what.in b/virt-what.in
|
||||
index 9eafa05..a61ce91 100644
|
||||
--- a/virt-what.in
|
||||
+++ b/virt-what.in
|
||||
@@ -132,7 +132,8 @@ fi
|
||||
# The negative check for cpuid is to distinguish this from Hyper-V
|
||||
# which also has the same manufacturer string in the SM-BIOS data.
|
||||
if [ "$cpuid" != "Microsoft Hv" ] &&
|
||||
- echo "$dmi" | grep -q 'Manufacturer: Microsoft Corporation'; then
|
||||
+ echo "$dmi" | grep -q 'Manufacturer: Microsoft Corporation' &&
|
||||
+ echo "$dmi" | grep -q 'Product Name: Virtual Machine'; then
|
||||
echo virtualpc
|
||||
fi
|
||||
|
||||
--
|
||||
2.29.0.rc2
|
||||
|
@ -1,46 +0,0 @@
|
||||
From e2c49cda221f95cb65b1b3ac3ae15aa41d92f519 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
|
||||
Date: Sun, 1 Dec 2019 07:58:04 +0200
|
||||
Subject: [PATCH 5/8] docker: Check for /.dockerenv too
|
||||
|
||||
/.dockerinit may no longer exist.
|
||||
|
||||
Ref https://github.com/moby/moby/issues/18355
|
||||
---
|
||||
tests/docker/.dockerenv | 0
|
||||
tests/docker/Makefile.am | 1 +
|
||||
virt-what.in | 2 +-
|
||||
3 files changed, 2 insertions(+), 1 deletion(-)
|
||||
create mode 100644 tests/docker/.dockerenv
|
||||
|
||||
diff --git a/tests/docker/.dockerenv b/tests/docker/.dockerenv
|
||||
new file mode 100644
|
||||
index 0000000..e69de29
|
||||
diff --git a/tests/docker/Makefile.am b/tests/docker/Makefile.am
|
||||
index e0ea991..e2a95d8 100644
|
||||
--- a/tests/docker/Makefile.am
|
||||
+++ b/tests/docker/Makefile.am
|
||||
@@ -21,6 +21,7 @@ TESTS = test.sh
|
||||
|
||||
EXTRA_DIST = \
|
||||
test.sh \
|
||||
+ .dockerenv \
|
||||
.dockerinit \
|
||||
proc/cpuinfo \
|
||||
proc/self/status \
|
||||
diff --git a/virt-what.in b/virt-what.in
|
||||
index a61ce91..db16b5f 100644
|
||||
--- a/virt-what.in
|
||||
+++ b/virt-what.in
|
||||
@@ -345,7 +345,7 @@ if ! "$skip_lkvm"; then
|
||||
fi
|
||||
|
||||
# Check for Docker.
|
||||
-if [ -f "${root}/.dockerinit" ]; then
|
||||
+if [ -f "${root}/.dockerenv" ] || [ -f "${root}/.dockerinit" ]; then
|
||||
echo docker
|
||||
fi
|
||||
|
||||
--
|
||||
2.29.0.rc2
|
||||
|
@ -1,61 +0,0 @@
|
||||
From 57f0c3cc6a7e631f644d67f05b002c6004bb6601 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
|
||||
Date: Sun, 1 Dec 2019 08:21:32 +0200
|
||||
Subject: [PATCH 6/8] docker: Lookup from /proc/self/cgroup too
|
||||
|
||||
Refs https://github.com/moby/moby/issues/18355
|
||||
---
|
||||
tests/docker/Makefile.am | 1 +
|
||||
tests/docker/proc/self/cgroup | 13 +++++++++++++
|
||||
virt-what.in | 3 ++-
|
||||
3 files changed, 16 insertions(+), 1 deletion(-)
|
||||
create mode 100644 tests/docker/proc/self/cgroup
|
||||
|
||||
diff --git a/tests/docker/Makefile.am b/tests/docker/Makefile.am
|
||||
index e2a95d8..401f372 100644
|
||||
--- a/tests/docker/Makefile.am
|
||||
+++ b/tests/docker/Makefile.am
|
||||
@@ -24,6 +24,7 @@ EXTRA_DIST = \
|
||||
.dockerenv \
|
||||
.dockerinit \
|
||||
proc/cpuinfo \
|
||||
+ proc/self/cgroup \
|
||||
proc/self/status \
|
||||
sbin/dmidecode \
|
||||
sbin/uname \
|
||||
diff --git a/tests/docker/proc/self/cgroup b/tests/docker/proc/self/cgroup
|
||||
new file mode 100644
|
||||
index 0000000..5547637
|
||||
--- /dev/null
|
||||
+++ b/tests/docker/proc/self/cgroup
|
||||
@@ -0,0 +1,13 @@
|
||||
+12:devices:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
||||
+11:blkio:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
||||
+10:perf_event:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
||||
+9:pids:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
||||
+8:cpuset:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
||||
+7:rdma:/
|
||||
+6:hugetlb:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
||||
+5:net_cls,net_prio:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
||||
+4:memory:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
||||
+3:freezer:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
||||
+2:cpu,cpuacct:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
||||
+1:name=systemd:/docker/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
|
||||
+0::/system.slice/containerd.service
|
||||
diff --git a/virt-what.in b/virt-what.in
|
||||
index db16b5f..d43916b 100644
|
||||
--- a/virt-what.in
|
||||
+++ b/virt-what.in
|
||||
@@ -345,7 +345,8 @@ if ! "$skip_lkvm"; then
|
||||
fi
|
||||
|
||||
# Check for Docker.
|
||||
-if [ -f "${root}/.dockerenv" ] || [ -f "${root}/.dockerinit" ]; then
|
||||
+if [ -f "${root}/.dockerenv" ] || [ -f "${root}/.dockerinit" ] || \
|
||||
+ grep -qF /docker/ "${root}/proc/self/cgroup" 2>/dev/null; then
|
||||
echo docker
|
||||
fi
|
||||
|
||||
--
|
||||
2.29.0.rc2
|
||||
|
@ -1,232 +0,0 @@
|
||||
From 1df728aa4b1d2814265f9c86494f7d55ee0cf9af Mon Sep 17 00:00:00 2001
|
||||
From: Jordan Webb <jordemort@github.com>
|
||||
Date: Mon, 13 Apr 2020 21:41:30 +0000
|
||||
Subject: [PATCH 7/8] Add podman support
|
||||
|
||||
---
|
||||
configure.ac | 2 ++
|
||||
tests/podman/1/environ | Bin 0 -> 155 bytes
|
||||
tests/podman/Makefile.am | 29 ++++++++++++++++++++
|
||||
tests/podman/proc/cpuinfo | 0
|
||||
tests/podman/proc/self/cgroup | 10 +++++++
|
||||
tests/podman/proc/self/status | 0
|
||||
tests/podman/sbin/dmidecode | 6 +++++
|
||||
tests/podman/sbin/uname | 2 ++
|
||||
tests/podman/sbin/virt-what-cpuid-helper | 2 ++
|
||||
tests/podman/test.sh | 32 +++++++++++++++++++++++
|
||||
virt-what.in | 10 ++++++-
|
||||
virt-what.pod | 6 +++++
|
||||
12 files changed, 98 insertions(+), 1 deletion(-)
|
||||
create mode 100644 tests/podman/1/environ
|
||||
create mode 100644 tests/podman/Makefile.am
|
||||
create mode 100644 tests/podman/proc/cpuinfo
|
||||
create mode 100644 tests/podman/proc/self/cgroup
|
||||
create mode 100644 tests/podman/proc/self/status
|
||||
create mode 100755 tests/podman/sbin/dmidecode
|
||||
create mode 100755 tests/podman/sbin/uname
|
||||
create mode 100755 tests/podman/sbin/virt-what-cpuid-helper
|
||||
create mode 100755 tests/podman/test.sh
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 58b3d77..97d22bb 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -53,6 +53,7 @@ tests="\
|
||||
lxc \
|
||||
nutanix-ahv \
|
||||
parallels-desktop \
|
||||
+ podman \
|
||||
ppc64-baremetal \
|
||||
ppc64-kvm \
|
||||
ppc64-lpar-dedicated \
|
||||
@@ -96,6 +97,7 @@ AC_CONFIG_FILES([Makefile
|
||||
tests/lxc/Makefile
|
||||
tests/nutanix-ahv/Makefile
|
||||
tests/parallels-desktop/Makefile
|
||||
+ tests/podman/Makefile
|
||||
tests/ppc64-baremetal/Makefile
|
||||
tests/ppc64-kvm/Makefile
|
||||
tests/ppc64-lpar-dedicated/Makefile
|
||||
diff --git a/tests/podman/1/environ b/tests/podman/1/environ
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..dd6f0d4d67a151ab7bab97565b0737b8dbf7db44
|
||||
GIT binary patch
|
||||
literal 155
|
||||
zcmYL>K?=hl5JhL*%XorW3^JI2CJ>u-F>Rni)ncUd_?@JS?B@UX=Ygfcpaw_1MfC|)
|
||||
zr4V1LmeOGMJmGP5qhtJ+`+g?F^0V`SgdCeIPY%CrtqJUC&fa%yMZLtVmasj+>YHQl
|
||||
YMd8IEi3Dr7m)t_kYsGhYq>$nA11>u+CjbBd
|
||||
|
||||
literal 0
|
||||
HcmV?d00001
|
||||
|
||||
diff --git a/tests/podman/Makefile.am b/tests/podman/Makefile.am
|
||||
new file mode 100644
|
||||
index 0000000..a4c70ad
|
||||
--- /dev/null
|
||||
+++ b/tests/podman/Makefile.am
|
||||
@@ -0,0 +1,29 @@
|
||||
+# 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/cgroup \
|
||||
+ proc/self/status \
|
||||
+ sbin/dmidecode \
|
||||
+ sbin/uname \
|
||||
+ sbin/virt-what-cpuid-helper
|
||||
diff --git a/tests/podman/proc/cpuinfo b/tests/podman/proc/cpuinfo
|
||||
new file mode 100644
|
||||
index 0000000..e69de29
|
||||
diff --git a/tests/podman/proc/self/cgroup b/tests/podman/proc/self/cgroup
|
||||
new file mode 100644
|
||||
index 0000000..11fc74e
|
||||
--- /dev/null
|
||||
+++ b/tests/podman/proc/self/cgroup
|
||||
@@ -0,0 +1,10 @@
|
||||
+11:perf_event:/machine.slice/libpod-2ed85a65b4d6aedbf4e6bd1bb2d29e6d7778791bd02532788eb16954cebf01da.scope
|
||||
+10:devices:/machine.slice/libpod-2ed85a65b4d6aedbf4e6bd1bb2d29e6d7778791bd02532788eb16954cebf01da.scope
|
||||
+8:pids:/machine.slice/libpod-2ed85a65b4d6aedbf4e6bd1bb2d29e6d7778791bd02532788eb16954cebf01da.scope
|
||||
+7:blkio:/machine.slice/libpod-2ed85a65b4d6aedbf4e6bd1bb2d29e6d7778791bd02532788eb16954cebf01da.scope
|
||||
+6:cpu,cpuacct:/machine.slice/libpod-2ed85a65b4d6aedbf4e6bd1bb2d29e6d7778791bd02532788eb16954cebf01da.scope
|
||||
+5:net_cls,net_prio:/machine.slice/libpod-2ed85a65b4d6aedbf4e6bd1bb2d29e6d7778791bd02532788eb16954cebf01da.scope
|
||||
+4:freezer:/machine.slice/libpod-2ed85a65b4d6aedbf4e6bd1bb2d29e6d7778791bd02532788eb16954cebf01da.scope
|
||||
+3:cpuset:/machine.slice/libpod-2ed85a65b4d6aedbf4e6bd1bb2d29e6d7778791bd02532788eb16954cebf01da.scope
|
||||
+2:memory:/machine.slice/libpod-2ed85a65b4d6aedbf4e6bd1bb2d29e6d7778791bd02532788eb16954cebf01da.scope
|
||||
+1:name=systemd:/machine.slice/libpod-2ed85a65b4d6aedbf4e6bd1bb2d29e6d7778791bd02532788eb16954cebf01da.scope
|
||||
diff --git a/tests/podman/proc/self/status b/tests/podman/proc/self/status
|
||||
new file mode 100644
|
||||
index 0000000..e69de29
|
||||
diff --git a/tests/podman/sbin/dmidecode b/tests/podman/sbin/dmidecode
|
||||
new file mode 100755
|
||||
index 0000000..d9992ad
|
||||
--- /dev/null
|
||||
+++ b/tests/podman/sbin/dmidecode
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/sh -
|
||||
+cat <<'EOF'
|
||||
+# dmidecode 2.11
|
||||
+/dev/mem: Operation not permitted
|
||||
+EOF
|
||||
+exit 1
|
||||
diff --git a/tests/podman/sbin/uname b/tests/podman/sbin/uname
|
||||
new file mode 100755
|
||||
index 0000000..ab0ec89
|
||||
--- /dev/null
|
||||
+++ b/tests/podman/sbin/uname
|
||||
@@ -0,0 +1,2 @@
|
||||
+#!/bin/sh -
|
||||
+echo x86_64
|
||||
diff --git a/tests/podman/sbin/virt-what-cpuid-helper b/tests/podman/sbin/virt-what-cpuid-helper
|
||||
new file mode 100755
|
||||
index 0000000..ad82504
|
||||
--- /dev/null
|
||||
+++ b/tests/podman/sbin/virt-what-cpuid-helper
|
||||
@@ -0,0 +1,2 @@
|
||||
+#!/bin/sh -
|
||||
+echo @
|
||||
diff --git a/tests/podman/test.sh b/tests/podman/test.sh
|
||||
new file mode 100755
|
||||
index 0000000..6db58e5
|
||||
--- /dev/null
|
||||
+++ b/tests/podman/test.sh
|
||||
@@ -0,0 +1,32 @@
|
||||
+# Test for Podman
|
||||
+# 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.
|
||||
+
|
||||
+output="$(PATH=../..:$PATH virt-what --test-root=. 2>&1)"
|
||||
+expected="podman"
|
||||
+
|
||||
+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 d43916b..d52171c 100644
|
||||
--- a/virt-what.in
|
||||
+++ b/virt-what.in
|
||||
@@ -165,7 +165,7 @@ fi
|
||||
# Added by Marc Fournier
|
||||
|
||||
if [ -e "${root}/proc/1/environ" ] &&
|
||||
- cat "${root}/proc/1/environ" | tr '\000' '\n' | grep -Eiq '^container='; then
|
||||
+ cat "${root}/proc/1/environ" | tr '\000' '\n' | grep -Eiq '^container=lxc'; then
|
||||
echo lxc
|
||||
fi
|
||||
|
||||
@@ -350,6 +350,14 @@ if [ -f "${root}/.dockerenv" ] || [ -f "${root}/.dockerinit" ] || \
|
||||
echo docker
|
||||
fi
|
||||
|
||||
+# Check for Podman.
|
||||
+if [ -e "${root}/proc/1/environ" ] &&
|
||||
+ cat "${root}/proc/1/environ" | tr '\000' '\n' | grep -Eiq '^container=podman'; then
|
||||
+ echo podman
|
||||
+elif grep -qF /libpod- "${root}/proc/self/cgroup" 2>/dev/null; then
|
||||
+ echo podman
|
||||
+fi
|
||||
+
|
||||
# Check ppc64 lpar, kvm or powerkvm
|
||||
|
||||
# example /proc/cpuinfo line indicating 'not baremetal'
|
||||
diff --git a/virt-what.pod b/virt-what.pod
|
||||
index ea5cb77..405537b 100644
|
||||
--- a/virt-what.pod
|
||||
+++ b/virt-what.pod
|
||||
@@ -204,6 +204,12 @@ The guest is running inside Parallels Virtual Platform
|
||||
|
||||
Status: contributed by Justin Clift
|
||||
|
||||
+=item B<podman>
|
||||
+
|
||||
+This is a Podman container.
|
||||
+
|
||||
+Status: contributed by Jordan Webb
|
||||
+
|
||||
=item B<powervm_lx86>
|
||||
|
||||
The guest is running inside IBM PowerVM Lx86 Linux/x86 emulator.
|
||||
--
|
||||
2.29.0.rc2
|
||||
|
@ -1,60 +0,0 @@
|
||||
From 60d903fbb7653bc9754228bdab4c6933fcda1e72 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 13 Apr 2021 09:35:07 +0100
|
||||
Subject: [PATCH 8/8] Simplify and fix invocation of cpuid.
|
||||
|
||||
Fixes a crash on some platforms identified by Yongkui Guo in
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1756381#c15
|
||||
---
|
||||
virt-what-cpuid-helper.c | 24 ++++++++++++++++--------
|
||||
1 file changed, 16 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/virt-what-cpuid-helper.c b/virt-what-cpuid-helper.c
|
||||
index 9c6cdb2..fdceb62 100644
|
||||
--- a/virt-what-cpuid-helper.c
|
||||
+++ b/virt-what-cpuid-helper.c
|
||||
@@ -47,17 +47,25 @@ known_signature (const char *sig)
|
||||
0;
|
||||
}
|
||||
|
||||
+/* Copied from the Linux kernel definition in
|
||||
+ * arch/x86/include/asm/processor.h
|
||||
+ */
|
||||
+static inline void
|
||||
+cpuid (uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
|
||||
+{
|
||||
+ asm volatile ("cpuid"
|
||||
+ : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
|
||||
+ : "0" (*eax), "2" (*ecx)
|
||||
+ : "memory");
|
||||
+}
|
||||
+
|
||||
static uint32_t
|
||||
-cpuid (uint32_t eax, char *sig)
|
||||
+cpuid_leaf (uint32_t eax, char *sig)
|
||||
{
|
||||
uint32_t *sig32 = (uint32_t *) sig;
|
||||
|
||||
- asm volatile (
|
||||
- "xchgl %%ebx,%1; xor %%ebx,%%ebx; cpuid; xchgl %%ebx,%1"
|
||||
- : "=a" (eax), "+r" (sig32[0]), "=c" (sig32[1]), "=d" (sig32[2])
|
||||
- : "0" (eax));
|
||||
- sig[12] = 0;
|
||||
-
|
||||
+ cpuid (&eax, &sig32[0], &sig32[1], &sig32[2]);
|
||||
+ sig[12] = 0; /* \0-terminate the string to make string comparison possible */
|
||||
return eax;
|
||||
}
|
||||
|
||||
@@ -87,7 +95,7 @@ cpu_sig (void)
|
||||
*/
|
||||
for (leaf = base + 0xff00; leaf >= base; leaf -= 0x100) {
|
||||
memset (sig, 0, sizeof sig);
|
||||
- cpuid (leaf, sig);
|
||||
+ cpuid_leaf (leaf, sig);
|
||||
if (known_signature (sig)) {
|
||||
puts (sig);
|
||||
break;
|
||||
--
|
||||
2.29.0.rc2
|
||||
|
3
sources
3
sources
@ -1 +1,2 @@
|
||||
SHA512 (virt-what-1.20.tar.gz) = edf74903122bfb422c7a5ecba711bb64d6ef668828f208dfc0571ef14f2643456c14bc9a77dfea209df3d93869ac0a2c9fd039779922eddc6ebd9d988585dea4
|
||||
SHA512 (virt-what-1.21.tar.gz) = 14ace184c4aee5a09b855c1f5acaa619057aed1b9bf03c91ed1003e6a39ea69162c9fe452ea8162c7fe29825e0e2202cfc7d76e82f0cecea3e32405e5eb9f717
|
||||
SHA512 (virt-what-1.21.tar.gz.sig) = f07368ab53ecf221e57f924f78e56d6fb56823522f62aea1ff107c1649f31964ad661e79c450487067de1f40436e5b5b7c3b5a1fd1cc7233c2d201ab5e594bf3
|
||||
|
@ -1,22 +1,11 @@
|
||||
Name: virt-what
|
||||
Version: 1.21
|
||||
Release: 0.1%{?dist}
|
||||
Release: 1%{?dist}
|
||||
Summary: Detect if we are running in a virtual machine
|
||||
License: GPLv2+
|
||||
|
||||
URL: http://people.redhat.com/~rjones/virt-what/
|
||||
#Source0: http://people.redhat.com/~rjones/virt-what/files/%%{name}-%%{version}.tar.gz
|
||||
Source0: http://people.redhat.com/~rjones/virt-what/files/%{name}-1.20.tar.gz
|
||||
|
||||
# These are all the patches added since 1.20.
|
||||
Patch0001: 0001-Fix-virt-what-cpuid-helper.patch
|
||||
Patch0002: 0002-Add-support-for-Nutanix-Acropolis-Hypervisor-AHV-RHB.patch
|
||||
Patch0003: 0003-helper-Fix-KVM-signature.patch
|
||||
Patch0004: 0004-Fix-incorrect-detection-of-MS-Surfacebook-2-as-a-vir.patch
|
||||
Patch0005: 0005-docker-Check-for-.dockerenv-too.patch
|
||||
Patch0006: 0006-docker-Lookup-from-proc-self-cgroup-too.patch
|
||||
Patch0007: 0007-Add-podman-support.patch
|
||||
Patch0008: 0008-Simplify-and-fix-invocation-of-cpuid.patch
|
||||
Source0: http://people.redhat.com/~rjones/virt-what/files/%%{name}-%%{version}.tar.gz
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: git
|
||||
@ -92,8 +81,7 @@ Current types of virtualization detected:
|
||||
|
||||
|
||||
%prep
|
||||
#%%autosetup -S git
|
||||
%autosetup -S git -n %{name}-1.20
|
||||
%autosetup -S git
|
||||
|
||||
# Always rebuild upstream autotools files.
|
||||
autoreconf -i
|
||||
@ -122,6 +110,9 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Apr 19 2021 Richard W.M. Jones <rjones@redhat.com> - 1.21-1
|
||||
- New upstream version 1.21.
|
||||
|
||||
* Tue Apr 13 2021 Richard W.M. Jones <rjones@redhat.com> - 1.21-0.1
|
||||
- Add all patches since 1.20 in preparation for 1.21 release.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user