Bug 1372165

Summary: virt-who generate "AttributeError:" during register a rhel host to rhevm4.0
Product: Red Hat Enterprise Linux 7 Reporter: Liushihui <shihliu>
Component: virt-whoAssignee: Chris Snyder <csnyder>
Status: CLOSED WORKSFORME QA Contact: Eko <hsun>
Severity: low Docs Contact:
Priority: medium    
Version: 7.3CC: ldai, sgao, shihliu, yuefliu
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: 2017-05-23 03:26:14 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-09-01 05:47:12 UTC
Description of problem:
During the process of registering rhel host to rhevm4.0, virt-who will show "AttributeError: 'NoneType' object has no attribute 'text'" when virt-who run at rhevm mode

Version-Release number of selected component (if applicable):
virt-who-0.17-10.el7.noarch
subscription-manager-1.17.10-1.el7.x86_64
python-rhsm-1.17.6-1.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1.Register system to Satellite

2.Configure virt-who run at rhevm mode and restart virt-who service
[root@hp-z220-05 virt-who.d]# vim /etc/sysconfig/virt-who
VIRTWHO_BACKGROUND=1
VIRTWHO_DEBUG=1
[root@hp-z220-05 virt-who.d]# cat rhevm
[test-rhevm1]
type=rhevm
server=https://tyan-gt24-04.rhts.eng.bos.redhat.com:443/ovirt-engine/
username=admin@internal
password=red2015
owner=ACME_Corporation
env=Library

3. In rhevm webUI, add a rhel host to rhevm, check virt-who's log.
[root@hp-z220-05 virt-who.d]# tail -f /var/log/rhsm/rhsm.log
2016-09-01 01:43:17,688 [virtwho.test-rhevm1 ERROR] RhevM-1(4255):MainThread @virt.py:run:379 - Virt backend 'test-rhevm1' fails with exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/virtwho/virt/virt.py", line 372, in run
    self._run()
  File "/usr/lib/python2.7/site-packages/virtwho/virt/virt.py", line 409, in _run
    report = self._get_report()
  File "/usr/lib/python2.7/site-packages/virtwho/virt/virt.py", line 334, in _get_report
    return HostGuestAssociationReport(self.config, self.getHostGuestMapping())
  File "/usr/lib/python2.7/site-packages/virtwho/virt/rhevm/rhevm.py", line 155, in getHostGuestMapping
    sockets = host.find('cpu').find('topology').find('sockets').text
AttributeError: 'NoneType' object has no attribute 'text'
2016-09-01 01:43:17,688 [virtwho.test-rhevm1 INFO] RhevM-1(4255):MainThread @virt.py:run:392 - Waiting 60 seconds before retrying backend 'test-rhevm1'

Actual results:
It will show "AttributeError" every interval(60s) until registered to rhevm successfully

Expected results:
It shouldn't show any error info during register rhel hosts.

Additional info:

Comment 1 Chris Snyder 2016-12-22 16:45:44 UTC
The fix here should be to detect when a system is not registered and we are using a rhevm backend and output a better log message saying that the cause of the failure is a lack of registration.

Comment 2 Chris Snyder 2017-05-12 18:21:24 UTC
Where is there a rhevm instance to test against during development?

I would like to request the configuration used for reproduction of this bug.
The config given in comment 0 does not work for me today. (I wonder if the rhevm instance specified exists any longer?)


Thanks for your help!

Comment 3 Liushihui 2017-05-23 03:26:14 UTC
It hasn't reproduced on latest virt-who-0.19-4.el7.noarch. Therefore, close it. Thanks.