diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-10-01 21:54:35 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-10-01 21:54:35 +0000 |
| commit | 14cfc19381b7f923b9c0e174038810a1a1aec5dc (patch) | |
| tree | bb71eda1c772ab494415edb08a5d79cdcd5cbb77 /nova/api | |
| parent | 8a332ea285f824ed3b19e05543ce53e44c329860 (diff) | |
| parent | 9a303f2cc231f5d43257ebced5b1167c08d32648 (diff) | |
| download | nova-14cfc19381b7f923b9c0e174038810a1a1aec5dc.tar.gz nova-14cfc19381b7f923b9c0e174038810a1a1aec5dc.tar.xz nova-14cfc19381b7f923b9c0e174038810a1a1aec5dc.zip | |
Merge "Catch NotFound exception in FloatingIP add/remove"
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/floating_ips.py | 12 |
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 7b9ff8988..1c17591a4 100644 --- a/nova/api/openstack/compute/contrib/floating_ips.py +++ b/nova/api/openstack/compute/contrib/floating_ips.py @@ -259,6 +259,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) @@ -282,8 +285,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) |
