summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-09-27 16:47:43 +0000
committerGerrit Code Review <review@openstack.org>2012-09-27 16:47:43 +0000
commit3ea56ce6c8d0dd6f1671e4519423c4dcce235b7a (patch)
tree2f524a7fb3977e7c75ba4c2fc3698263cd8d6b8e /nova/api
parent1328318e36969aa9ba595a6f2634618b6d658c32 (diff)
parentbe4f059aa225fde6170f75a1abd338cadc351ef2 (diff)
downloadnova-3ea56ce6c8d0dd6f1671e4519423c4dcce235b7a.tar.gz
nova-3ea56ce6c8d0dd6f1671e4519423c4dcce235b7a.tar.xz
nova-3ea56ce6c8d0dd6f1671e4519423c4dcce235b7a.zip
Merge "Modified 404 error response to show specific message"
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/floating_ips.py9
-rw-r--r--nova/api/openstack/volume/volumes.py7
2 files changed, 13 insertions, 3 deletions
diff --git a/nova/api/openstack/compute/contrib/floating_ips.py b/nova/api/openstack/compute/contrib/floating_ips.py
index be952eb8a..7b9ff8988 100644
--- a/nova/api/openstack/compute/contrib/floating_ips.py
+++ b/nova/api/openstack/compute/contrib/floating_ips.py
@@ -140,7 +140,8 @@ class FloatingIPController(object):
try:
floating_ip = self.network_api.get_floating_ip(context, id)
except exception.NotFound:
- raise webob.exc.HTTPNotFound()
+ msg = _("Floating ip not found for id %s") % id
+ raise webob.exc.HTTPNotFound(explanation=msg)
self._set_metadata(context, floating_ip)
@@ -184,7 +185,11 @@ class FloatingIPController(object):
authorize(context)
# get the floating ip object
- floating_ip = self.network_api.get_floating_ip(context, id)
+ try:
+ floating_ip = self.network_api.get_floating_ip(context, id)
+ except exception.NotFound:
+ msg = _("Floating ip not found for id %s") % id
+ raise webob.exc.HTTPNotFound(explanation=msg)
address = floating_ip['address']
# get the associated instance object (if any)
diff --git a/nova/api/openstack/volume/volumes.py b/nova/api/openstack/volume/volumes.py
index 6cc4af899..e13f04036 100644
--- a/nova/api/openstack/volume/volumes.py
+++ b/nova/api/openstack/volume/volumes.py
@@ -274,7 +274,8 @@ class VolumeController(wsgi.Controller):
def create(self, req, body):
"""Creates a new volume."""
if not self.is_valid_body(body, 'volume'):
- raise exc.HTTPUnprocessableEntity()
+ msg = _("Invalid request body. 'volume' not found")
+ raise exc.HTTPUnprocessableEntity(explanation=msg)
context = req.environ['nova.context']
volume = body['volume']
@@ -302,6 +303,10 @@ class VolumeController(wsgi.Controller):
if size is None and kwargs['snapshot'] is not None:
size = kwargs['snapshot']['volume_size']
+ if size is None:
+ msg = _("Invalid request body. 'size' not found")
+ raise exc.HTTPUnprocessableEntity(explanation=msg)
+
LOG.audit(_("Create volume of %s GB"), size, context=context)
image_href = None