[PATCH V2] detect AWS arm virtual instance as kvm

Richard W.M. Jones rjones at redhat.com
Tue Aug 9 07:56:08 UTC 2022


On Tue, Aug 09, 2022 at 11:00:58AM +0800, Frank Liang wrote:
> Hi Richard,
>
> Do you have time to review this patch for the AWS arm instance to
> fix a similar issue on GCP(2114997)? Thanks

First time I've seen it - it's best to CC me directly on virt-what
patches since I don't read the virt-tools mailing list very often.

I pushed your patch with a small alteration to the ordering of the if
clauses:

http://git.annexia.org/?p=virt-what.git;a=commitdiff;h=39001e7c458d798225814c04e920583fa7e2a41c

Thanks,

Rich.

> Rgs,
> Frank
> 
> On Wed, May 25, 2022 at 4:26 PM Frank Liang <xiliang at redhat.com> wrote:
> 
>     Thanks, Daniel
> 
>     Removed the outdated comments following your suggestion.
> 
>     Rgs,
>     Frank
> 
>     On Wed, May 25, 2022 at 4:06 PM Daniel P. Berrangé <berrange at redhat.com>
>     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 at 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 at redhat.com>
>         > ---
>         >  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 :|
> 
> 

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
nbdkit - Flexible, fast NBD server with plugins
https://gitlab.com/nbdkit/nbdkit


More information about the virt-tools-list mailing list