python-novaclient Python API

Asked by Michael Lin

Dear all,

I am trying to use "python-novaclient 2012.1" version for test purpose.

But when I try to use "Quick-start using keystone", I have some problem that I don't know how to solve it.

This is my code below,

>>> from novaclient.v1_1 import client
>>> nt = client.Client('admin', '111111', 'admin', 'http://localhost:5000/v2.0/')
>>> nt.flavors.list()

and then, I got these error message,

Could not find any suitable endpoint. Correct region?
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/stack/python-novaclient/novaclient/v1_1/flavors.py", line 39, in list
    return self._list("/flavors/detail", "flavors")
  File "/opt/stack/python-novaclient/novaclient/base.py", line 71, in _list
    resp, body = self.api.client.get(url)
  File "/opt/stack/python-novaclient/novaclient/client.py", line 136, in get
    return self._cs_request(url, 'GET', **kwargs)
  File "/opt/stack/python-novaclient/novaclient/client.py", line 113, in _cs_request
    self.authenticate()
  File "/opt/stack/python-novaclient/novaclient/client.py", line 229, in authenticate
    auth_url = self._v2_auth(auth_url)
  File "/opt/stack/python-novaclient/novaclient/client.py", line 284, in _v2_auth
    self._authenticate(url, body)
  File "/opt/stack/python-novaclient/novaclient/client.py", line 309, in _authenticate
    return self._extract_service_catalog(url, resp, body)
  File "/opt/stack/python-novaclient/novaclient/client.py", line 166, in _extract_service_catalog
    service_name=self.service_name)
  File "/opt/stack/python-novaclient/novaclient/service_catalog.py", line 67, in url_for
    raise novaclient.exceptions.EndpointNotFound()
novaclient.exceptions.EndpointNotFound

Is anyone can help me to solve this question, thanks a lot :D

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Compute (nova) Edit question
Assignee:
No assignee Edit question
Solved by:
yong sheng gong
Solved:
Last query:
Last reply:
Revision history for this message
antiError (zhonghuabaima0913) said :
#1

Dear all:

      How did you install nova services by nova-2012.1~e4.tar.gz?Could you tell me the relation of nova-2012.1~e4.tar.gz and python-novaclient-2012.1~e4.tar.gz .

Thanks

Revision history for this message
Best yong sheng gong (gongysh) said :
#2

we have to specify the version and service_type among other things. See my codes below:
'''
Created on Mar 30, 2012

@author: gongys
'''

from novaclient import client

if __name__ == '__main__':
    nt = client.Client('1.1', 'admin', 'password', 'admin', 'http://localhost:5000/v2.0', service_type="compute")
    flavors = nt.flavors.list()
    print str(flavors)

Revision history for this message
Michael Lin (michael-lin) said :
#3

Thanks yong sheng gong, that solved my question.