Bug 1208029

Summary: virt-who crashes when ecryption key doesn't exist
Product: Red Hat Enterprise Linux 6 Reporter: Liushihui <shihliu>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED ERRATA QA Contact: gaoshang <sgao>
Severity: medium Docs Contact:
Priority: high    
Version: 6.7CC: gxing, ovasik, rbalakri, rnovacek, sgao
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: All   
Whiteboard:
Fixed In Version: virt-who-0.12-3.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1175076 Environment:
Last Closed: 2015-07-22 07:16:13 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: 1175076, 1221027    
Bug Blocks:    

Comment 2 Radek Novacek 2015-04-02 15:29:35 UTC
Fixed in virt-who-0.12-3.el6.

Comment 4 Liushihui 2015-04-17 05:55:34 UTC
Verify it on virt-who-0.12-5.el6.noarch 

Verified version:
subscription-manager-1.14.5-1.el6.x86_64
python-rhsm-1.14.2-1.el6.x86_64
virt-who-0.12-5.el6.noarch
candlepin-0.9.6.5-1.el6sam.noarch
katello-headpin-1.4.3.28-1.el6sam_splice.noarch

Verified process:
1. Register rhel to sam server, then configure virt-who run at rhevm and esx mode as the following:
[root@hp-z220-06 virt-who.d]# cat /etc/sysconfig/virt-who
VIRTWHO_BACKGROUND=1
VIRTWHO_DEBUG=1
VIRTWHO_INTERVAL=2
VIRTWHO_RHEVM_OWNER=ACME_Corporation
VIRTWHO_RHEVM_ENV=Library
VIRTWHO_RHEVM_SERVER=https://10.66.79.77:443
VIRTWHO_RHEVM_USERNAME=admin@internal
VIRTWHO_RHEVM_PASSWORD=redhat

[root@hp-z220-06 virt-who.d]# cat /etc/virt-who.d/virt-who
[test-esx1]
type=esx
server=10.66.78.75
username=Administrator
#password=qwer1234P!
encrypted_password=43f282d679adb816f2bb1cf9c18949ec
owner=ACME_Corporation
env=Library

2. Restart virt-who service, then check the virt-who's log.
[root@hp-z220-05 ~]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who:                                         [  OK  ]
2015-04-17 13:52:11,135 [DEBUG]  @virtwho.py:88 - Using config named 'test-esx1'
2015-04-17 13:52:11,135 [INFO]  @virtwho.py:527 - Using configuration "test-esx1" ("esx" mode)
2015-04-17 13:52:11,136 [INFO]  @virtwho.py:527 - Using configuration "env/cmdline" ("rhevm" mode)
2015-04-17 13:52:11,136 [DEBUG]  @virtwho.py:135 - Starting infinite loop with 5 seconds interval
2015-04-17 13:52:11,273 [ERROR]  @virtwho.py:143 - Unable to use configuration "test-esx1": [Errno 2] No such file or directory: '/var/lib/virt-who/key'
2015-04-17 13:52:11,470 [INFO]  @subscriptionmanager.py:124 - Sending update in hosts-to-guests mapping: {'cb70a094-6ab8-4c15-8f52-d557f4f7ef83': [], '7691fd80-6f02-45e5-a83c-d38e01cfcbf7': ['9e73efbb-fbee-4212-8b2b-b81dedf061e9', '2d78eb42-d66b-46a6-a52c-c43eb9fb8af8']}

3. Check the virt-who's status
[root@hp-z220-05 ~]# service virt-who status
virt-who (pid  19144) is running...
[root@hp-z220-05 ~]# ps -ef|grep virt-who
root     19144     1  1 13:52 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     19150 19144  0 13:52 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     19184 11424  0 13:53 pts/1    00:00:00 grep virt-who

Result: 
Although encrypted_password isn't exist, it only block to send out the esx's host/guest mapping, virt-who still run normally, therefore, verify it.

Comment 5 errata-xmlrpc 2015-07-22 07:16:13 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-2015-1377.html