detect AWS arm virtual instance as kvm
authorXiao Liang <xiliang@redhat.com>
Tue, 24 May 2022 09:34:52 +0000 (17:34 +0800)
committerRichard W.M. Jones <rjones@redhat.com>
Tue, 9 Aug 2022 07:54:59 +0000 (08:54 +0100)
AWS arm virtual instance is KVM based hypervisor.
With this patch:
$ sudo virt-what
kvm
aws
$ cat /sys/devices/virtual/dmi/id/product_name
t4g.small

Without it:
$ sudo virt-what
aws

Signed-off-by: Xiao Liang <xiliang@redhat.com>
tests/aws-kvm-arm/test.sh
virt-what.in

index 5d31995..133ef13 100755 (executable)
@@ -16,9 +16,8 @@
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 output="$(PATH=../..:$PATH virt-what --test-root=. 2>&1)"
-# XXX At the moment KVM cannot be detected on this platform.
-# We hope to fix that, but for now the only fact printed is "aws".
-expected="aws"
+expected="kvm
+aws"
 
 if [ "$output" != "$expected" ]; then
     echo "$0: test failed because output did not match expected"
index 4f05074..d090898 100644 (file)
@@ -329,6 +329,11 @@ if ! "$skip_qemu_kvm"; then
     elif echo "$dmi" | grep -q 'Manufacturer: KVM'; then
         echo kvm
         skip_lkvm=true
+    elif echo "$dmi" | grep -q 'Manufacturer: Amazon EC2' &&
+        echo "$dmi" | grep -q 'System is a virtual machine'; then
+        # This is for AWS Graviton (Arm) systems which don't have CPUID.
+        echo kvm
+        skip_lkvm=true
     elif echo "$dmi" | grep -q 'Manufacturer: QEMU'; then
         # The test for KVM above failed, so now we know we're
         # not using KVM acceleration.