]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Refactor to remove _recycle_ip
authorCarl Baldwin <carl.baldwin@hp.com>
Thu, 2 Jan 2014 20:56:29 +0000 (20:56 +0000)
committerCarl Baldwin <carl.baldwin@hp.com>
Thu, 6 Feb 2014 22:56:58 +0000 (22:56 +0000)
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
neutron/plugins/nicira/dbexts/nicira_networkgw_db.py

index f96edf9b0785fc36c73289ec8b557af9731d7dd5..d6adceef3692922d8e459d9268ffd07ad11d5fa7 100644 (file)
@@ -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
index fb9abb60a10033553f6c679dd6d4caf26c19dd63..61272f26a686551c9eb43622b1b8122289905866 100644 (file)
@@ -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':