Blame SOURCES/0008-aws-Detect-AWS-from-dmidecode-information.patch

ba34c6
From 147c648e950ef45b7a5b7b3e8cb30b89c435593b Mon Sep 17 00:00:00 2001
ba34c6
From: "Richard W.M. Jones" <rjones@redhat.com>
ba34c6
Date: Wed, 31 Oct 2018 15:04:24 +0000
fcf72c
Subject: [PATCH 08/22] aws: Detect AWS from dmidecode information.
ba34c6
ba34c6
Move the AWS detection out from under Xen.  AWS runs on KVM and
ba34c6
baremetal these days.  The dmidecode information for KVM and baremetal
ba34c6
is a little bit different so we also need to adjust the test for that
ba34c6
case.
ba34c6
ba34c6
Typical SMBIOS info for Xen:
ba34c6
ba34c6
BIOS Information
ba34c6
        Vendor: Xen
ba34c6
        Version: 4.2.amazon
ba34c6
ba34c6
Typical SMBIOS info for KVM and baremetal:
ba34c6
ba34c6
BIOS Information
ba34c6
        Vendor: Amazon EC2
ba34c6
        Version: 1.0
ba34c6
ba34c6
Thanks: Vitaly Kuznetsov, Jon Masters.
ba34c6
---
ba34c6
 virt-what.in  | 13 +++++++++----
ba34c6
 virt-what.pod |  8 ++++++--
ba34c6
 2 files changed, 15 insertions(+), 6 deletions(-)
ba34c6
ba34c6
diff --git a/virt-what.in b/virt-what.in
ba34c6
index a2f8f19..f685461 100644
ba34c6
--- a/virt-what.in
ba34c6
+++ b/virt-what.in
ba34c6
@@ -233,10 +233,6 @@ fi
ba34c6
 if [ "$cpuid" = "XenVMMXenVMM" ] &&
ba34c6
     ! echo "$dmi" | grep -q 'No SMBIOS nor DMI entry point found, sorry'; then
ba34c6
     echo xen; echo xen-hvm
ba34c6
-    # Check for AWS
ba34c6
-    if echo "$dmi" | grep -q 'Version: [0-9]\.[0-9]\.amazon'; then
ba34c6
-        echo aws
ba34c6
-    fi
ba34c6
     skip_qemu_kvm=true
ba34c6
 elif [ -d "${root}/proc/xen" ]; then
ba34c6
     echo xen
ba34c6
@@ -392,3 +388,12 @@ if [ "${arch#sparc}" != "$arch" ] && [ -e "${root}/dev/mdesc" ]; then
ba34c6
         fi
ba34c6
     fi
ba34c6
 fi
ba34c6
+
ba34c6
+# Check for AWS.
ba34c6
+# AWS on Xen.
ba34c6
+if echo "$dmi" | grep -q 'Version: [0-9]\.[0-9]\.amazon'; then
ba34c6
+    echo aws
ba34c6
+# AWS on baremetal or KVM.
ba34c6
+elif echo "$dmi" | grep -q 'Vendor: Amazon EC2'; then
ba34c6
+    echo aws
ba34c6
+fi
ba34c6
diff --git a/virt-what.pod b/virt-what.pod
ba34c6
index ebfc190..5a0bdfc 100644
ba34c6
--- a/virt-what.pod
ba34c6
+++ b/virt-what.pod
ba34c6
@@ -27,9 +27,13 @@ don't know about or cannot detect.
ba34c6
 
ba34c6
 =item B<aws>
ba34c6
 
ba34c6
-Amazon Web Services cloud guest.
ba34c6
+Amazon Web Services.
ba34c6
 
ba34c6
-Status: contributed by Qi Guo.
ba34c6
+Note that virt-what will print this fact for baremetal AWS instances,
ba34c6
+which you might not consider to be true virtualization.  In this case
ba34c6
+other facts (eg. C<kvm> or C<xen>) would I<not> be present.
ba34c6
+
ba34c6
+Status: contributed by Qi Guo, Vitaly Kuznetsov, confirmed by RWMJ.
ba34c6
 
ba34c6
 =item B<bhyve>
ba34c6
 
ba34c6
-- 
fcf72c
2.32.0
ba34c6