virt-what/SOURCES/0033-Add-detection-of-Red-H...

102 lines
2.8 KiB
Diff

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