Getting attributes of a OS::Nova::Server raises a 500 if the server doesn't exist

Bug #1279085 reported by cyli
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
huangtianhua

Bug Description

Getting attributes of a OS::Nova::Server raises a 500 if the server doesn't exist.

Created a stack with a single server resource. Specified the public IP (accessIPv4) as an output. Stack show works.

Deleted the server out of band using nova.

Stack show returns a 500 with the following:

{
    "explanation": "The server has either erred or is incapable of performing the requested operation.",
    "code": 500,
    "error": {
        "message": "Remote error: NotFound Instance could not be found (HTTP 404) (Request-ID: req-742d8c87-4724-4ba7-9505-b01d21dfaa83)",
        "traceback": "[u'Traceback (most recent call last):\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/openstack/common/rpc/amqp.py\", line 462, in _process_data\\n **args)\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/openstack/common/rpc/dispatcher.py\", line 172, in dispatch\\n result = getattr(proxyobj, method)(ctxt, **kwargs)\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/engine/service.py\", line 63, in wrapped\\n return func(self, ctx, *args, **kwargs)\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/engine/service.py\", line 281, in show_stack\\n return [format_stack_detail(s) for s in stacks]\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/engine/service.py\", line 279, in format_stack_detail\\n return api.format_stack(stack)\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/engine/api.py\", line 98, in format_stack\\n info[api.STACK_OUTPUTS] = format_stack_outputs(stack, stack.outputs)\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/engine/api.py\", line 71, in format_stack_outputs\\n return [format_stack_output(key) for key in outputs]\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/engine/api.py\", line 69, in format_stack_output\\n api.OUTPUT_VALUE: stack.output(k)}\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/engine/parser.py\", line 697, in output\\n return self.resolve_runtime_data(value)\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/engine/parser.py\", line 754, in resolve_runtime_data\\n return resolve_runtime_data(self.t, self.resources, snippet)\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/engine/parser.py\", line 792, in resolve_runtime_data\\n template.resolve_base64])\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/engine/parser.py\", line 804, in transform\\n data = t(data, transform=sub_transform)\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/engine/hot.py\", line 201, in resolve_attributes\\n transform)\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/engine/template.py\", line 498, in _resolve\\n return handle(transform(v))\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/engine/hot.py\", line 186, in handle_get_attr\\n attr = r.FnGetAtt(rsrc_attr)\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/engine/resource.py\", line 861, in FnGetAtt\\n return self.attributes[key]\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/engine/attributes.py\", line 87, in __getitem__\\n return self._resolver(key)\\n', u' File \"/opt/heat/lib/heat/cloud_server.py\", line 402, in _resolve_attribute\\n return super(CloudServer, self)._resolve_attribute(name)\\n', u' File \"/opt/heat/lib/python2.7/site-packages/heat/engine/resources/server.py\", line 426, in _resolve_attribute\\n server = self.nova().servers.get(self.resource_id)\\n', u' File \"/opt/heat/lib/python2.7/site-packages/novaclient/v1_1/servers.py\", line 370, in get\\n return self._get(\"/servers/%s\" % base.getid(server), \"server\")\\n', u' File \"/opt/heat/lib/python2.7/site-packages/novaclient/base.py\", line 140, in _get\\n _resp, body = self.api.client.get(url)\\n', u' File \"/opt/heat/lib/python2.7/site-packages/novaclient/client.py\", line 229, in get\\n return self._cs_request(url, \\'GET\\', **kwargs)\\n', u' File \"/opt/heat/lib/python2.7/site-packages/novaclient/client.py\", line 213, in _cs_request\\n **kwargs)\\n', u' File \"/opt/heat/lib/python2.7/site-packages/novaclient/client.py\", line 195, in _time_request\\n resp, body = self.request(url, method, **kwargs)\\n', u' File \"/opt/heat/lib/python2.7/site-packages/novaclient/client.py\", line 189, in request\\n raise exceptions.from_response(resp, body, url, method)\\n', u'NotFound: Instance could not be found (HTTP 404) (Request-ID: req-742d8c87-4724-4ba7-9505-b01d21dfaa83)\\n'].",
        "type": "RemoteError"
    },
    "title": "Internal Server Error"
}

Updated stack to remove the outputs. Stack show works again.

cyli (cyli)
summary: - stack-show details fails with a 500 when a resource has been deleted
- from under it
+ Getting attributes of a OS::Nova::Server raises a 500 if the server
+ doesn't exist
Changed in heat:
assignee: nobody → huangtianhua (huangtianhua)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/76429

Changed in heat:
status: New → In Progress
Steven Hardy (shardy)
Changed in heat:
milestone: none → icehouse-rc1
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/76429
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=e811accb73de4c3780ca4110983b0c28776f3055
Submitter: Jenkins
Branch: master

commit e811accb73de4c3780ca4110983b0c28776f3055
Author: huangtianhua <email address hidden>
Date: Wed Feb 26 11:56:06 2014 +0800

    Fix InternalException raised on stack-show

    Getting attributes of a OS::Nova::Server raises a 500 error if the server
    doesn't exist. So stack show doesn't work. We should catch the exception
    and return the default values of the output keys of the server while
    getting attributes to make sure the api works.

    Change-Id: If569b4d73abbce93d3c56c45a1eb284720c6e416
    Closes-Bug: #1279085

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: icehouse-rc1 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.