Client repr hosts list return value will raise AttributeError: host
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/
return "<Host: %s>" % self.host
File "/usr/local/
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.
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.
{"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.
Fix proposed to branch: master /review. openstack. org/244476
Review: https:/