summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/floating_ips.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/nova/api/openstack/compute/contrib/floating_ips.py b/nova/api/openstack/compute/contrib/floating_ips.py
index f3692e02e..038e2cea5 100644
--- a/nova/api/openstack/compute/contrib/floating_ips.py
+++ b/nova/api/openstack/compute/contrib/floating_ips.py
@@ -254,6 +254,9 @@ class FloatingIPActionController(wsgi.Controller):
except exception.NoFloatingIpInterface:
msg = _('l3driver call to add floating ip failed')
raise webob.exc.HTTPBadRequest(explanation=msg)
+ except exception.FloatingIpNotFoundForAddress:
+ msg = _('floating ip not found')
+ raise webob.exc.HTTPNotFound(explanation=msg)
except Exception:
msg = _('Error. Unable to associate floating ip')
LOG.exception(msg)
@@ -277,8 +280,13 @@ class FloatingIPActionController(wsgi.Controller):
raise webob.exc.HTTPBadRequest(explanation=msg)
# get the floating ip object
- floating_ip = self.network_api.get_floating_ip_by_address(context,
- address)
+ try:
+ floating_ip = self.network_api.get_floating_ip_by_address(context,
+ address)
+ except exception.FloatingIpNotFoundForAddress:
+ msg = _("floating ip not found")
+ raise webob.exc.HTTPNotFound(explanation=msg)
+
# get the associated instance object (if any)
instance = get_instance_by_floating_ip_addr(self, context, address)