]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Ensure that deleted gateway IP address is recycled correctly
authorGary Kotton <gkotton@redhat.com>
Tue, 13 Nov 2012 00:12:45 +0000 (00:12 +0000)
committerGary Kotton <gkotton@redhat.com>
Tue, 13 Nov 2012 06:58:46 +0000 (06:58 +0000)
Fixes bug 1079980

Change-Id: I6819899cae6f366423ade70613c85fd84d1a270d

quantum/db/db_base_plugin_v2.py
quantum/tests/unit/test_db_plugin.py

index cce4e07aac1d2c22b98030ae7bd2b6b5e2107ddb..048873564447b753d63d632d6058b02a128eaad3 100644 (file)
@@ -495,7 +495,8 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
         """
         # Check if the IP is the gateway
         if ip_address == gateway_ip:
-            return True
+            # Gateway is not in allocation pool
+            return False
 
         # Check if the requested IP is in a defined allocation pool
         pool_qry = context.session.query(models_v2.IPAllocationPool)
index 281fee836b9f6ee53ea378dc1eb701b6664d6a1b..58d15195f50c8d348b4a8d90e97fa6a134ab5f11 100644 (file)
@@ -2197,6 +2197,7 @@ class TestSubnetsV2(QuantumDbPluginV2TestCase):
                                  allocation_pools=allocation_pools)
 
     def test_subnet_with_allocation_range(self):
+        cfg.CONF.set_override('dhcp_lease_duration', 0)
         fmt = 'json'
         with self.network() as network:
             net_id = network['network']['id']
@@ -2229,6 +2230,7 @@ class TestSubnetsV2(QuantumDbPluginV2TestCase):
             port_id = port['port']['id']
             # delete the port
             self._delete('ports', port['port']['id'])
+        cfg.CONF.set_override('dhcp_lease_duration', 120)
 
     def test_create_subnet_with_none_gateway_allocation_pool(self):
         cidr = '10.0.0.0/24'