試圖遵循一個簡單的openstack python API教程,我在http://docs.openstack.org/developer/python-novaclient/api.html找到,但似乎沒有工作。當我試圖從Python解釋器教程運行openstack:novaclient Python API不能正常工作
nova.servers.list()
或
nova.flavors.list()
,我得到以下錯誤:
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/novaclient/v2/servers.py", line 617, in list
return self._list("/servers%s%s" % (detail, query_string), "servers")
File "/usr/lib/python2.7/dist-packages/novaclient/base.py", line 64, in _list
_resp, body = self.api.client.get(url)
File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 440, in get
return self._cs_request(url, 'GET', **kwargs)
File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 399, in _cs_request
self.authenticate()
File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 569, in authenticate
self._v2_auth(auth_url)
File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 634, in _v2_auth
return self._authenticate(url, body)
File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 647, in _authenticate
**kwargs)
File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 392, in _time_request
resp, body = self.request(url, method, **kwargs)
File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 386, in request
raise exceptions.from_response(resp, body, url, method)
novaclient.exceptions.NotFound: The resource could not be found. (HTTP 404)
我使用的是相同的憑據admin_openrc。噓,這是有效的。無法弄清楚可能是什麼問題。
你驗證您的keystone身份驗證運行正常嗎? – idjaw
這是因爲使用CLI實用工具而不是python API工作正常。 –
嘗試使用novaclient API時,您是通過keystone設置憑證並創建會話嗎?或直接到novaclient?您可以檢查CLI以查看它使用什麼auth方法來查看有什麼不同。 – idjaw