Thanks, Daniel
Removed the outdated comments following your suggestion.
Rgs,
Frank
On Wed, May 25, 2022 at 4:06 PM Daniel P. Berrangé <berrange@xxxxxxxxxx> wrote:
On Wed, May 25, 2022 at 02:34:53PM +0800, Frank Liang wrote:
> 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".
This comment looks outdated given the change you made
> -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
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
From 62d08944cd6b8600ac6af097cd47bd6c40cade21 Mon Sep 17 00:00:00 2001 From: Xiao Liang <xiliang@redhat.com> 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@redhat.com> --- 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 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