diff options
| author | Sirisha Devineni <sirisha_devineni@persistent.co.in> | 2012-10-08 19:39:15 +0530 |
|---|---|---|
| committer | Sirisha Devineni <sirisha_devineni@persistent.co.in> | 2012-10-09 18:12:22 +0530 |
| commit | ce04b13f26169e2d71b7d3122d3a769cb4348bf7 (patch) | |
| tree | f437afa8c818c6f84adeb5803c319fe9299d4063 /nova/api | |
| parent | fb101685cc14ed9b0396ce966e571d3fb457c32f (diff) | |
| download | nova-ce04b13f26169e2d71b7d3122d3a769cb4348bf7.tar.gz nova-ce04b13f26169e2d71b7d3122d3a769cb4348bf7.tar.xz nova-ce04b13f26169e2d71b7d3122d3a769cb4348bf7.zip | |
Dis-associate an auto-assigned floating IP should return proper warning
Added new exception class CannotDissociateAutoAssignedFloatingIP and raised
exception instead of return.
Fixes bug 1061499
Change-Id: I348573a235c6b81653837267072b5c48fa15b8af
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/cloud.py | 3 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/floating_ips.py | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index aa7e880df..6cbaf2309 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -1196,6 +1196,9 @@ class CloudController(object): except exception.FloatingIpNotAssociated: msg = _('Floating ip is not associated.') raise exception.EC2APIError(msg) + except exception.CannotDisassociateAutoAssignedFloatingIP: + msg = _('Cannot disassociate auto assigned floating ip') + raise exception.EC2APIError(msg) return {'return': "true"} diff --git a/nova/api/openstack/compute/contrib/floating_ips.py b/nova/api/openstack/compute/contrib/floating_ips.py index 1c17591a4..c10546267 100644 --- a/nova/api/openstack/compute/contrib/floating_ips.py +++ b/nova/api/openstack/compute/contrib/floating_ips.py @@ -96,6 +96,9 @@ def disassociate_floating_ip(self, context, instance, address): except exception.FloatingIpNotAssociated: msg = _('Floating ip is not associated') raise webob.exc.HTTPBadRequest(explanation=msg) + except exception.CannotDisassociateAutoAssignedFloatingIP: + msg = _('Cannot disassociate auto assigned floating ip') + raise webob.exc.HTTPForbidden(explanation=msg) class FloatingIPController(object): |
