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/21] 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
is a little bit different so we also need to adjust the test for that
case.
Typical SMBIOS info for Xen:
BIOS Information
Vendor: Xen
Version: 4.2.amazon
Typical SMBIOS info for KVM and baremetal:
BIOS Information
Vendor: Amazon EC2
Version: 1.0
Thanks: Vitaly Kuznetsov, Jon Masters.
---
virt-what.in | 13 +++++++++----
virt-what.pod | 8 ++++++--
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/virt-what.in b/virt-what.in
index a2f8f19..f685461 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -233,10 +233,6 @@ fi
if [ "$cpuid" = "XenVMMXenVMM" ] &&
! echo "$dmi" | grep -q 'No SMBIOS nor DMI entry point found, sorry'; then
echo xen; echo xen-hvm
- # Check for AWS
- if echo "$dmi" | grep -q 'Version: [0-9]\.[0-9]\.amazon'; then
- echo aws
- fi
skip_qemu_kvm=true
elif [ -d "${root}/proc/xen" ]; then
echo xen
@@ -392,3 +388,12 @@ if [ "${arch#sparc}" != "$arch" ] && [ -e "${root}/dev/mdesc" ]; then
fi
fi
fi
+
+# Check for AWS.
+# AWS on Xen.
+if echo "$dmi" | grep -q 'Version: [0-9]\.[0-9]\.amazon'; then
+ echo aws
+# AWS on baremetal or KVM.
+elif echo "$dmi" | grep -q 'Vendor: Amazon EC2'; then
+ echo aws
+fi
diff --git a/virt-what.pod b/virt-what.pod
index ebfc190..5a0bdfc 100644
--- a/virt-what.pod
+++ b/virt-what.pod
@@ -27,9 +27,13 @@ don't know about or cannot detect.
=item B<aws>
-Amazon Web Services cloud guest.
+Amazon Web Services.
-Status: contributed by Qi Guo.
+Note that virt-what will print this fact for baremetal AWS instances,
+which you might not consider to be true virtualization. In this case
+other facts (eg. C<kvm> or C<xen>) would I<not> be present.
+
+Status: contributed by Qi Guo, Vitaly Kuznetsov, confirmed by RWMJ.
=item B<bhyve>
--
2.23.0