import virt-what-1.18-14.el8

This commit is contained in:
CentOS Sources 2022-04-21 20:09:39 +00:00 committed by Stepan Oksanichenko
parent 417f59b9f5
commit cdde4ae6c8
37 changed files with 1109 additions and 53 deletions

View File

@ -1,7 +1,7 @@
From eefc1e7e3dd8fb422baf0f13aec1df9880541b83 Mon Sep 17 00:00:00 2001
From: Jasper Lievisse Adriaanse <bug@jasper.la>
Date: Thu, 10 Aug 2017 08:44:01 +0100
Subject: [PATCH 01/25] Missing have_cpuinfo check.
Subject: [PATCH 01/36] Missing have_cpuinfo check.
---
virt-what.in | 2 +-
@ -21,5 +21,5 @@ index 8c27b11..9050035 100644
fi
fi
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From 9d90704a05dee7704470eff818a1c44aeef6c880 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Fri, 4 Aug 2017 12:02:08 -0300
Subject: [PATCH 02/25] Remove bashisms
Subject: [PATCH 02/36] Remove bashisms
Use [ instead of [[ so we fall back to test if necessary:
@ -44,5 +44,5 @@ index 9050035..a05e0db 100644
fi
fi
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From a821dc9961d457c086fffcc16a911cb6f9f8659a Mon Sep 17 00:00:00 2001
From: xiliang <xiliang@redhat.com>
Date: Sun, 18 Jun 2017 00:33:28 +0800
Subject: [PATCH 03/25] As xen pv guest can access cpuid from Intel CPUs
Subject: [PATCH 03/36] As xen pv guest can access cpuid from Intel CPUs
started IvyBridge onwards have CPUID Faulting, added one more check in
virt-what.
@ -32,5 +32,5 @@ index a05e0db..247348e 100644
# Check for AWS
if echo "$dmi" | grep -q 'Version: [0-9]\.[0-9]\.amazon'; then
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From 7db94c8fe63f2c7ec3ac27cc5ff54ec1e1686aeb Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 17 Oct 2017 14:47:09 +0100
Subject: [PATCH 04/25] Recognize ppc64le (little endian) virtualization
Subject: [PATCH 04/36] Recognize ppc64le (little endian) virtualization
(RHBZ#1147876).
Tested by Laurent Vivier, see:
@ -24,5 +24,5 @@ index 247348e..29b7b0d 100644
if grep -q 'model.*emulated by qemu' "${root}/proc/cpuinfo"; then
echo ibm_power-kvm
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From 52870e8a264653d7921e8a4edff56d4b050614d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Sat, 27 Jan 2018 13:11:36 +0100
Subject: [PATCH 05/25] Determine architecture via 'uname -m'
Subject: [PATCH 05/36] Determine architecture via 'uname -m'
'uname -p' only gives unknown on x86_64, i386, arm6l (rpi) and aarch64
(scaleways).
@ -26,5 +26,5 @@ index 29b7b0d..2011ff4 100644
# Check for VMware.
# cpuid check added by Chetan Loke.
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From d7fd8a7843030d2b1719353edfcd49dba3000122 Mon Sep 17 00:00:00 2001
From: Jasper Lievisse Adriaanse <jasper@humppa.nl>
Date: Wed, 25 Apr 2018 16:41:32 +0200
Subject: [PATCH 06/25] Allow using sysctl, for example when /proc isn't
Subject: [PATCH 06/36] Allow using sysctl, for example when /proc isn't
available
---
@ -40,5 +40,5 @@ index 2011ff4..d037a99 100644
# This is known to fail for qemu with the explicit -cpu
# option, since /proc/cpuinfo will not contain the QEMU
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From 5efe9f7a58cd0cdc6f4c279c7f0a69e57fbda56f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 28 Aug 2018 18:32:41 +0100
Subject: [PATCH 07/25] Replace == with = since the former is a bash-ism.
Subject: [PATCH 07/36] Replace == with = since the former is a bash-ism.
Thanks: Eric Blake.
@ -24,5 +24,5 @@ index d037a99..a2f8f19 100644
fail () {
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From 147c648e950ef45b7a5b7b3e8cb30b89c435593b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 31 Oct 2018 15:04:24 +0000
Subject: [PATCH 08/25] aws: Detect AWS from dmidecode information.
Subject: [PATCH 08/36] aws: Detect AWS from dmidecode information.
Move the AWS detection out from under Xen. AWS runs on KVM and
baremetal these days. The dmidecode information for KVM and baremetal
@ -75,5 +75,5 @@ index ebfc190..5a0bdfc 100644
=item B<bhyve>
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From 4bceb38a6102ca95bde79205efaa643a0824d3a2 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 31 Oct 2018 15:35:34 +0000
Subject: [PATCH 09/25] tests: Fix tests when run on AWS.
Subject: [PATCH 09/36] tests: Fix tests when run on AWS.
When running on AWS two of the tests failed. This was because the
tests did _not_ include a working dmidecode binary, hence the platform
@ -28,5 +28,5 @@ diff --git a/tests/ppc64-baremetal/sbin/dmidecode b/tests/ppc64-baremetal/sbin/d
old mode 100644
new mode 100755
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From 129a25f9854930928351c8cc3913a5b9a1c558b4 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 31 Oct 2018 15:23:45 +0000
Subject: [PATCH 10/25] aws: Add regression test for AWS on KVM on x86_64
Subject: [PATCH 10/36] aws: Add regression test for AWS on KVM on x86_64
architecture.
---
@ -286,5 +286,5 @@ index 0000000..db4c19f
+ exit 1
+fi
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From 298a15ead59c2dbeb9b2fabe7fb502100fdd4dc7 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 31 Oct 2018 15:43:20 +0000
Subject: [PATCH 11/25] aws: Add regression test for AWS on baremetal on x86_64
Subject: [PATCH 11/36] aws: Add regression test for AWS on baremetal on x86_64
architecture.
---
@ -3231,5 +3231,5 @@ index 0000000..d456163
+ exit 1
+fi
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From 350291e1ca417eab9d2aa2408589f0259cac007c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 31 Oct 2018 15:23:45 +0000
Subject: [PATCH 12/25] aws: Add regression test for AWS on Xen on x86_64
Subject: [PATCH 12/36] aws: Add regression test for AWS on Xen on x86_64
architecture.
---
@ -354,5 +354,5 @@ index 0000000..22b7f83
+ exit 1
+fi
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From f25e07d43db40355b321493f78758ea058fa3849 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 31 Oct 2018 15:23:45 +0000
Subject: [PATCH 13/25] aws: Add regression test for AWS on KVM on ARM
Subject: [PATCH 13/36] aws: Add regression test for AWS on KVM on ARM
architecture.
---
@ -240,5 +240,5 @@ index 0000000..8875421
+ exit 1
+fi
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From 56427ce169d5a6dc46ed6c6555ee3f7c4e0843d6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 3 Oct 2019 09:08:19 +0100
Subject: [PATCH 14/25] build: Remove *~ files on make clean.
Subject: [PATCH 14/36] build: Remove *~ files on make clean.
---
Makefile.am | 2 +-
@ -21,5 +21,5 @@ index 67502fc..48fd518 100644
AM_CPPFLAGS = -Wall
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From e3eeddbc857a5647135c42c97be75198929a8ce1 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 3 Oct 2019 09:53:49 +0100
Subject: [PATCH 15/25] Arrange tests in subdirectories.
Subject: [PATCH 15/36] Arrange tests in subdirectories.
This simplifies and isolates each test.
---
@ -2382,5 +2382,5 @@ index 0620db0..a22f311 100755
ibm_systemz-zvm"
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From 5c2c251d9aae98e6a629b966bdd8cae2aa1dedaf Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 3 Oct 2019 10:16:08 +0100
Subject: [PATCH 16/25] build: Add .gitignore to tarball.
Subject: [PATCH 16/36] build: Add .gitignore to tarball.
Mainly to keep maintainer-check-extra-dist happy.
---
@ -22,5 +22,5 @@ index b62738f..1cb73b7 100644
SUBDIRS = . tests
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From b6161b67b0bd542169e13cdfa0488a0266e3ae7a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 3 Oct 2019 10:13:43 +0100
Subject: [PATCH 17/25] maintainer: Add rules for maintainers.
Subject: [PATCH 17/36] maintainer: Add rules for maintainers.
Adds:
make maintainer-check-extra-dist
@ -47,5 +47,5 @@ index 1cb73b7..5435132 100644
+maintainer-tag:
+ git tag -a v$(VERSION) -m "Version $(VERSION)." -f
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From a5471559e7398418f1bb9c538a7bfc8f39e9ae98 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 18/25] Fix virt-what-cpuid-helper.
Subject: [PATCH 18/36] 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.
@ -114,5 +114,5 @@ index 7812545..0cd4a6f 100644
}
}
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From 01ea13d9813df93e294b0d9776d4cefd54b1609b 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 19/25] Add support for Nutanix Acropolis Hypervisor (AHV)
Subject: [PATCH 19/36] Add support for Nutanix Acropolis Hypervisor (AHV)
(RHBZ#1756381).
Thanks: Cristian Seres for providing access to a guest.
@ -401,5 +401,5 @@ index 5a0bdfc..ea5cb77 100644
The guest appears to be running inside an OpenVZ or Virtuozzo
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From e0443f1fc78f2a79c073dbdf4133bec41c4c0591 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 20/25] helper: Fix KVM signature.
Subject: [PATCH 20/36] helper: Fix KVM signature.
Thanks: Paolo Bonzini.
---
@ -34,5 +34,5 @@ index 0cd4a6f..9c6cdb2 100644
strcmp (sig, "Microsoft Hv") == 0 ||
strcmp (sig, "OpenBSDVMM58") == 0 ||
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From 71ef45e9543278e9920e449b71e0da269662ebc9 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 21/25] Fix incorrect detection of MS Surfacebook 2 as a
Subject: [PATCH 21/36] Fix incorrect detection of MS Surfacebook 2 as a
virtual machine.
---
@ -23,5 +23,5 @@ index 9eafa05..a61ce91 100644
fi
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From 8640dad5eb60eced313359e7ecea19b07d77242f Mon Sep 17 00:00:00 2001
From: Razvan Corneliu <razvan.vilt@linux360.ro>
Date: Mon, 10 May 2021 21:02:27 +0100
Subject: [PATCH 22/25] Add support for VMware ESXi on ARM
Subject: [PATCH 22/36] Add support for VMware ESXi on ARM
Virt-what doesn't recognize VMware VMs for AARCH64/ARM (with licensing
implications in ESXi Fling for ARM and Fusion v.Next for ARM). I've
@ -263,5 +263,5 @@ index a61ce91..59743c3 100644
elif [ "$arch" = "ia64" ]; then
if [ -d "${root}/sys/bus/xen" -a ! -d "${root}/sys/bus/xen-backend" ]; then
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From a24df0c780aaf74f0ed408bc55386b9f933fb7aa 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 23/25] docker: Check for /.dockerenv too
Subject: [PATCH 23/36] docker: Check for /.dockerenv too
/.dockerinit may no longer exist.
@ -44,5 +44,5 @@ index 59743c3..900a05d 100644
fi
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From 6831ccb71a7b19c6e5cb970026cbffff39928e2b 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 24/25] docker: Lookup from /proc/self/cgroup too
Subject: [PATCH 24/36] docker: Lookup from /proc/self/cgroup too
Refs https://github.com/moby/moby/issues/18355
@ -59,5 +59,5 @@ index 900a05d..6330fd0 100644
fi
--
2.18.4
2.31.1

View File

@ -1,7 +1,7 @@
From 88eb2b7fbd7e6af1cd1860c3f2023ee7b9125d37 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 25/25] Simplify and fix invocation of cpuid.
Subject: [PATCH 25/36] 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
@ -58,5 +58,5 @@ index 9c6cdb2..fdceb62 100644
puts (sig);
break;
--
2.18.4
2.31.1

View File

@ -0,0 +1,233 @@
From 3277b38cc88e577c7da7838a6366efbf3d22c538 Mon Sep 17 00:00:00 2001
From: Jordan Webb <jordemort@github.com>
Date: Mon, 13 Apr 2020 21:41:30 +0000
Subject: [PATCH 26/36] Add podman support
(cherry picked from commit 1df728aa4b1d2814265f9c86494f7d55ee0cf9af)
---
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 f9b3096..5fd716b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,6 +54,7 @@ tests="\
lxc \
nutanix-ahv \
parallels-desktop \
+ podman \
ppc64-baremetal \
ppc64-kvm \
ppc64-lpar-dedicated \
@@ -98,6 +99,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 6330fd0..b7d266b 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
@@ -354,6 +354,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.31.1

View File

@ -0,0 +1,29 @@
From e0ba7102f7a2e926773e16dc0ea8bf959862c4b7 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 26 May 2021 11:31:24 +0100
Subject: [PATCH 27/36] aws: Match multi-digit version number in BIOS
information
See: https://listman.redhat.com/archives/virt-tools-list/2021-May/msg00011.html
Reported-by: Stuart Cooper
(cherry picked from commit b1eae421ff3fdbac0f9ec5b300259c16ff7b1d93)
---
virt-what.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virt-what.in b/virt-what.in
index b7d266b..8021290 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -413,7 +413,7 @@ fi
# Check for AWS.
# AWS on Xen.
-if echo "$dmi" | grep -q 'Version: [0-9]\.[0-9]\.amazon'; then
+if echo "$dmi" | grep -Eq 'Version: [0-9]+\.[0-9]+\.amazon'; then
echo aws
# AWS on baremetal or KVM.
elif echo "$dmi" | grep -q 'Vendor: Amazon EC2'; then
--
2.31.1

View File

@ -0,0 +1,47 @@
From 4da6d385eb5a2b262d3304304c3eba803dd8cc1a Mon Sep 17 00:00:00 2001
From: Weisson <hanxiaobupt@bupt.edu.cn>
Date: Thu, 27 May 2021 10:53:08 +0100
Subject: [PATCH 28/36] Add support for Alibaba Cloud Linux
(cherry picked from commit ed11e2d298ec7466fac656a38a2cefd386130420)
---
virt-what.in | 5 +++++
virt-what.pod | 6 ++++++
2 files changed, 11 insertions(+)
diff --git a/virt-what.in b/virt-what.in
index 8021290..3dac91a 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -113,6 +113,11 @@ dmi=$(LANG=C dmidecode 2>&1)
arch=$(uname -m | sed -e 's/i.86/i386/' | sed -e 's/arm.*/arm/')
+# Check for Alibaba Cloud
+if echo "$dmi" | grep -q 'Manufacturer: Alibaba Cloud'; then
+ echo "alibaba_cloud"
+fi
+
# Check for VMware.
# cpuid check added by Chetan Loke.
diff --git a/virt-what.pod b/virt-what.pod
index 405537b..9f8bea2 100644
--- a/virt-what.pod
+++ b/virt-what.pod
@@ -25,6 +25,12 @@ don't know about or cannot detect.
=over 4
+=item B<alibaba_cloud>
+
+This is a cloud computing service based on Alibaba Cloud.
+
+Status: contributed by Weisson.
+
=item B<aws>
Amazon Web Services.
--
2.31.1

View File

@ -0,0 +1,392 @@
From 6655488e00f9c5da802c739c46e3a0ee070b503c Mon Sep 17 00:00:00 2001
From: Weisson <hanxiaobupt@bupt.edu.cn>
Date: Thu, 27 May 2021 10:55:57 +0100
Subject: [PATCH 29/36] Add test for Alibaba Cloud Linux
(cherry picked from commit 7e679278431aa1a188dfe423526dfea82fddcbd3)
---
configure.ac | 2 +
tests/alibaba-cloud-x86/Makefile.am | 27 ++++
tests/alibaba-cloud-x86/proc/cpuinfo | 53 +++++++
tests/alibaba-cloud-x86/proc/self/status | 54 ++++++++
tests/alibaba-cloud-x86/sbin/dmidecode | 131 ++++++++++++++++++
tests/alibaba-cloud-x86/sbin/uname | 2 +
.../sbin/virt-what-cpuid-helper | 2 +
tests/alibaba-cloud-x86/test.sh | 33 +++++
8 files changed, 304 insertions(+)
create mode 100644 tests/alibaba-cloud-x86/Makefile.am
create mode 100644 tests/alibaba-cloud-x86/proc/cpuinfo
create mode 100644 tests/alibaba-cloud-x86/proc/self/status
create mode 100755 tests/alibaba-cloud-x86/sbin/dmidecode
create mode 100755 tests/alibaba-cloud-x86/sbin/uname
create mode 100755 tests/alibaba-cloud-x86/sbin/virt-what-cpuid-helper
create mode 100755 tests/alibaba-cloud-x86/test.sh
diff --git a/configure.ac b/configure.ac
index 5fd716b..40a57b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,6 +34,7 @@ AM_CONDITIONAL([HOST_CPU_IA64], [ test "x$host_cpu" = "xia64" ])
dnl List of tests.
tests="\
+ alibaba-cloud-x86 \
aws-baremetal-x86 \
aws-kvm-arm \
aws-kvm-x86 \
@@ -79,6 +80,7 @@ AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([virt-what],[chmod +x virt-what])
AC_CONFIG_FILES([Makefile
tests/Makefile
+ tests/alibaba-cloud-x86/Makefile
tests/aws-baremetal-x86/Makefile
tests/aws-kvm-arm/Makefile
tests/aws-kvm-x86/Makefile
diff --git a/tests/alibaba-cloud-x86/Makefile.am b/tests/alibaba-cloud-x86/Makefile.am
new file mode 100644
index 0000000..c9ea7a1
--- /dev/null
+++ b/tests/alibaba-cloud-x86/Makefile.am
@@ -0,0 +1,27 @@
+# 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/virt-what-cpuid-helper
diff --git a/tests/alibaba-cloud-x86/proc/cpuinfo b/tests/alibaba-cloud-x86/proc/cpuinfo
new file mode 100644
index 0000000..99fa1af
--- /dev/null
+++ b/tests/alibaba-cloud-x86/proc/cpuinfo
@@ -0,0 +1,53 @@
+processor : 0
+vendor_id : GenuineIntel
+cpu family : 6
+model : 85
+model name : Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz
+stepping : 7
+microcode : 0x1
+cpu MHz : 2500.002
+cache size : 36608 KB
+physical id : 0
+siblings : 2
+core id : 0
+cpu cores : 1
+apicid : 0
+initial apicid : 0
+fpu : yes
+fpu_exception : yes
+cpuid level : 22
+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 ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves arat avx512_vnni
+bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit
+bogomips : 5000.00
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+processor : 1
+vendor_id : GenuineIntel
+cpu family : 6
+model : 85
+model name : Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz
+stepping : 7
+microcode : 0x1
+cpu MHz : 2500.002
+cache size : 36608 KB
+physical id : 0
+siblings : 2
+core id : 0
+cpu cores : 1
+apicid : 1
+initial apicid : 1
+fpu : yes
+fpu_exception : yes
+cpuid level : 22
+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 ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves arat avx512_vnni
+bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit
+bogomips : 5000.00
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
\ No newline at end of file
diff --git a/tests/alibaba-cloud-x86/proc/self/status b/tests/alibaba-cloud-x86/proc/self/status
new file mode 100644
index 0000000..1ea7195
--- /dev/null
+++ b/tests/alibaba-cloud-x86/proc/self/status
@@ -0,0 +1,54 @@
+Name: cat
+Umask: 0022
+State: R (running)
+Tgid: 25933
+Ngid: 0
+Pid: 25933
+PPid: 25932
+TracerPid: 0
+Uid: 0 0 0 0
+Gid: 0 0 0 0
+FDSize: 64
+Groups: 0
+NStgid: 25933
+NSpid: 25933
+NSpgid: 25932
+NSsid: 25039
+VmPeak: 108084 kB
+VmSize: 108084 kB
+VmLck: 0 kB
+VmPin: 0 kB
+VmHWM: 748 kB
+VmRSS: 748 kB
+RssAnon: 76 kB
+RssFile: 672 kB
+RssShmem: 0 kB
+VmData: 188 kB
+VmStk: 132 kB
+VmExe: 44 kB
+VmLib: 1952 kB
+VmPTE: 68 kB
+VmSwap: 0 kB
+HugetlbPages: 0 kB
+CoreDumping: 0
+Threads: 1
+SigQ: 0/30350
+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: vulnerable
+Cpus_allowed: 3
+Cpus_allowed_list: 0-1
+Mems_allowed: 00000000,00000001
+Mems_allowed_list: 0
+voluntary_ctxt_switches: 0
+nonvoluntary_ctxt_switches: 2
diff --git a/tests/alibaba-cloud-x86/sbin/dmidecode b/tests/alibaba-cloud-x86/sbin/dmidecode
new file mode 100755
index 0000000..2ed2ef3
--- /dev/null
+++ b/tests/alibaba-cloud-x86/sbin/dmidecode
@@ -0,0 +1,131 @@
+#!/bin/sh -
+cat <<'EOF'
+# dmidecode 3.2
+Getting SMBIOS data from sysfs.
+SMBIOS 2.8 present.
+10 structures occupying 462 bytes.
+Table at 0x000F5840.
+
+Handle 0x0000, DMI type 0, 24 bytes
+BIOS Information
+ Vendor: SeaBIOS
+ Version: 8c24b4c
+ 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: Alibaba Cloud
+ Product Name: Alibaba Cloud ECS
+ Version: pc-i440fx-2.1
+ Serial Number: 20fb1c97-feb0-4c45-b8b9-bb06feeba0b5
+ UUID: 20fb1c97-feb0-4c45-b8b9-bb06feeba0b5
+ Wake-up Type: Power Switch
+ SKU Number: Not Specified
+ Family: Not Specified
+
+Handle 0x0300, DMI type 3, 21 bytes
+Chassis Information
+ Manufacturer: Alibaba Cloud
+ Type: Other
+ Lock: Not Present
+ Version: pc-i440fx-2.1
+ 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: Alibaba Cloud
+ ID: 57 06 05 00 FF FB 8B 0F
+ Version: pc-i440fx-2.1
+ Voltage: Unknown
+ External Clock: Unknown
+ Max Speed: Unknown
+ Current Speed: Unknown
+ 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: 2
+ 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: 8 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: 8192 MB
+ Form Factor: DIMM
+ Set: None
+ Locator: DIMM 0
+ Bank Locator: Not Specified
+ Type: RAM
+ Type Detail: Other
+ Speed: Unknown
+ Manufacturer: Alibaba Cloud
+ 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: 0x000BFFFFFFF
+ Range Size: 3 GB
+ Physical Array Handle: 0x1000
+ Partition Width: 1
+
+Handle 0x1301, DMI type 19, 31 bytes
+Memory Array Mapped Address
+ Starting Address: 0x00100000000
+ Ending Address: 0x0023FFFFFFF
+ Range Size: 5 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/alibaba-cloud-x86/sbin/uname b/tests/alibaba-cloud-x86/sbin/uname
new file mode 100755
index 0000000..ab0ec89
--- /dev/null
+++ b/tests/alibaba-cloud-x86/sbin/uname
@@ -0,0 +1,2 @@
+#!/bin/sh -
+echo x86_64
diff --git a/tests/alibaba-cloud-x86/sbin/virt-what-cpuid-helper b/tests/alibaba-cloud-x86/sbin/virt-what-cpuid-helper
new file mode 100755
index 0000000..f52a9d7
--- /dev/null
+++ b/tests/alibaba-cloud-x86/sbin/virt-what-cpuid-helper
@@ -0,0 +1,2 @@
+#!/bin/sh -
+echo KVMKVMKVM
diff --git a/tests/alibaba-cloud-x86/test.sh b/tests/alibaba-cloud-x86/test.sh
new file mode 100755
index 0000000..afa2f44
--- /dev/null
+++ b/tests/alibaba-cloud-x86/test.sh
@@ -0,0 +1,33 @@
+# Test for Alibaba Cloud
+# Copyright (C) 2018 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="alibaba_cloud
+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
--
2.31.1

View File

@ -0,0 +1,49 @@
From 579addba79dccf0cfc84ee80ffb1f8c678be46ee Mon Sep 17 00:00:00 2001
From: Weisson <hanxiaobupt@bupt.edu.cn>
Date: Tue, 1 Jun 2021 20:49:17 +0800
Subject: [PATCH 30/36] Check for Alibaba Cloud X-Dragon Architecture
Thanks to Richard W.M. Jones' Super Powerful Bash Script
(cherry picked from commit b7cc3d93a613ef6d0ac5ccd6e32cc3d66e057243)
---
virt-what.in | 9 +++++++--
virt-what.pod | 2 ++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/virt-what.in b/virt-what.in
index 3dac91a..520f7b0 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -114,8 +114,13 @@ dmi=$(LANG=C dmidecode 2>&1)
arch=$(uname -m | sed -e 's/i.86/i386/' | sed -e 's/arm.*/arm/')
# Check for Alibaba Cloud
-if echo "$dmi" | grep -q 'Manufacturer: Alibaba Cloud'; then
- echo "alibaba_cloud"
+if echo "$dmi" | grep -q 'Manufacturer: Alibaba'; then
+ # Check for Alibaba Cloud X-Dragon Architecture
+ if ( { echo -e "GET /latest/meta-datainstance/instance-type HTTP/1.0\r\nHost: 100.100.100.200\r\n\r" >&3; grep -sq 'ebm' <&3 ; } 3<> /dev/tcp/100.100.100.200/80 ) 2>/dev/null ; then
+ echo "alibaba_cloud-x_dragon"
+ else
+ echo "alibaba_cloud"
+ fi
fi
# Check for VMware.
diff --git a/virt-what.pod b/virt-what.pod
index 9f8bea2..6e29570 100644
--- a/virt-what.pod
+++ b/virt-what.pod
@@ -27,6 +27,8 @@ don't know about or cannot detect.
=item B<alibaba_cloud>
+=item B<alibaba_cloud-x_dragon>
+
This is a cloud computing service based on Alibaba Cloud.
Status: contributed by Weisson.
--
2.31.1

View File

@ -0,0 +1,44 @@
From 68ac4a8bb0cb63b5df4a25451e66f7d6d96b2a9d Mon Sep 17 00:00:00 2001
From: Weisson <hanxiaobupt@bupt.edu.cn>
Date: Fri, 2 Jul 2021 17:06:07 +0800
Subject: [PATCH 31/36] use official product name for alibaba cloud bare-metal
instances
(cherry picked from commit c1980aebe6597950c34fc9e94d54e8fd0177cc27)
---
virt-what.in | 4 ++--
virt-what.pod | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/virt-what.in b/virt-what.in
index 520f7b0..3573221 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -115,9 +115,9 @@ arch=$(uname -m | sed -e 's/i.86/i386/' | sed -e 's/arm.*/arm/')
# Check for Alibaba Cloud
if echo "$dmi" | grep -q 'Manufacturer: Alibaba'; then
- # Check for Alibaba Cloud X-Dragon Architecture
+ # Check for Alibaba Cloud ECS Bare Metal (EBM) Instance
if ( { echo -e "GET /latest/meta-datainstance/instance-type HTTP/1.0\r\nHost: 100.100.100.200\r\n\r" >&3; grep -sq 'ebm' <&3 ; } 3<> /dev/tcp/100.100.100.200/80 ) 2>/dev/null ; then
- echo "alibaba_cloud-x_dragon"
+ echo "alibaba_cloud-ebm"
else
echo "alibaba_cloud"
fi
diff --git a/virt-what.pod b/virt-what.pod
index 6e29570..381385b 100644
--- a/virt-what.pod
+++ b/virt-what.pod
@@ -27,7 +27,7 @@ don't know about or cannot detect.
=item B<alibaba_cloud>
-=item B<alibaba_cloud-x_dragon>
+=item B<alibaba_cloud-ebm>
This is a cloud computing service based on Alibaba Cloud.
--
2.31.1

View File

@ -0,0 +1,48 @@
From 3bd5bffe607be834708b4c265fd3982e6acd168b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 19 Jul 2021 15:14:32 +0100
Subject: [PATCH 32/36] Add Google Cloud (not tested)
Thanks: Paolo Bonzini
(cherry picked from commit 8363fa9f0e2cbd970f34ffb7c7b23ed0ac2c374a)
---
virt-what.in | 5 +++++
virt-what.pod | 6 ++++++
2 files changed, 11 insertions(+)
diff --git a/virt-what.in b/virt-what.in
index 3573221..aacbb13 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -247,6 +247,11 @@ if echo "$dmi" | grep -q 'Product Name: RHEV Hypervisor'; then
echo rhev
fi
+# Google Cloud
+if echo "$dmi" | grep -q 'Product Name: Google Compute Engine'; then
+ echo google_cloud
+fi
+
# Check for Xen.
if [ "$cpuid" = "XenVMMXenVMM" ] &&
diff --git a/virt-what.pod b/virt-what.pod
index 381385b..5ca63fe 100644
--- a/virt-what.pod
+++ b/virt-what.pod
@@ -55,6 +55,12 @@ This is a Docker container.
Status: confirmed by Charles Nguyen
+=item B<google_cloud>
+
+This is running on Google Cloud Platform / Google Compute Engine.
+
+Status: not confirmed
+
=item B<hyperv>
This is Microsoft Hyper-V hypervisor.
--
2.31.1

View File

@ -0,0 +1,101 @@
From 71d90582eaa852f7a663e8a77cfe90574760357e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 19 Jul 2021 18:05:14 +0100
Subject: [PATCH 33/36] Add detection of Red Hat's hypervisor
Red Hat sets the following fields in SMBIOS information, allowing us
to detect that it's the branded Red Hat hypervisor.
Manufacturer: Red Hat
Product Name: KVM
Version: RHEL 7.6.0 PC (i440FX + PIIX, 1996)
Note that "RHEL 7.6.0" there is the machine type, which is not the
same as the hypervisor version (although the two have a relationship).
Thanks: Timothy Smith at IBM, Karen Noel
(cherry picked from commit b64df398779db07d008781c96685878795bcfd67)
---
tests/nutanix-ahv/test.sh | 3 ++-
tests/rhel5-xen-domU-hvm/test.sh | 3 ++-
tests/rhev/test.sh | 1 +
virt-what.in | 5 +++++
virt-what.pod | 6 ++++++
5 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/tests/nutanix-ahv/test.sh b/tests/nutanix-ahv/test.sh
index 3d934b2..a998dc0 100755
--- a/tests/nutanix-ahv/test.sh
+++ b/tests/nutanix-ahv/test.sh
@@ -16,7 +16,8 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
output="$(PATH=../..:$PATH virt-what --test-root=. 2>&1)"
-expected="nutanix_ahv"
+expected="nutanix_ahv
+redhat"
if [ "$output" != "$expected" ]; then
echo "$0: test failed because output did not match expected"
diff --git a/tests/rhel5-xen-domU-hvm/test.sh b/tests/rhel5-xen-domU-hvm/test.sh
index 627de55..b88ef5c 100755
--- a/tests/rhel5-xen-domU-hvm/test.sh
+++ b/tests/rhel5-xen-domU-hvm/test.sh
@@ -16,7 +16,8 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
output="$(PATH=../..:$PATH virt-what --test-root=. 2>&1)"
-expected="xen
+expected="redhat
+xen
xen-hvm"
if [ "$output" != "$expected" ]; then
diff --git a/tests/rhev/test.sh b/tests/rhev/test.sh
index 7d9c22f..9ba9315 100755
--- a/tests/rhev/test.sh
+++ b/tests/rhev/test.sh
@@ -17,6 +17,7 @@
output="$(PATH=../..:$PATH virt-what --test-root=. 2>&1)"
expected="rhev
+redhat
kvm"
if [ "$output" != "$expected" ]; then
diff --git a/virt-what.in b/virt-what.in
index aacbb13..850760e 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -252,6 +252,11 @@ if echo "$dmi" | grep -q 'Product Name: Google Compute Engine'; then
echo google_cloud
fi
+# Red Hat's hypervisor.
+if echo "$dmi" | grep -q 'Manufacturer: Red Hat'; then
+ echo redhat
+fi
+
# Check for Xen.
if [ "$cpuid" = "XenVMMXenVMM" ] &&
diff --git a/virt-what.pod b/virt-what.pod
index 5ca63fe..2bce5c8 100644
--- a/virt-what.pod
+++ b/virt-what.pod
@@ -246,6 +246,12 @@ The guest is running on a Red Hat Enterprise Virtualization (RHEV) node.
Status: confirmed by RWMJ
+=item B<redhat>
+
+The guest is running on the Red Hat hypervisor.
+
+Status: confirmed by RWMJ
+
=item B<uml>
This is a User-Mode Linux (UML) guest.
--
2.31.1

View File

@ -0,0 +1,47 @@
From 3d0a9d20c97f9f6d9be5229a94409b57ef429e35 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 22 Jul 2021 08:58:16 +0100
Subject: [PATCH 34/36] Display kvm/qemu fact for Nutanix AHV
Since these are based on KVM we should display those facts too.
Thanks: Paolo Bonzini
(cherry picked from commit c7f55d08c9ab2aaf56ebd0d179491f4e15b5097c)
---
tests/nutanix-ahv/test.sh | 3 ++-
virt-what.in | 3 ---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/tests/nutanix-ahv/test.sh b/tests/nutanix-ahv/test.sh
index a998dc0..d5d6af2 100755
--- a/tests/nutanix-ahv/test.sh
+++ b/tests/nutanix-ahv/test.sh
@@ -17,7 +17,8 @@
output="$(PATH=../..:$PATH virt-what --test-root=. 2>&1)"
expected="nutanix_ahv
-redhat"
+redhat
+kvm"
if [ "$output" != "$expected" ]; then
echo "$0: test failed because output did not match expected"
diff --git a/virt-what.in b/virt-what.in
index 850760e..d56c84f 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -232,11 +232,8 @@ if echo "$dmi" | grep -q 'Vendor: Parallels'; then
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.
--
2.31.1

View File

@ -0,0 +1,24 @@
From 9257d0980ae08d7acd8ebdaeae0270f480b7b1af Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 14 Apr 2022 13:50:46 +0100
Subject: [PATCH 35/36] Add test file to EXTRA_DIST
Fixes: commit 7e679278431aa1a188dfe423526dfea82fddcbd3
(cherry picked from commit 5c6076110ec42c0f54a0a926f3bc9351520a6780)
---
tests/alibaba-cloud-x86/Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/alibaba-cloud-x86/Makefile.am b/tests/alibaba-cloud-x86/Makefile.am
index c9ea7a1..b748df8 100644
--- a/tests/alibaba-cloud-x86/Makefile.am
+++ b/tests/alibaba-cloud-x86/Makefile.am
@@ -24,4 +24,5 @@ EXTRA_DIST = \
proc/cpuinfo \
proc/self/status \
sbin/dmidecode \
+ sbin/uname \
sbin/virt-what-cpuid-helper
--
2.31.1

View File

@ -0,0 +1,26 @@
From 4ffabec1019dff4c8034d2200e2d74b58db5cbd6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 14 Apr 2022 13:51:13 +0100
Subject: [PATCH 36/36] Add test file to EXTRA_DIST
Fixes: commit 1df728aa4b1d2814265f9c86494f7d55ee0cf9af
(cherry picked from commit a6757ae742616d493764780faae00f786b854ffb)
---
tests/podman/Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/podman/Makefile.am b/tests/podman/Makefile.am
index a4c70ad..2962f32 100644
--- a/tests/podman/Makefile.am
+++ b/tests/podman/Makefile.am
@@ -20,6 +20,7 @@ CLEANFILES = *~
TESTS = test.sh
EXTRA_DIST = \
+ 1/environ \
test.sh \
proc/cpuinfo \
proc/self/cgroup \
--
2.31.1

View File

@ -1,6 +1,6 @@
Name: virt-what
Version: 1.18
Release: 13%{?dist}
Release: 14%{?dist}
Summary: Detect if we are running in a virtual machine
License: GPLv2+
@ -14,7 +14,7 @@ Source1: gitignore
# Patches from upstream since 1.18 was released.
# NB: These patches are also stored in this upstream branch:
# http://git.annexia.org/?p=virt-what.git;a=shortlog;h=refs/heads/rhel-8.6
# http://git.annexia.org/?p=virt-what.git;a=shortlog;h=refs/heads/rhel-8.7
Patch0001: 0001-Missing-have_cpuinfo-check.patch
Patch0002: 0002-Remove-bashisms.patch
Patch0003: 0003-As-xen-pv-guest-can-access-cpuid-from-Intel-CPUs-sta.patch
@ -45,10 +45,21 @@ Patch0022: 0022-Add-support-for-VMware-ESXi-on-ARM.patch
# Support for Docker (RHBZ#2000834).
Patch0023: 0023-docker-Check-for-.dockerenv-too.patch
Patch0024: 0024-docker-Lookup-from-proc-self-cgroup-too.patch
# Fix crash on non-KVM platforms through incorrect use of CPUID in
# patch 0018 (https://bugzilla.redhat.com/show_bug.cgi?id=1756381#c15).
Patch0025: 0025-Simplify-and-fix-invocation-of-cpuid.patch
# Further patches up to 1.22.
Patch0026: 0026-Add-podman-support.patch
Patch0027: 0027-aws-Match-multi-digit-version-number-in-BIOS-informa.patch
Patch0028: 0028-Add-support-for-Alibaba-Cloud-Linux.patch
Patch0029: 0029-Add-test-for-Alibaba-Cloud-Linux.patch
Patch0030: 0030-Check-for-Alibaba-Cloud-X-Dragon-Architecture.patch
Patch0031: 0031-use-official-product-name-for-alibaba-cloud-bare-met.patch
Patch0032: 0032-Add-Google-Cloud-not-tested.patch
Patch0033: 0033-Add-detection-of-Red-Hat-s-hypervisor.patch
Patch0034: 0034-Display-kvm-qemu-fact-for-Nutanix-AHV.patch
Patch0035: 0035-Add-test-file-to-EXTRA_DIST.patch
Patch0036: 0036-Add-test-file-to-EXTRA_DIST.patch
# Patches touch Makefile.am:
BuildRequires: autoconf, automake
@ -161,6 +172,11 @@ fi
%changelog
* Tue Apr 19 2022 Richard W.M. Jones <rjones@redhat.com> - 1.18-14
- Add guest detection for RHEL hypervisors
resolves: rhbz#2076628
- Update patches to 1.22
* Mon Sep 06 2021 Richard W.M. Jones <rjones@redhat.com> - 1.18-13
- Support for Docker
resolves: rhbz#2000834