Bug 1756381

Summary: Nutanix AHV is detected as hyperv
Product: Red Hat Enterprise Linux 8 Reporter: Cristian Seres <cseres>
Component: virt-whatAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: YongkuiGuo <yoguo>
Severity: low Docs Contact:
Priority: unspecified    
Version: 8.0CC: boyang, jsuchane, knoel, leiwang, linl, mfuruta, pbonzini, ribarry, rjones, xiliang, ymankad, ymao, yoguo
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: 8.5   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: virt-what-1.18-9.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1979952 1984624 (view as bug list) Environment:
Last Closed: 2021-11-09 19:32:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1979952, 1984624    

Description Cristian Seres 2019-09-27 13:37:24 UTC
Description of problem:
virt-what shows Nutanix AHV platform as "hyperv"

Version-Release number of selected component (if applicable):
virt-what-1.18-6.el8.x86_64 tested on CentOS Linux release 8.0.1905

How reproducible:
always

Steps to Reproduce:
1. use RHEL on Nutanix AHV platform (tested with Nutanix 20170830.301)
2. run virt-what


Actual results:
output is "hyperv"

Expected results:
output "ahv" and documentation updated to include Nutanix AHV platform

Additional info:
Spacewalk had similar problem identifying Nutanix AHV, I guess there is a ready piece of code for identification, I'll add the link to the bug.

Comment 1 Paolo Bonzini 2019-10-02 13:51:30 UTC
The expected result is probably kvm, but if virt-what says "hyperv", it's because Nutanix configured its KVM to enable Hyper-V extensions.

The problem is twofold:

1) virt-what-cpuid-helper.c should not use max_entries in "for (leaf = base + 0x100; leaf <= base + max_entries; leaf += 0x100)", instead it should just use "leaf < base + 0x10000"

2) virt-what should be able to deal with virt-what-cpuid-helper printing two or more signatures, and probably it should skip Hyper-V if more than one signature is printed.  Alternatively, virt-what-cpuid-helper should print only the highest signature.

Comment 2 Richard W.M. Jones 2019-10-02 16:20:06 UTC
Can I get access to a Linux guest (ideally RHEL 8 or recent Fedora) running on
a Nutanix host?

Comment 3 Cristian Seres 2019-10-04 12:06:26 UTC
(In reply to Richard W.M. Jones from comment #2)
> Can I get access to a Linux guest (ideally RHEL 8 or recent Fedora) running
> on
> a Nutanix host?

Sure, I have now created fedora.seres.fi (Fedora 30 Server), ECDSA key fingerprint is SHA256:BpJo23PKFb0hi1tYIbD5xUKjmazZYtkxvAQFVJKfJrE.

Can I have your ssh public key?

With best regards,
Cristian Seres

Comment 4 Richard W.M. Jones 2019-10-04 12:12:33 UTC
Sent by email.

Comment 5 Richard W.M. Jones 2019-10-04 13:35:47 UTC
Fixed in
http://git.annexia.org/?p=virt-what.git;a=commitdiff;h=0a0d9fa7c85c5474870cae37832d28ccd899d4ee
http://git.annexia.org/?p=virt-what.git;a=commitdiff;h=f317e788dd7c2a35c2ae0f64fa50ab720382ebf5

Cristian: You can test this if you like.  The source for virt-what is checked out
on the Fedora VM, and you can run it from that directory by doing:

cd virt-what
sudo PATH=.:$PATH ./virt-what

I probably don't need that Fedora VM any longer, as long as everyone is happy
with the patches above.

Comment 6 YongkuiGuo 2019-12-10 03:35:35 UTC
Hi rjones, was this bug likely to be fixed in rhel8.2? Maybe we should confirm whether Cristian has tested the patch you provided.

Comment 7 Richard W.M. Jones 2019-12-10 08:32:09 UTC
I'd like to see it tested as, especially the first part of the patch, is risky.

Comment 8 Cristian Seres 2019-12-10 12:12:38 UTC
(In reply to Richard W.M. Jones from comment #5)

> Cristian: You can test this if you like.  The source for virt-what is
> checked out
> on the Fedora VM, and you can run it from that directory by doing:
> 
> cd virt-what
> sudo PATH=.:$PATH ./virt-what

I have tested that this works as it should on the Fedora 30 test VM. It prints out
nutanix_ahv

On other hypervisors (VMware) I have not tried it.

The Fedora test VM on Nutanix AHV still exists and I can make it accessible, if someone still wants to do some other checks.

I have no licensed RHEL8 vms to test the patch on, but I do have CentOS 8.0.1905 if you want me to still test something specific.

With best regards,
Cristian Seres

Comment 9 Richard W.M. Jones 2019-12-10 12:46:09 UTC
If you want to test CentOS 8 that'd be great.  You will need to check out
the source code first using:

git clone git://git.annexia.org/virt-what.git

and then compile it by following the README file (it's quite easy to compile).

Comment 10 Richard W.M. Jones 2019-12-10 12:46:47 UTC
Actually even better I'll build a virt-what package that you can try out, give
me a few minutes.

Comment 12 Richard W.M. Jones 2019-12-10 13:17:24 UTC
http://oirase.annexia.org/rpms/virt-what-rhel-8/

Despite the version number this is really virt-what 1.20 + all upstream patches.
It's just we have to keep the version number at 1.18 because "process".

It should install on any CentOS 8 as far as I know.

Comment 13 Cristian Seres 2019-12-10 13:23:33 UTC
http://oirase.annexia.org/rpms/virt-what-rhel-8/virt-what-1.18-8.el8.x86_64.rpm installed and worked like a charm on CentOS 8.

Comment 14 Richard W.M. Jones 2019-12-10 13:27:15 UTC
Thanks for testing that.  We'll let QE have a bash on it next and if it
all goes well it should go into RHEL 8.2 and CentOS 8.2.

Comment 15 YongkuiGuo 2019-12-11 07:09:47 UTC
Hi rjones, this virt-what(1.18-8) package failed to detect the xen/hyperv/vmware/kvm/.../ virtualization types.


AWS KVM instance failed:
current output:
[root@ip-10-116-2-30 ec2-user]# virt-what
aws

dmesg:
[  206.388772] virt-what-cpuid[5258]: segfault at 7f0499d6 ip 0000562e7f049799 sp 00007fff111935a0 error 4 in virt-what-cpuid-helper[562e7f049000+1000]
[  206.395986] Code: 49 39 07 0f 84 a8 00 00 00 b9 0d 00 00 00 4c 89 fe 48 89 ef f3 a6 0f 97 c0 1c 00 84 c0 74 a6 b9 0d 00 00 00 4c 89 fe 48 89 df <f3> a6 0f 97 c0 1c 00 84 c0 74 90 b9 0d 00 00 00 4c 89 fe 4c 89 ef

expected output:
[root@ip-10-116-2-30 ec2-user]# virt-what
kvm
aws

------------------------------------------

Local xen guest failed:
current output:
[root@dhcp-15-147 ~]# virt-what
xen
xen-domU
[3444171.721744] virt-what-cpuid[1990]: segfault at 488bd9d6 ip 000055e3488bd799 sp 00007fff6507a820 error 4 in virt-what-cpuid-helper[55e3488bd000+1000]
[3444171.721749] Code: 49 39 07 0f 84 a8 00 00 00 b9 0d 00 00 00 4c 89 fe 48 89 ef f3 a6 0f 97 c0 1c 00 84 c0 74 a6 b9 0d 00 00 00 4c 89 fe 48 89 df <f3> a6 0f 97 c0 1c 00 84 c0 74 90 b9 0d 00 00 00 4c 89 fe 4c 89 ef

expected result:
[root@dhcp-15-147 ~]# virt-what
xen
xen-hvm

------------------------------------------

rhel8.2 guest on Hyper-V:
current output: 
[root@dhcp-xx-xx]# virt-what
virtualpc

expected output:
[root@dhcp-xx-xx]# virt-what
hyperv

------------------------------------------

rhel8.2 guest on ESXi
[root@bootp-73-199-201 ~]# virt-what
vmware   --->   Slow than last version.
[root@bootp-73-199-201 ~]# dmesg
[57332.974164] virt-what-cpuid[19977]: segfault at b099d9d6 ip 000055c4b099d799 sp 00007fff47532720 error 4 in virt-what-cpuid-helper[55c4b099d000+1000]
[57332.974177] Code: 49 39 07 0f 84 a8 00 00 00 b9 0d 00 00 00 4c 89 fe 48 89 ef f3 a6 0f 97 c0 1c 00 84 c0 74 a6 b9 0d 00 00 00 4c 89 fe 48 89 df <f3> a6 0f 97 c0 1c 00 84 c0 74 90 b9 0d 00 00 00 4c 89 fe 4c 89 ef

Comment 16 Richard W.M. Jones 2019-12-11 09:49:10 UTC
I guess patch 1 is riskier than I thought ...  I moved this to the
backlog because I don't have time to debug this for 8.2.

Comment 17 YongkuiGuo 2019-12-11 10:53:59 UTC
rjones, this package(virt-what-1.18-8.el8) has been into the rhel8 nightly compose

Comment 19 Richard W.M. Jones 2019-12-13 08:43:00 UTC
(In reply to YongkuiGuo from comment #17)
> rjones, this package(virt-what-1.18-8.el8) has been into the rhel8 nightly
> compose

It should come out of the compose soon because the advisory was dropped.
Of course people will have to manually downgrade.

Comment 31 Richard W.M. Jones 2021-04-13 08:54:04 UTC
The fix for this is:
http://git.annexia.org/?p=virt-what.git;a=commit;h=60d903fbb7653bc9754228bdab4c6933fcda1e72

This is simple enough that it does not require rebasing, and can
be backported ... if it passes all the tests - I was only able to test
it on baremetal, KVM and VMware so far.

Comment 35 YongkuiGuo 2021-04-13 09:33:01 UTC
(In reply to Richard W.M. Jones from comment #31)
> The fix for this is:
> http://git.annexia.org/?p=virt-what.git;a=commit;
> h=60d903fbb7653bc9754228bdab4c6933fcda1e72
> 
> This is simple enough that it does not require rebasing, and can
> be backported ... if it passes all the tests - I was only able to test
> it on baremetal, KVM and VMware so far.

rjones, can we let Cristian Seres test the fixed version(virt-what-1.18-9.el8) on CentOS 8 with Nutanix AHV platform? We don't have Nutanix AHV env.

Comment 36 Richard W.M. Jones 2021-04-13 09:37:24 UTC
Christian:
Are you able to test either http://git.annexia.org/?p=virt-what.git,
or a RHEL package which I will provide, or provide a Nutanix AHV environment
we can use to test this change in?

Comment 37 Cristian Seres 2021-04-14 21:36:02 UTC
Sure, I can test, preferable with an RPM.

Comment 38 Richard W.M. Jones 2021-04-15 07:19:49 UTC
That's great news, thanks.  I have placed the RPMs here:

http://oirase.annexia.org/tmp/bz1756381/

Assuming it's x86-64 you'll only need this one:

http://oirase.annexia.org/tmp/bz1756381/virt-what-1.18-9.el8.x86_64.rpm

Comment 39 Cristian Seres 2021-04-15 08:26:41 UTC
The package seems to work perfectly. I tested both before and after upgrading to CentOS 8.3.

[cristian@uuni1 ~]$ rpm -q virt-what
virt-what-1.18-9.el8.x86_64

[cristian@uuni1 ~]$ uname -a
Linux uuni1.contrasec.fi 4.18.0-193.6.3.el8_2.x86_64 #1 SMP Wed Jun 10 11:09:32 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[cristian@uuni1 ~]$ cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)
[cristian@uuni1 ~]$ sudo virt-what
nutanix_ahv
[cristian@uuni1 ~]$

[cristian@uuni1 ~]$ uname -a
Linux uuni1.contrasec.fi 4.18.0-240.15.1.el8_3.x86_64 #1 SMP Mon Mar 1 17:16:16 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
[cristian@uuni1 ~]$ cat /etc/redhat-release
CentOS Linux release 8.3.2011
[cristian@uuni1 ~]$ sudo virt-what
nutanix_ahv
[cristian@uuni1 ~]$

Comment 40 Richard W.M. Jones 2021-04-15 09:00:58 UTC
Thanks for testing it.

Comment 42 YongkuiGuo 2021-04-16 09:53:08 UTC
The fixed package(virt-what-1.18-9.el8) also works well in the following hypervisors.

On KVM:
[root@localhost ~]# virt-what
kvm

On ESXi:
[root@vm-198-14 ~]# virt-what
vmware

On Hyper-V:
[root@dhcp-10-22]# virt-what
hyperv

On nested KVM (openstack env)
[root@ci-vm-10-0-139-17 ~]# virt-what
kvm

Comment 43 YongkuiGuo 2021-04-16 09:58:26 UTC
Verified this bug according to comment 39, 41 and 42.

Comment 51 errata-xmlrpc 2021-11-09 19:32:37 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (virt-what bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4370

Comment 52 Richard W.M. Jones 2023-06-05 08:57:52 UTC
FWIW there is apparently Nutanix hardware which gets detected as AHV
(incorrectly, presumably).  See:
https://bugzilla.redhat.com/show_bug.cgi?id=2211980