Client repr hosts list return value will raise AttributeError: host

Bug #1515500 reported by Chung Chih, Hung
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
In Progress
Undecided
Chung Chih, Hung

Bug Description

When I am using python console to request hosts list
I import novaclient and initialize it.
Then using it to request hosts list.
But I got exception,
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/usr/local/lib/python2.7/dist-packages/novaclient/v2/hosts.py", line 24, in __repr__
   return "<Host: %s>" % self.host
 File "/usr/local/lib/python2.7/dist-packages/novaclient/openstack/common/apiclient/base.py", line 494, in __getattr__
   raise AttributeError(k)
If I call get to request one host, it will not raise exception

I had attach sample code in attachment

Why it happen?
hosts list will try to request all host to following api
172.22.118.20:8774/v2.1/6446ba0419bf443c84b1b0ba2044b3e8/os-hosts
And response
{"hosts": [{"zone": "internal", "host_name": "controller", "service": "conductor"}, {"zone": "internal", "host_name": "controller", "service": "cert"}, {"zone": "internal", "host_name": "controller", "service": "scheduler"}, {"zone": "internal", "host_name": "controller", "service": "consoleauth"}, {"zone": "nova", "host_name": "compute1", "service": "compute"}, {"zone": "nova", "host_name": "compute2", "service": "compute"}]}

host get will send reqeust to following api
172.22.118.20:8774/v2.1/6446ba0419bf443c84b1b0ba2044b3e8/os-hosts/compute1
{"host": [{"resource": {"project": "(total)", "memory_mb": 7985, "host": "compute2", "cpu": 4, "disk_gb": 39}}, {"resource": {"project": "(used_now)", "memory_mb": 512, "host": "compute2", "cpu": 0, "disk_gb": 0}}, {"resource": {"project": "(used_max)", "memory_mb": 0, "host": "compute2", "cpu": 0, "disk_gb": 0}}]}

We can observe that get api's return value will contain host key name but list api's return value is host_name.

Revision history for this message
Chung Chih, Hung (lyanchih) wrote :
Changed in python-novaclient:
assignee: nobody → Chung Chih, Hung (lyanchih)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-novaclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/244476

Changed in python-novaclient:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-novaclient (master)

Change abandoned by lyanchih (<email address hidden>) on branch: master
Review: https://review.openstack.org/244476
Reason: This got fixed at https://review.openstack.org/#/c/248300/

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.