diff options
| author | Jake Dahn <admin@jakedahn.com> | 2011-08-09 22:08:37 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-08-09 22:08:37 +0000 |
| commit | 4b3165429797d40da17f5c59aaeadb00673b71b2 (patch) | |
| tree | 37c004a3a61b80414e9886b9fdfb8de357d3fa0e /nova | |
| parent | e8b0a164eb3e9021d3d1e2ab12eb31bf561e996c (diff) | |
| parent | cfa2303fcb0b59e64504d079256e4356fa3bf01f (diff) | |
This branch makes sure to detach fixed ips when their associated floating ip is deallocated from a project/tenant.
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/api/openstack/contrib/floating_ips.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/nova/api/openstack/contrib/floating_ips.py b/nova/api/openstack/contrib/floating_ips.py index 3d8049324..52c9c6cf9 100644 --- a/nova/api/openstack/contrib/floating_ips.py +++ b/nova/api/openstack/contrib/floating_ips.py @@ -18,12 +18,16 @@ from webob import exc from nova import exception +from nova import log as logging from nova import network from nova import rpc from nova.api.openstack import faults from nova.api.openstack import extensions +LOG = logging.getLogger('nova.api.openstack.contrib.floating_ips') + + def _translate_floating_ip_view(floating_ip): result = {'id': floating_ip['id'], 'ip': floating_ip['address']} @@ -97,8 +101,14 @@ class FloatingIPController(object): def delete(self, req, id): context = req.environ['nova.context'] - ip = self.network_api.get_floating_ip(context, id) + + if 'fixed_ip' in ip: + try: + self.disassociate(req, id, '') + except Exception as e: + LOG.exception(_("Error disassociating fixed_ip %s"), e) + self.network_api.release_floating_ip(context, address=ip) return {'released': { |
