Bug 2217407

Summary: Virt-what does not return correct result when running inside an openshift container
Product: Red Hat Enterprise Linux 8 Reporter: alessandro.taufer
Component: virt-whatAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: YongkuiGuo <yoguo>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.8CC: alessandro.taufer, rjones, virt-maint, xiaodwan, yacao, yoguo
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: virt-what-1.25-4.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2218203 (view as bug list) Environment:
Last Closed: 2023-11-14 15:51:34 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: 2218203    

Description alessandro.taufer 2023-06-26 08:03:19 UTC
Description of problem:
It's impossible to request a virtual subscription of RedHat OS while running in a Openshift container. That's due to the fact that virt-what doesn't detect CRI-O based containers.

Version-Release number of selected component (if applicable): 8.8


How reproducible:
Run a container registry.access.redhat.com/ubi8/ubi-init:8.8 on openshift

Steps to Reproduce:
1. Launch a container registry.access.redhat.com/ubi8/ubi-init:8.8 on openshift
2. Run #virt-what

Actual results:
#virt-what
Return code 0

Expected results:
#virt-what
crio

Additional info:

Comment 1 Richard W.M. Jones 2023-06-27 13:17:11 UTC
Can you tell us the precise version of virt-what?  rpm -q virt-what

Comment 2 Richard W.M. Jones 2023-06-27 13:21:42 UTC
Also what's the version of OpenShift (if known).

What is the contents of /proc/1/environ ?

Comment 3 alessandro.taufer 2023-06-27 13:48:26 UTC
Thank you for the quick reply!

$ rpm -q virt-what
virt-what-1.25-3.el8.x86_64

$cat /proc/1/environ # I just kept the part related to the container because I'm not sure how much of the file I am allowed to share
container=crio

Openshift Version: 4.13.1

Comment 4 Xiaodai Wang 2023-06-27 15:09:03 UTC
I can reproduce it in an OCP cluster which is installed on baremetal.

I also tried the cluster which is installed on a VM, the result is
# virt-what
kvm

I tried it again in podman, the result is
# podman exec -it 392a422ca3b2 virt-what
oci

Comment 5 Richard W.M. Jones 2023-06-27 16:24:13 UTC
(In reply to Xiaodai Wang from comment #4)
> I can reproduce it in an OCP cluster which is installed on baremetal.
> 
> I also tried the cluster which is installed on a VM, the result is
> # virt-what
> kvm

I believe we are expecting output like:

# virt-what
kvm
crio      ; or maybe "oci" here, being discussed on tech-list

Note "kvm" is still printed because of the KVM VM you're running it in.

> I tried it again in podman, the result is
> # podman exec -it 392a422ca3b2 virt-what
> oci

Yes, this is correct.

Comment 6 Richard W.M. Jones 2023-06-28 08:59:49 UTC
(In reply to Xiaodai Wang from comment #4)
> I can reproduce it in an OCP cluster which is installed on baremetal.

Xiaodai, can I get remote access to this?  (Email me the creds if possible)

Comment 7 Richard W.M. Jones 2023-06-28 12:27:28 UTC
Upstream fix:
http://git.annexia.org/?p=virt-what.git;a=commitdiff;h=95d18c02038f44bc3e8ff264079f8b697eecf1bd

# virt-what
crio

Comment 8 Richard W.M. Jones 2023-06-28 12:29:38 UTC
I've suggested a potential fix in ITM 20 for RHEL 8.9, although it's a bit late in
the process.  Let's see what QE want to do.

Comment 9 YongkuiGuo 2023-06-28 12:31:02 UTC
Thanks xiaodai for reproducing this issue.

Comment 10 YongkuiGuo 2023-07-03 07:54:23 UTC
Tested with the following package:
virt-what-1.25-3.el8.x86_64

Steps:

1. Install OCP 4.13 in a VM and launch a container registry.access.redhat.com/ubi8/ubi-init:8.8

sh-4.4# rpm -q virt-what
virt-what-1.25-4.el8.x86_64
sh-4.4# virt-what
crio
kvm

The 'crio' is printed as expected.

Comment 11 YongkuiGuo 2023-08-08 09:31:58 UTC
Hi rjones,

Could you help add this bug to the erratum? Thanks.

Comment 14 YongkuiGuo 2023-08-08 13:04:37 UTC
Verified this bug per comment 10.

Comment 17 errata-xmlrpc 2023-11-14 15:51:34 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/RHEA-2023:7173