summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorHans Lindgren <hanlind@kth.se>2013-03-12 15:30:53 +0100
committerHans Lindgren <hanlind@kth.se>2013-03-14 21:11:20 +0100
commitd786517ad1dbd4e59382de241074c5dc454bd365 (patch)
treead424bc3fbe94a295f4e02d36fdec3fffe92fc60 /nova/api
parent562b0787421b145c4a91ccbbcacfc74c340cead8 (diff)
Fix: improve API error responses from os-hosts extension
Modify responses to include the actual host instead of %(host)s. Resolves bug 1154117. Change-Id: Ic680403bdf1cb1fc1ac184352f486390fb04a195
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/hosts.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/nova/api/openstack/compute/contrib/hosts.py b/nova/api/openstack/compute/contrib/hosts.py
index 3ecfb9965..409603691 100644
--- a/nova/api/openstack/compute/contrib/hosts.py
+++ b/nova/api/openstack/compute/contrib/hosts.py
@@ -200,7 +200,7 @@ class HostController(object):
msg = _("Virt driver does not implement host maintenance mode.")
raise webob.exc.HTTPNotImplemented(explanation=msg)
except exception.NotFound as e:
- raise webob.exc.HTTPNotFound(explanation=e.message)
+ raise webob.exc.HTTPNotFound(explanation=unicode(e))
if result not in ("on_maintenance", "off_maintenance"):
raise webob.exc.HTTPBadRequest(explanation=result)
return result
@@ -220,7 +220,7 @@ class HostController(object):
msg = _("Virt driver does not implement host disabled status.")
raise webob.exc.HTTPNotImplemented(explanation=msg)
except exception.NotFound as e:
- raise webob.exc.HTTPNotFound(explanation=e.message)
+ raise webob.exc.HTTPNotFound(explanation=unicode(e))
if result not in ("enabled", "disabled"):
raise webob.exc.HTTPBadRequest(explanation=result)
return result
@@ -236,7 +236,7 @@ class HostController(object):
msg = _("Virt driver does not implement host power management.")
raise webob.exc.HTTPNotImplemented(explanation=msg)
except exception.NotFound as e:
- raise webob.exc.HTTPNotFound(explanation=e.message)
+ raise webob.exc.HTTPNotFound(explanation=unicode(e))
return {"host": host_name, "power_action": result}
@wsgi.serializers(xml=HostActionTemplate)
@@ -317,7 +317,7 @@ class HostController(object):
try:
service = self.api.service_get_by_compute_host(context, host_name)
except exception.NotFound as e:
- raise webob.exc.HTTPNotFound(explanation=e.message)
+ raise webob.exc.HTTPNotFound(explanation=unicode(e))
except exception.AdminRequired:
msg = _("Describe-resource is admin only functionality")
raise webob.exc.HTTPForbidden(explanation=msg)