Merge "Refactor to remove _recycle_ip"
This commit is contained in:
commit
f7f5692ee8
@ -319,14 +319,6 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
|||||||
return True
|
return True
|
||||||
return False
|
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,
|
def update_fixed_ip_lease_expiration(self, context, network_id,
|
||||||
ip_address, lease_remaining):
|
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)
|
to_add = self._test_fixed_ips_for_port(context, network_id, new_ips)
|
||||||
for ip in original_ips:
|
for ip in original_ips:
|
||||||
LOG.debug(_("Port update. Hold %s"), ip)
|
LOG.debug(_("Port update. Hold %s"), ip)
|
||||||
NeutronDbPluginV2._recycle_ip(context,
|
NeutronDbPluginV2._delete_ip_allocation(context,
|
||||||
network_id,
|
network_id,
|
||||||
ip['subnet_id'],
|
ip['subnet_id'],
|
||||||
ip['ip_address'])
|
ip['ip_address'])
|
||||||
|
|
||||||
if to_add:
|
if to_add:
|
||||||
LOG.debug(_("Port update. Adding %s"), 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(
|
if NeutronDbPluginV2._check_ip_in_allocation_pool(
|
||||||
context, a['subnet_id'], subnet['gateway_ip'],
|
context, a['subnet_id'], subnet['gateway_ip'],
|
||||||
a['ip_address']):
|
a['ip_address']):
|
||||||
NeutronDbPluginV2._recycle_ip(context,
|
NeutronDbPluginV2._delete_ip_allocation(context,
|
||||||
a['network_id'],
|
a['network_id'],
|
||||||
a['subnet_id'],
|
a['subnet_id'],
|
||||||
a['ip_address'])
|
a['ip_address'])
|
||||||
else:
|
else:
|
||||||
# IPs out of allocation pool will not be recycled, but
|
# IPs out of allocation pool will not be recycled, but
|
||||||
# we do need to delete the allocation from the DB
|
# we do need to delete the allocation from the DB
|
||||||
|
@ -336,9 +336,9 @@ class NetworkGatewayMixin(nvp_networkgw.NetworkGatewayPluginBase):
|
|||||||
port_id = port['id']
|
port_id = port['id']
|
||||||
# now deallocate and recycle ip from the port
|
# now deallocate and recycle ip from the port
|
||||||
for fixed_ip in port.get('fixed_ips', []):
|
for fixed_ip in port.get('fixed_ips', []):
|
||||||
self._recycle_ip(context, network_id,
|
self._delete_ip_allocation(context, network_id,
|
||||||
fixed_ip['subnet_id'],
|
fixed_ip['subnet_id'],
|
||||||
fixed_ip['ip_address'])
|
fixed_ip['ip_address'])
|
||||||
LOG.debug(_("Ensured no Ip addresses are configured on port %s"),
|
LOG.debug(_("Ensured no Ip addresses are configured on port %s"),
|
||||||
port_id)
|
port_id)
|
||||||
return {'connection_info':
|
return {'connection_info':
|
||||||
|
Loading…
Reference in New Issue
Block a user