summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/fixed_ips.py7
-rw-r--r--nova/api/openstack/compute/contrib/floating_ips.py4
2 files changed, 7 insertions, 4 deletions
diff --git a/nova/api/openstack/compute/contrib/fixed_ips.py b/nova/api/openstack/compute/contrib/fixed_ips.py
index 8c7e4f7d3..b474b685d 100644
--- a/nova/api/openstack/compute/contrib/fixed_ips.py
+++ b/nova/api/openstack/compute/contrib/fixed_ips.py
@@ -31,7 +31,8 @@ class FixedIPController(object):
try:
fixed_ip = db.fixed_ip_get_by_address_detailed(context, id)
- except exception.FixedIpNotFoundForAddress as ex:
+ except (exception.FixedIpNotFoundForAddress,
+ exception.FixedIpInvalid) as ex:
raise webob.exc.HTTPNotFound(explanation=ex.format_message())
fixed_ip_info = {"fixed_ip": {}}
@@ -54,6 +55,7 @@ class FixedIPController(object):
def action(self, req, id, body):
context = req.environ['nova.context']
authorize(context)
+
if 'reserve' in body:
return self._set_reserved(context, id, True)
elif 'unreserve' in body:
@@ -67,7 +69,8 @@ class FixedIPController(object):
fixed_ip = db.fixed_ip_get_by_address(context, address)
db.fixed_ip_update(context, fixed_ip['address'],
{'reserved': reserved})
- except exception.FixedIpNotFoundForAddress:
+ except (exception.FixedIpNotFoundForAddress,
+ exception.FixedIpInvalid) as ex:
msg = _("Fixed IP %s not found") % address
raise webob.exc.HTTPNotFound(explanation=msg)
diff --git a/nova/api/openstack/compute/contrib/floating_ips.py b/nova/api/openstack/compute/contrib/floating_ips.py
index a3d03e8de..284a211cd 100644
--- a/nova/api/openstack/compute/contrib/floating_ips.py
+++ b/nova/api/openstack/compute/contrib/floating_ips.py
@@ -125,7 +125,7 @@ class FloatingIPController(object):
try:
floating_ip = self.network_api.get_floating_ip(context, id)
- except exception.NotFound:
+ except (exception.NotFound, exception.InvalidID):
msg = _("Floating ip not found for id %s") % id
raise webob.exc.HTTPNotFound(explanation=msg)
@@ -173,7 +173,7 @@ class FloatingIPController(object):
# get the floating ip object
try:
floating_ip = self.network_api.get_floating_ip(context, id)
- except exception.NotFound:
+ except (exception.NotFound, exception.InvalidID):
msg = _("Floating ip not found for id %s") % id
raise webob.exc.HTTPNotFound(explanation=msg)
address = floating_ip['address']