From 39001e7c458d798225814c04e920583fa7e2a41c Mon Sep 17 00:00:00 2001 From: Xiao Liang Date: Tue, 24 May 2022 17:34:52 +0800 Subject: [PATCH] detect AWS arm virtual instance as kvm 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 --- tests/aws-kvm-arm/test.sh | 5 ++--- virt-what.in | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/aws-kvm-arm/test.sh b/tests/aws-kvm-arm/test.sh index 5d31995..133ef13 100755 --- a/tests/aws-kvm-arm/test.sh +++ b/tests/aws-kvm-arm/test.sh @@ -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" diff --git a/virt-what.in b/virt-what.in index 4f05074..d090898 100644 --- a/virt-what.in +++ b/virt-what.in @@ -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. -- 1.8.3.1