From 55455dbfa44afe181dc3ce29bb0ead878336aa3c Mon Sep 17 00:00:00 2001 From: Carl Baldwin Date: Thu, 2 Jan 2014 20:56:29 +0000 Subject: [PATCH] Refactor to remove _recycle_ip Since _recycle_ip is now just a pass-through to _delete_ip_allocation it can be removed. Change-Id: Ifba3da902de599f748038a33ef3bd98ff77c22b9 Closes-Bug: #1269501 --- neutron/db/db_base_plugin_v2.py | 24 +++++++------------ .../nicira/dbexts/nicira_networkgw_db.py | 6 ++--- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/neutron/db/db_base_plugin_v2.py b/neutron/db/db_base_plugin_v2.py index f96edf9b0..d6adceef3 100644 --- a/neutron/db/db_base_plugin_v2.py +++ b/neutron/db/db_base_plugin_v2.py @@ -319,14 +319,6 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2, return True return False - @staticmethod - def _recycle_ip(context, network_id, subnet_id, ip_address): - """Return an IP address to the pool of free IP's on the network - subnet. - """ - NeutronDbPluginV2._delete_ip_allocation(context, network_id, subnet_id, - ip_address) - def update_fixed_ip_lease_expiration(self, context, network_id, ip_address, lease_remaining): @@ -641,10 +633,10 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2, to_add = self._test_fixed_ips_for_port(context, network_id, new_ips) for ip in original_ips: LOG.debug(_("Port update. Hold %s"), ip) - NeutronDbPluginV2._recycle_ip(context, - network_id, - ip['subnet_id'], - ip['ip_address']) + NeutronDbPluginV2._delete_ip_allocation(context, + network_id, + ip['subnet_id'], + ip['ip_address']) if to_add: LOG.debug(_("Port update. Adding %s"), to_add) @@ -1402,10 +1394,10 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2, if NeutronDbPluginV2._check_ip_in_allocation_pool( context, a['subnet_id'], subnet['gateway_ip'], a['ip_address']): - NeutronDbPluginV2._recycle_ip(context, - a['network_id'], - a['subnet_id'], - a['ip_address']) + NeutronDbPluginV2._delete_ip_allocation(context, + a['network_id'], + a['subnet_id'], + a['ip_address']) else: # IPs out of allocation pool will not be recycled, but # we do need to delete the allocation from the DB diff --git a/neutron/plugins/nicira/dbexts/nicira_networkgw_db.py b/neutron/plugins/nicira/dbexts/nicira_networkgw_db.py index fb9abb60a..61272f26a 100644 --- a/neutron/plugins/nicira/dbexts/nicira_networkgw_db.py +++ b/neutron/plugins/nicira/dbexts/nicira_networkgw_db.py @@ -336,9 +336,9 @@ class NetworkGatewayMixin(nvp_networkgw.NetworkGatewayPluginBase): port_id = port['id'] # now deallocate and recycle ip from the port for fixed_ip in port.get('fixed_ips', []): - self._recycle_ip(context, network_id, - fixed_ip['subnet_id'], - fixed_ip['ip_address']) + self._delete_ip_allocation(context, network_id, + fixed_ip['subnet_id'], + fixed_ip['ip_address']) LOG.debug(_("Ensured no Ip addresses are configured on port %s"), port_id) return {'connection_info': -- 2.45.2