summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-05-15 22:41:11 +0000
committerGerrit Code Review <review@openstack.org>2012-05-15 22:41:11 +0000
commitcaf7461aff60ef68a366ab329f136d09e19d9b0b (patch)
treebe3f7c2ccb83f9f703df3f50ecab149756bae5e5
parent94108a8a0994590a68613a149709ff0c8afe6fe9 (diff)
parent627522525e0268a1bc54695ce3dedf16d6fb413d (diff)
downloadnova-caf7461aff60ef68a366ab329f136d09e19d9b0b.tar.gz
nova-caf7461aff60ef68a366ab329f136d09e19d9b0b.tar.xz
nova-caf7461aff60ef68a366ab329f136d09e19d9b0b.zip
Merge "Fix bug 988034 - Quantum Network Manager - not clearing ips"
-rw-r--r--Authors1
-rw-r--r--nova/network/quantum/manager.py8
-rw-r--r--nova/network/quantum/nova_ipam_lib.py15
3 files changed, 16 insertions, 8 deletions
diff --git a/Authors b/Authors
index 09986ccba..5c5df3d61 100644
--- a/Authors
+++ b/Authors
@@ -181,6 +181,7 @@ Sandy Walsh <sandy.walsh@rackspace.com>
Sateesh Chodapuneedi <sateesh.chodapuneedi@citrix.com>
Scott Moser <smoser@ubuntu.com>
Sean Dague <sdague@linux.vnet.ibm.com>
+Somik Behera <somikbehera@gmail.com>
Soren Hansen <soren.hansen@rackspace.com>
Stanislaw Pitucha <stanislaw.pitucha@hp.com>
Stephanie Reese <reese.sm@gmail.com>
diff --git a/nova/network/quantum/manager.py b/nova/network/quantum/manager.py
index 001cdf767..c034b5e2a 100644
--- a/nova/network/quantum/manager.py
+++ b/nova/network/quantum/manager.py
@@ -723,14 +723,6 @@ class QuantumManager(manager.FloatingIP, manager.FlatManager):
if not (is_tenant_net or is_provider_net):
raise exception.NetworkNotFound(network_id=net_id)
- # NOTE(bgh): deallocate_for_instance will take care of this.. The reason
- # we're providing this is so that NetworkManager::release_fixed_ip() isn't
- # called. It does some database operations that we don't want to happen
- # and since the majority of the stuff that it does is already taken care
- # of in our deallocate_for_instance call we don't need to do anything.
- def release_fixed_ip(self, context, address):
- pass
-
def get_dhcp_hosts_text(self, context, subnet_id, project_id=None):
ips = self.ipam.get_allocated_ips(context, subnet_id, project_id)
hosts_text = ""
diff --git a/nova/network/quantum/nova_ipam_lib.py b/nova/network/quantum/nova_ipam_lib.py
index 71b297d2a..88c0ed95c 100644
--- a/nova/network/quantum/nova_ipam_lib.py
+++ b/nova/network/quantum/nova_ipam_lib.py
@@ -47,6 +47,10 @@ class QuantumNovaIPAMLib(object):
"""
self.net_manager = net_manager
+ # NOTE(s0mik) : If DHCP is not in use, we need to timeout IPs
+ # periodically. See comment in deallocate_ips_by_vif for more
+ self.net_manager.timeout_fixed_ips = not self.net_manager.DHCP
+
def create_subnet(self, context, label, tenant_id,
quantum_net_id, priority, cidr=None,
gateway=None, gateway_v6=None, cidr_v6=None,
@@ -213,6 +217,17 @@ class QuantumNovaIPAMLib(object):
admin_context = context.elevated()
fixed_ips = db.fixed_ips_by_virtual_interface(admin_context,
vif_ref['id'])
+ # NOTE(s0mik): Sets fixed-ip to deallocated, but leaves the entry
+ # associated with the instance-id. This prevents us from handing it
+ # out again immediately, as allocating it to a new instance before
+ # a DHCP lease has timed-out is bad. Instead, the fixed-ip will
+ # be disassociated with the instance-id by a call to one of two
+ # methods inherited from FlatManager:
+ # - if DHCP is in use, a lease expiring in dnsmasq triggers
+ # a call to release_fixed_ip in the network manager.
+ # - otherwise, _disassociate_stale_fixed_ips is called periodically
+ # to disassociate all fixed ips that are unallocated
+ # but still associated with an instance-id.
for fixed_ip in fixed_ips:
db.fixed_ip_update(admin_context, fixed_ip['address'],
{'allocated': False,