From: Gary Kotton Date: Tue, 13 Nov 2012 00:12:45 +0000 (+0000) Subject: Ensure that deleted gateway IP address is recycled correctly X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=52bcd19e0b6de3f7c765c2d101bef8a498f1483b;p=openstack-build%2Fneutron-build.git Ensure that deleted gateway IP address is recycled correctly Fixes bug 1079980 Change-Id: I6819899cae6f366423ade70613c85fd84d1a270d --- diff --git a/quantum/db/db_base_plugin_v2.py b/quantum/db/db_base_plugin_v2.py index cce4e07aa..048873564 100644 --- a/quantum/db/db_base_plugin_v2.py +++ b/quantum/db/db_base_plugin_v2.py @@ -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) diff --git a/quantum/tests/unit/test_db_plugin.py b/quantum/tests/unit/test_db_plugin.py index 281fee836..58d15195f 100644 --- a/quantum/tests/unit/test_db_plugin.py +++ b/quantum/tests/unit/test_db_plugin.py @@ -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'