Bug 1318566

Summary: virt-who still can work if no "env" option in /etc/virt-who.d/ config file
Product: Red Hat Enterprise Linux 6 Reporter: Liushihui <shihliu>
Component: virt-whoAssignee: Chris Snyder <csnyder>
Status: CLOSED ERRATA QA Contact: Eko <hsun>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.8CC: ldai, rbalakri, sgao
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: virt-who-0.18-1.el6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-21 10:29:08 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:

Description Liushihui 2016-03-17 09:16:43 UTC
Description of problem:
When without "env" option or "env" is null in /etc/virt-who.d/ config file, although it will show error info in the log, virt-who still can start. 

When VIRTWHO_ESX_ENV is null in /etc/sysconfig/virt-who, virt-who can't start and show some error message
[root@ibm-x3250m4-16 virt-who.d]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who: Option --esx-owner (or VIRTWHO_ESX_OWNER environment variable) needs to be set
                                                           [FAILED]
When virt-who CLI without "--esx-env" option or "--esx-env" is null, virt-who also can't start and show some error message
[root@ibm-x3250m4-16 virt-who.d]# virt-who --esx --esx-owner= --esx-env=7715246 --esx-server=10.73.2.95 --esx-username=administrator --esx-password=Welcome1! -o -d
Option --esx-owner (or VIRTWHO_ESX_OWNER environment variable) needs to be set

Version-Release number of selected component (if applicable):
virt-who-0.16-7.el6.noarch
subscription-manager-1.16.8-5.el6.x86_64
python-rhsm-1.16.6-1.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Register system to stage candlepin
2. Configure virt-who in /etc/virt-who.d/esx without "env" or "env" is null
[root@ibm-x3250m4-16 virt-who.d]# cat /etc/virt-who.d/esx 
[test-esx1]
type=esx
server=10.73.2.95
username=Administrator
password=Welcome1!
env=7715246
3. Restart virt-who and check virt-who's log
[root@ibm-x3250m4-16 virt-who.d]# service virt-who restart && tail -f /var/log/rhsm/rhsm.log 
Stopping virt-who:                                         [  OK  ]
Starting virt-who:                                         [  OK  ]
..................... 
2016-03-17 05:05:45,122 [virtwho.main DEBUG] MainProcess(24058):MainThread @virtwho.py:send_report:168 - Report from "test-esx1" failed to sent
2016-03-17 05:07:43,956 [virtwho.test-esx1 DEBUG] Esx-1(24066):MainThread @virt.py:enqueue:351 - Report for config "test-esx1" gathered, putting to queue for sending
2016-03-17 05:07:43,962 [virtwho.main DEBUG] MainProcess(24058):MainThread @subscriptionmanager.py:_connect:121 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2016-03-17 05:07:44,567 [virtwho.main DEBUG] MainProcess(24058):MainThread @subscriptionmanager.py:hypervisorCheckIn:162 - Checking if server has capability 'hypervisor_async'
2016-03-17 05:07:45,147 [virtwho.main DEBUG] MainProcess(24058):MainThread @subscriptionmanager.py:hypervisorCheckIn:174 - Server does not have 'hypervisors_async' capability
2016-03-17 05:07:45,147 [virtwho.main INFO] MainProcess(24058):MainThread @subscriptionmanager.py:hypervisorCheckIn:185 - Sending update in hosts-to-guests mapping for config "test-esx1": 1 hypervisors and 1 guests found
2016-03-17 05:07:45,147 [virtwho.main DEBUG] MainProcess(24058):MainThread @subscriptionmanager.py:hypervisorCheckIn:186 - Host-to-guest mapping: {
    "86b2bd00-8bad-11e2-87f4-6c3be514699d": [
        {
            "guestId": "420660d6-13f5-23bf-808b-161498bf1702", 
            "state": 1, 
            "attributes": {
                "active": 1, 
                "hypervisorVersion": "6.0.0", 
                "virtWhoType": "esx", 
                "hypervisorType": "VMware ESXi"
            }
        }
    ]
}
2016-03-17 05:07:45,905 [virtwho.main ERROR] MainProcess(24058):MainThread @virtwho.py:send:203 - Unable to send data: Communication with subscription manager failed with code 404: Organization with id None could not be found.
2016-03-17 05:07:45,906 [virtwho.main DEBUG] MainProcess(24058):MainThread @virtwho.py:send_report:168 - Report from "test-esx1" failed to sent

Actual results:
Although virt-who show some error info in the log, it still can start normally.

Expected results:
Virt-who should show the same phenomenon when without env or env is null, virt-who can't start.

Additional info:

Comment 1 Liushihui 2016-04-14 07:25:08 UTC
It has the same problem when system registered to SAM1.4.1

Comment 4 Radek Novacek 2016-10-13 08:16:01 UTC
Fixed in virt-who-0.18-1.el6.

Comment 6 Eko 2016-12-06 05:45:24 UTC
verified in virt-who-0.18-1.el6

Comment 8 errata-xmlrpc 2017-03-21 10:29:08 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, 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://rhn.redhat.com/errata/RHBA-2017-0675.html