virt-what/0003-google-cloud-Print-kvm...

64 lines
2.0 KiB
Diff

From 78aab247ccce47d62269ce24264688647c90a264 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 8 Aug 2022 12:13:11 -0400
Subject: [PATCH] google-cloud: Print "kvm" fact on aarch64 instances
GCE instances are KVM with a non-QEMU userspace. On x86-64 we should
recognize this from the CPUID information, but aarch64 has no
equivalent to this. /proc/device-tree/hypervisor/compatible contains
something but RHEL does not use device tree. However the SMBIOS
tables exported by GCE do contain:
Manufacturer: KVM
so we can use that.
# uname -m
aarch64
# virt-what
google_cloud
kvm
This commit also updates the test.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2114997
Updates: commit 54b726fa7c9687b692162488e8934a426f9fa6c3
Thanks: Eric Auger, Yongkui Guo
(cherry picked from commit da3568b25a582603ba15690793c8867cc7c5d2a8)
---
tests/google-cloud/test.sh | 3 ++-
virt-what.in | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/tests/google-cloud/test.sh b/tests/google-cloud/test.sh
index 39287a2e9..8cc69c564 100755
--- a/tests/google-cloud/test.sh
+++ b/tests/google-cloud/test.sh
@@ -16,7 +16,8 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
output="$(PATH=../..:$PATH virt-what --test-root=. 2>&1)"
-expected="google_cloud"
+expected="google_cloud
+kvm"
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 66b2d798d..a9ac0c396 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -319,6 +319,9 @@ if ! "$skip_qemu_kvm"; then
elif echo "$dmi" | grep -q 'Product Name: KVM'; then
echo kvm
skip_lkvm=true
+ elif echo "$dmi" | grep -q 'Manufacturer: KVM'; then
+ 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.
--
2.31.1