Bug 668936
| Summary: | facts --list reports incorrect value for virt.is_guest when virt-what throws a non-zero exit code | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | John Sefler <jsefler> | 
| Component: | subscription-manager | Assignee: | Justin Harris <jharris> | 
| Status: | CLOSED ERRATA | QA Contact: | John Sefler <jsefler> | 
| Severity: | medium | Docs Contact: | |
| Priority: | low | ||
| Version: | 6.1 | CC: | jkeck, spandey | 
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2011-05-19 13:38:48 UTC | Type: | --- | 
| 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: | 639436 | ||
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 :" 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 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  | 
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