[PATCH] detect AWS arm virtual instance as kvm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

aws arm virtual instances are running on top of Nitro hypervisor(KVM-based hypervisor).
I am proposing this patch to keep virt-what output consistent with x86 virtual instances.
Please review it. Thanks

With this patch:
$ sudo virt-what
kvm
aws
$ cat /sys/devices/virtual/dmi/id/product_name
t4g.small

Without it:
$ sudo virt-what
aws

Here is the test pass log with this patch.
# cat test-suite.log
======================================================
   virt-what 1.22: tests/aws-kvm-arm/test-suite.log
======================================================

# TOTAL: 1
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

Rgs,
Frank
From 931e5f24b9e7e6e61cebe3213166bd691df80db0 Mon Sep 17 00:00:00 2001
From: Xiao Liang <xiliang@xxxxxxxxxx>
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 <xiliang@xxxxxxxxxx>
---
 tests/aws-kvm-arm/test.sh | 3 ++-
 virt-what.in              | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/aws-kvm-arm/test.sh b/tests/aws-kvm-arm/test.sh
index 5d31995..d469a99 100755
--- a/tests/aws-kvm-arm/test.sh
+++ b/tests/aws-kvm-arm/test.sh
@@ -18,7 +18,8 @@
 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 b59714e..9afbd40 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -339,6 +339,11 @@ if ! "$skip_qemu_kvm"; then
             echo qemu
             skip_lkvm=true
         fi
+        if echo "$dmi" | grep -q 'Amazon EC2' &&
+            echo "$dmi" | grep -q 'System is a virtual machine'; then
+            echo kvm
+            skip_lkvm=true
+        fi
     elif [ -d ${root}/proc/device-tree/hypervisor ] &&
          grep -q "linux,kvm" /proc/device-tree/hypervisor/compatible; then
         # We are running as a spapr KVM guest on ppc64
-- 
2.36.1


[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux