diff options
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/floating_ips.py | 9 | ||||
| -rw-r--r-- | nova/api/openstack/volume/volumes.py | 7 |
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 |
