Bug 1472727

Summary: Virt-who fail to start when configured only one hypervisor with encrypted password but no key file in '/var/lib/virt-who/'
Product: Red Hat Enterprise Linux 7 Reporter: yuefliu <yuefliu>
Component: virt-whoAssignee: Jiri Hnidek <jhnidek>
Status: CLOSED ERRATA QA Contact: Eko <hsun>
Severity: high Docs Contact:
Priority: medium    
Version: 7.4CC: hsun, jhnidek, khowell, salmy, wpoteat
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-06 12:40:46 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:

Comment 3 Kevin Howell 2017-07-20 14:22:01 UTC
Dev: let's make sure virt-who prints a better error message

Comment 4 Liushihui 2017-11-09 07:13:57 UTC
In virt-who-0.20.4-1.el7sat.noarch, No matter /var/lib/virt-who/key is exist or not, when configure encrypted_password to null or error value(encrypted_password= or encrypted_password=xxxx), failed to start virt-who service and error info as the following:

2017-11-09 06:53:09,370 [virtwho.config ERROR] MainProcess(26373):MainThread @config.py:init_config:1336 - Required option: "password" is missing in: "xen"
2017-11-09 06:53:09,370 [virtwho.init ERROR] MainProcess(26373):MainThread @main.py:main:139 - virt-who can't be started: no valid configuration found

Expected result:
Since configure password to null or error value(password= or password=xxxx), virt-who still can start and error info as the following. when set encrypted_password to null or wrong value, virt-who should be started normally and show the same error info
2017-11-09 07:08:42,153 [virtwho.xen ERROR] MainProcess(26417):Thread-2 @xen.py:login:118 - Unable to login to XENserver https://10.73.131.203
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/virtwho/virt/xen/xen.py", line 107, in login
    self.session.xenapi.login_with_password(self.username, self.password)
  File "/usr/lib/python2.7/site-packages/virtwho/virt/xen/XenAPI.py", line 226, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/site-packages/virtwho/virt/xen/XenAPI.py", line 122, in xenapi_request
    self._login(methodname, params)
  File "/usr/lib/python2.7/site-packages/virtwho/virt/xen/XenAPI.py", line 145, in _login
    result = _parse_result(getattr(self, 'session.%s' % method)(*params))
  File "/usr/lib/python2.7/site-packages/virtwho/virt/xen/XenAPI.py", line 200, in _parse_result
    raise Failure(result['ErrorDescription'])
Failure: ['SESSION_AUTHENTICATION_FAILED', 'root', 'Authentication failure']
2017-11-09 07:08:42,154 [virtwho.xen ERROR] MainProcess(26417):Thread-2 @virt.py:run:383 - Thread 'xen' fails with error: ['SESSION_AUTHENTICATION_FAILED', 'root', 'Authentication failure']

Comment 5 Liushihui 2017-11-09 07:16:37 UTC
Please ignore comment4 since the virt-who version is wrong. update it as the following:

In virt-who-0.21.0-1.el7.noarch, No matter /var/lib/virt-who/key is exist or not, when configure encrypted_password to null or error value(encrypted_password= or encrypted_password=xxxx), failed to start virt-who service and error info as the following:

2017-11-09 06:53:09,370 [virtwho.config ERROR] MainProcess(26373):MainThread @config.py:init_config:1336 - Required option: "password" is missing in: "xen"
2017-11-09 06:53:09,370 [virtwho.init ERROR] MainProcess(26373):MainThread @main.py:main:139 - virt-who can't be started: no valid configuration found

Expected result:
Since configure password to null or error value(password= or password=xxxx), virt-who still can start and error info as the following. when set encrypted_password to null or wrong value, virt-who should be started normally and show the same error info
2017-11-09 07:08:42,153 [virtwho.xen ERROR] MainProcess(26417):Thread-2 @xen.py:login:118 - Unable to login to XENserver https://10.73.131.203
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/virtwho/virt/xen/xen.py", line 107, in login
    self.session.xenapi.login_with_password(self.username, self.password)
  File "/usr/lib/python2.7/site-packages/virtwho/virt/xen/XenAPI.py", line 226, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/site-packages/virtwho/virt/xen/XenAPI.py", line 122, in xenapi_request
    self._login(methodname, params)
  File "/usr/lib/python2.7/site-packages/virtwho/virt/xen/XenAPI.py", line 145, in _login
    result = _parse_result(getattr(self, 'session.%s' % method)(*params))
  File "/usr/lib/python2.7/site-packages/virtwho/virt/xen/XenAPI.py", line 200, in _parse_result
    raise Failure(result['ErrorDescription'])
Failure: ['SESSION_AUTHENTICATION_FAILED', 'root', 'Authentication failure']
2017-11-09 07:08:42,154 [virtwho.xen ERROR] MainProcess(26417):Thread-2 @virt.py:run:383 - Thread 'xen' fails with error: ['SESSION_AUTHENTICATION_FAILED', 'root', 'Authentication failure']

Comment 6 William Poteat 2019-06-10 19:38:28 UTC
justification: This error will end the virt-who process. This means that valid data will not be reported on. The proper catching of the exception allows the good data to be reported.

Comment 11 errata-xmlrpc 2019-08-06 12:40:46 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://access.redhat.com/errata/RHBA-2019:2070