summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorChris Yeoh <cyeoh@au1.ibm.com>2013-05-22 21:52:25 +0930
committerChris Yeoh <cyeoh@au1.ibm.com>2013-05-22 22:57:22 +0930
commit8eede5e9814f3305e0bb66eeb93623ba25b16e9a (patch)
tree150ebf08b3b06be9d88ca9cd70cae61503f1180b /nova/api
parentd6f2611285382bc59ba0ff23518c4f0b08fb4855 (diff)
Catch InstanceNotFound in instance_actions GET
Catch the InstanceNotFound exception in the instance_actions index function and handle the error gracefully so a stacktrace is not generated in the log files. This patch does not change the API Fixes bug 1182867 Change-Id: I0764f8abda7176deefe0d103bd86acd0af78780d
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/instance_actions.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/nova/api/openstack/compute/contrib/instance_actions.py b/nova/api/openstack/compute/contrib/instance_actions.py
index 4eaa9a1ee..3b15de2ba 100644
--- a/nova/api/openstack/compute/contrib/instance_actions.py
+++ b/nova/api/openstack/compute/contrib/instance_actions.py
@@ -19,6 +19,7 @@ from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova import compute
+from nova import exception
authorize_actions = extensions.extension_authorizer('compute',
'instance_actions')
@@ -84,7 +85,10 @@ class InstanceActionsController(wsgi.Controller):
def index(self, req, server_id):
"""Returns the list of actions recorded for a given instance."""
context = req.environ["nova.context"]
- instance = self.compute_api.get(context, server_id)
+ try:
+ instance = self.compute_api.get(context, server_id)
+ except exception.InstanceNotFound as err:
+ raise exc.HTTPNotFound(explanation=err.format_message())
authorize_actions(context, target=instance)
actions_raw = self.action_api.actions_get(context, instance)
actions = [self._format_action(action) for action in actions_raw]