Bug 783355 - If there is no guest on ESX,virt-who will report "AttributeError" info.
If there is no guest on ESX,virt-who will report "AttributeError" info.
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: virt-who (Show other bugs)
5.8
Unspecified Unspecified
urgent Severity urgent
: rc
: ---
Assigned To: Radek Novacek
Entitlement Bugs
:
Depends On:
Blocks: 786154
  Show dependency treegraph
 
Reported: 2012-01-20 00:19 EST by Hui Wang
Modified: 2012-02-21 01:07 EST (History)
3 users (show)

See Also:
Fixed In Version: virt-who-0.5-5.el5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-02-21 01:07:27 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Hui Wang 2012-01-20 00:19:33 EST
Description of problem:
If there is no guest on ESX,virt-who will report "AttributeError" info. 

Version-Release number of selected component (if applicable):

virt-who-0.5-4.el5
python-rhsm-0.98.8-1.el5
subscription-manager-0.98.9-1.el5
subscription-manager-gnome-0.98.9-1.el5
subscription-manager-firstboot-0.98.9-1.el5
katello-cli-common-0.1.34-2.el6.noarch
katello-headpin-0.1.125-2.el6.noarch
katello-qpid-broker-key-pair-1.0-1.noarch
katello-cli-headpin-0.1.13-2.el6.noarch
katello-configure-0.1.52-2.el6.noarch
katello-trusted-ssl-cert-1.0-1.noarch
katello-common-0.1.180-2.el6.noarch
katello-headpin-all-0.1.125-2.el6.noarch
katello-glue-candlepin-0.1.180-2.el6.noarch
katello-httpd-ssl-key-pair-1.0-1.noarch
katello-certs-tools-1.0.1-2.el6.noarch
thumbslug-0.0.21-1.el6.noarch
candlepin-0.5.10-1.el6.noarch
candlepin-tomcat6-0.5.10-1.el6.noarch
katello-glue-candlepin-0.1.180-2.el6.noarch

How reproducible:
always

Steps to Reproduce:
1. prepared one rhel5.8-snapshot4.0 host, and register to SAM:
#subscription-namager register --org=ACME_Corporation --environment=env1
--username=$username --password=$password

2.Deployed the env of ESX as following:
Set the vcenter's username/password 
Vcenter username : Administrator
Vcenter password :123qweP
Vcenter server IP : 10.66.5.106
Vsphere client Ip : 10.66.6.128
ESX IP: 10.66.6.66
ESX username=$username
ESX password=$password
Installed some Guests on ESX

3.Set the /etc/sysconfig/virt-who on rhel5.8-snapshot5.0 host (or on one of the
guests that is installed on ESX).

#vim /etc/sysconfig/virt-who
VIRTWHO_BACKGROUND=1
VIRTWHO_DEBUG=1
VIRTWHO_ESX=1
VIRTWHO_ESX_OWNER=ACME_Corporation
VIRTWHO_ESX_ENV=env1
VIRTWHO_ESX_SERVER=10.66.5.106
VIRTWHO_ESX_USERNAME=Administrator
VIRTWHO_ESX_PASSWORD=123qweP

4.Restart virt-who service
#service virt-who restart
...................
Updated host: 44454c4c-4c00-1031-8053-b8c04f4e3258 with guests: [564d5f4c-b07f-22cf-a9fd-234ba11f46f9]
Sending updates in hosts-to-guests mapping: {44454c4c-4c00-1031-8053-b8c04f4e3258: [564d5f4c-b07f-22cf-a9fd-234ba11f46f9]}
Updated host: 44454c4c-4c00-1031-8053-b8c04f4e3258 with guests: [564d5f4c-b07f-22cf-a9fd-234ba11f46f9]
Sending updates in hosts-to-guests mapping: {44454c4c-4c00-1031-8053-b8c04f4e3258: [564d5f4c-b07f-22cf-a9fd-234ba11f46f9]}
Updated host: 44454c4c-4c00-1031-8053-b8c04f4e3258 with guests: [564d5f4c-b07f-22cf-a9fd-234ba11f46f9]
^^^^^^^^^^^^^^^After delete all the guests on ESX
'Text' object has no attribute 'ManagedObjectReference'
Traceback (most recent call last):
  File "/usr/share/virt-who/virt-who.py", line 132, in _send
    result = self.subscriptionManager.hypervisorCheckIn(self.options.esx_owner, self.options.esx_env, self.virt.getHostGuestMapping())
  File "/usr/share/virt-who/vsphere.py", line 213, in getHostGuestMapping
    self.scan()
  File "/usr/share/virt-who/vsphere.py", line 159, in scan
    for vm in propSet.val.ManagedObjectReference:
AttributeError: 'Text' object has no attribute 'ManagedObjectReference'
Unexcepted error occurs, trying to recover
'Text' object has no attribute 'ManagedObjectReference'
Traceback (most recent call last):
  File "/usr/share/virt-who/virt-who.py", line 132, in _send
    result = self.subscriptionManager.hypervisorCheckIn(self.options.esx_owner, self.options.esx_env, self.virt.getHostGuestMapping())
  File "/usr/share/virt-who/vsphere.py", line 213, in getHostGuestMapping
    self.scan()
  File "/usr/share/virt-who/vsphere.py", line 159, in scan
    for vm in propSet.val.ManagedObjectReference:
AttributeError: 'Text' object has no attribute 'ManagedObjectReference'
Unable to recover, retry in 60 seconds.


Expected results:
If there is no guest on ESX,virt-who will report "AttributeError" info.

Additional info:
No error info
Comment 2 Radek Novacek 2012-01-20 03:56:02 EST
Confirmed. This issue is simple to fix. I have patch ready. Is it possible to get this fix to in 5.8?
Comment 3 Radek Novacek 2012-01-20 04:49:14 EST
Fixed in virt-who-0.5-5.el5.
Comment 6 Hui Wang 2012-01-20 05:56:21 EST
I verified the issue on virt-who-0.5-5.el5.
The result is pass.

[root@tosam20 yum.repos.d]# service virt-who restart
Stopping virt-who:                                         [  OK  ]
Starting virt-who: Listening for events is not available in VDSM or ESX mode
Virt-who is running in esx mode
Starting infinite loop with 1 seconds interval and event handling
                                                           [  OK  ]
[root@tosam20 yum.repos.d]# Sending updates in hosts-to-guests mapping: {44454c4c-4c00-1031-8053-b8c04f4e3258: []}
Updated host: 44454c4c-4c00-1031-8053-b8c04f4e3258 with guests: []
Comment 7 errata-xmlrpc 2012-02-21 01:07:27 EST
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.

http://rhn.redhat.com/errata/RHEA-2012-0225.html

Note You need to log in before you can comment on or make changes to this bug.