[openstack-dev] [nova] server.name raise AttributeError

Gareth academicgareth at gmail.com
Sat Mar 15 16:20:37 UTC 2014

Hey, Nova guys

   File "/opt/stack/python-novaclient/novaclient/v1_1/servers.py",
line 39, in __repr__
     return "<Server: %s>" % self.name
   File "/opt/stack/python-novaclient/novaclient/openstack/common/apiclient/base.py",
line 461, in __getattr__
   File "/opt/stack/python-novaclient/novaclient/openstack/common/apiclient/base.py",
line 479, in get
     new = self.manager.get(self.id)
   File "/opt/stack/python-novaclient/novaclient/v1_1/servers.py",
line 543, in get
     return self._get("/servers/%s" % base.getid(server), "server")
   File "/opt/stack/python-novaclient/novaclient/base.py", line 147, in _get
     _resp, body = self.api.client.get(url)
   File "/opt/stack/python-novaclient/novaclient/client.py", line 283, in get
     return self._cs_request(url, 'GET', **kwargs)
   File "/opt/stack/python-novaclient/novaclient/client.py", line 260,
in _cs_request
   File "/opt/stack/python-novaclient/novaclient/client.py", line 242,
in _time_request
     resp, body = self.request(url, method, **kwargs)
   File "/opt/stack/python-novaclient/novaclient/client.py", line 236,
in request
     raise exceptions.from_response(resp, body, url, method)
 NotFound: Instance could not be found (HTTP 404) (Request-ID:

Looking this trace stack, we could know that I have a *server* object, and
when called server.name, the *server* went to lazy load. That means this
*server* object doesn't
have name AttributeError from initializing. And all attributes of
*server*are from nova api response. That is the response against nova
api didn't contain name
keyword. So what case would make this happened?

The following 404 error is understandable. In that runtime, my codes are
trying to deleting a server. So during the lazy loading, the server has
been already deleted which
results that 404 error.

My question is about that "self.name". Why does such a server object miss
the "name" attribute?


*Cloud Computing, OpenStack, Distributed Storage, Fitness, Basketball*
*OpenStack contributor, kun_huang at freenode*
*My promise: if you find any spelling or grammar mistakes in my email from
Mar 1 2013, notify me *
*and I'll donate $1 or ¥1 to an open organization you specify.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140316/44c29848/attachment.html>

More information about the OpenStack-dev mailing list