RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 668936 - facts --list reports incorrect value for virt.is_guest when virt-what throws a non-zero exit code
Summary: facts --list reports incorrect value for virt.is_guest when virt-what throws ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.1
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: rc
: ---
Assignee: Justin Harris
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: Entitlement-Beta
TreeView+ depends on / blocked
 
Reported: 2011-01-12 05:14 UTC by John Sefler
Modified: 2013-07-04 21:09 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-19 13:38:48 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2011:0611 0 normal SHIPPED_LIVE new package: subscription-manager 2011-05-18 17:56:21 UTC

Description John Sefler 2011-01-12 05:14:36 UTC
Description of problem:
According to the man page DESCRIPTION of virt-what...

       If nothing is printed and the script exits with code 0 (no error), then it can mean either that the program is running on bare-metal or the program is running inside a type of virtual machine which we don’t know about or cannot detect.

That implies to me that if virt-what exits with a non-zero code, then is_guest is undeterminable and should be reported as "Unknown" OR not reported at all in the facts --list.

Reference: In the case that virt-what is not installed on the client, the subscription-manager facts --list will report:
virt.host_type: Unknown
virt.is_guest IS ABSENT FROM THE facts list


Version-Release number of selected component (if applicable):
[root@jsefler-onprem01 ~]# rpm -q virt-what
virt-what-1.3-3.fc14.x86_64
[root@jsefler-onprem01 ~]# rpm -q subscription-manager
subscription-manager-0.93.10-1.git.4.433f1bd.el6.x86_64


How reproducible:


Steps to Reproduce:
[root@jsefler-onprem01 ~]# cp /usr/sbin/virt-what /usr/sbin/virt-what.bak

[root@jsefler-onprem01 ~]# echo '#!/bin/bash - ' > /usr/sbin/virt-what; echo 'echo "virt-what is about to exit with code 255"; exit 255' >> /usr/sbin/virt-what

[root@jsefler-onprem01 ~]# virt-what
virt-what is about to exit with code 255
[root@jsefler-onprem01 ~]# echo $?
255

[root@jsefler-onprem01 ~]# subscription-manager facts --list | grep virt\\.
virt.host_type: virt-what is about to exit with code 255
virt.is_guest: True

[root@jsefler-onprem01 ~]# cp -f /usr/sbin/virt-what.bak /usr/sbin/virt-what


Actual results:
virt.host_type: virt-what is about to exit with code 255
virt.is_guest: True

Expected results:
virt.host_type: virt-what is about to exit with code 255
virt.is_guest: Unknown
  OR
virt.is_guest IS ABSENT FROM THE facts list

Comment 2 spandey 2011-01-20 12:04:15 UTC
Rpm version

[root@beta1 ~]# rpm -qa | grep subscription
subscription-manager-firstboot-0.93.13-1.el6.x86_64
subscription-manager-0.93.13-1.el6.x86_64
subscription-manager-gnome-0.93.13-1.el6.x86_64
[root@beta1 ~]# rpm -qa | grep virt-what
virt-what-1.3-4.el6.x86_64


Followed above repro steps 

getting Following console output 


[root@beta1 ~]# subscription-manager facts --list | grep virt\\.
virt.is_guest: Unknown

here I am not able to find "virt.host.type :"

Comment 3 John Sefler 2011-01-20 15:28:09 UTC
VERIFYING...

VERSION...
[root@jsefler-betaqa-2 ~]# rpm -q virt-what
virt-what-1.3-4.el6.x86_64
[root@jsefler-betaqa-2 ~]# rpm -q subscription-manager
subscription-manager-0.93.13-1.git.6.1cac2dd.el6.x86_64


TESTING...
[root@jsefler-betaqa-2 ~]# cp /usr/sbin/virt-what /usr/sbin/virt-what.bak
[root@jsefler-betaqa-2 ~]# echo '#!/bin/bash - ' > /usr/sbin/virt-what; echo 'echo "virt-what is about to exit with code 255"; exit 255' >> /usr/sbin/virt-what
[root@jsefler-betaqa-2 ~]# virt-what
virt-what is about to exit with code 255
[root@jsefler-betaqa-2 ~]# echo $?
255
[root@jsefler-betaqa-2 ~]# subscription-manager facts --list | grep virt\\.
virt.is_guest: Unknown


VERIFIED^^^ The fact for virt.is_guest is "Unknown" when virt-what exist with non-zero.  Moreover the virt.host_type is not reported at all since there is not enough information to report a fact for it.

MOVING TO VERIFIED

[root@jsefler-betaqa-2 ~]# cp -f /usr/sbin/virt-what.bak /usr/sbin/virt-what
cp: overwrite `/usr/sbin/virt-what'? y

Comment 4 errata-xmlrpc 2011-05-19 13:38:48 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2011-0611.html


Note You need to log in before you can comment on or make changes to this bug.