Ask Your Question

can not get the list of servers using nova.serveres.list()

asked 2019-04-09 11:50:44 -0500

Hi, I want to get the list of openstack servers using nova.servers.list() in a Python file but I face this error. I have put os_username , ... as authentication information in the python file. Of course I can get the results using "openstack servers list" command in cli but I want to get the results in a python file.
I will really appreciate your help.

Traceback (most recent call last): File "", line 48, in <module> servers = osconn.servers.list(detailed=True) File "/home/hpnroot/.local/lib/python2.7/site-packages/novaclient/v2/", line 892, in list "servers") File "/home/hpnroot/.local/lib/python2.7/site-packages/novaclient/", line 254, in _list resp, body = self.api.client.get(url) File "/home/hpnroot/.local/lib/python2.7/site-packages/keystoneauth1/", line 375, in get return self.request(url, 'GET', *kwargs) File "/home/hpnroot/.local/lib/python2.7/site-packages/novaclient/", line 72, in request *kwargs) File "/home/hpnroot/.local/lib/python2.7/site-packages/keystoneauth1/", line 534, in request resp = super(LegacyJsonAdapter, self).request(args, *kwargs) File "/home/hpnroot/.local/lib/python2.7/site-packages/keystoneauth1/", line 237, in request return self.session.request(url, method, *kwargs) File "/home/hpnroot/.local/lib/python2.7/site-packages/keystoneauth1/", line 704, in request auth_headers = self.get_auth_headers(auth) File "/home/hpnroot/.local/lib/python2.7/site-packages/keystoneauth1/", line 1097, in get_auth_headers return auth.get_headers(self, *kwargs) File "/home/hpnroot/.local/lib/python2.7/site-packages/keystoneauth1/", line 95, in get_headers token = self.get_token(session) File "/home/hpnroot/.local/lib/python2.7/site-packages/keystoneauth1/identity/", line 88, in get_token return self.get_access(session).auth_token File "/home/hpnroot/.local/lib/python2.7/site-packages/keystoneauth1/identity/", line 134, in get_access self.auth_ref = self.get_auth_ref(session) File "/home/hpnroot/.local/lib/python2.7/site-packages/keystoneauth1/identity/generic/", line 208, in get_auth_ref return self._plugin.get_auth_ref(session, *kwargs) File "/home/hpnroot/.local/lib/python2.7/site-packages/keystoneauth1/identity/v3/", line 178, in get_auth_ref authenticated=False, log=False, *rkwargs) File "/home/hpnroot/.local/lib/python2.7/site-packages/keystoneauth1/", line 1045, in post return self.request(url, 'POST', **kwargs) File "/home/hpnroot/.local/lib/python2.7/site-packages/keystoneauth1/", line 890, in request raise exceptions.from_response(resp, method, url) keystoneauth1.exceptions.http.Unauthorized: The request you have made requires authentication. (HTTP 401) (Request-ID: req-38a8fb7a-87cc-4562-8e97-98081fbe740c)

edit retag flag offensive close merge delete


The credentials you provided are incorrect or incomplete. That’s all that can be said without knowing your Python program and your credentials.

By the way, format your code so that it is readable.

Bernd Bausch gravatar imageBernd Bausch ( 2019-04-09 16:49:13 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2019-04-10 10:23:18 -0500

Mohit gravatar image

You can refer to the official guide

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools


Asked: 2019-04-09 11:50:44 -0500

Seen: 18 times

Last updated: Apr 10