From: Carl Baldwin Date: Tue, 19 Aug 2014 05:07:47 +0000 (+0000) Subject: Remove unused network parameter from _allocate_ips_for_port X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=64a4fadde0f8a1a6413ea5623fc30b9872896a67;p=openstack-build%2Fneutron-build.git Remove unused network parameter from _allocate_ips_for_port I found this in the context of a patch that I was reviewing [1]. I found that patch left a few loose ends and so I thought it would be better to remove the parameter as a separate refactor so that it can be carefully reviewed. The other patch [1] should be rebased to this one. [1] https://review.openstack.org/#/c/100963 Change-Id: I75115fa46ea3340ef0f13feb28ad2cdb0387fed7 --- diff --git a/neutron/db/db_base_plugin_v2.py b/neutron/db/db_base_plugin_v2.py index 34e3b1b49..ccc0fec72 100644 --- a/neutron/db/db_base_plugin_v2.py +++ b/neutron/db/db_base_plugin_v2.py @@ -426,7 +426,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2, raise n_exc.InvalidInput(error_message=msg) return fixed_ip_set - def _allocate_fixed_ips(self, context, network, fixed_ips): + def _allocate_fixed_ips(self, context, fixed_ips): """Allocate IP addresses according to the configured fixed_ips.""" ips = [] for fixed in fixed_ips: @@ -478,11 +478,10 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2, if to_add: LOG.debug(_("Port update. Adding %s"), to_add) - network = self._get_network(context, network_id) - ips = self._allocate_fixed_ips(context, network, to_add) + ips = self._allocate_fixed_ips(context, to_add) return ips, prev_ips - def _allocate_ips_for_port(self, context, network, port): + def _allocate_ips_for_port(self, context, port): """Allocate IP addresses for the port. If port['fixed_ips'] is set to 'ATTR_NOT_SPECIFIED', allocate IP @@ -497,7 +496,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2, configured_ips = self._test_fixed_ips_for_port(context, p["network_id"], p['fixed_ips']) - ips = self._allocate_fixed_ips(context, network, configured_ips) + ips = self._allocate_fixed_ips(context, configured_ips) else: filter = {'network_id': [p['network_id']]} subnets = self.get_subnets(context, filters=filter) @@ -1244,7 +1243,8 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2, tenant_id) with context.session.begin(subtransactions=True): - network = self._get_network(context, network_id) + # Ensure that the network exists. + self._get_network(context, network_id) # Ensure that a MAC address is defined and it is unique on the # network @@ -1263,7 +1263,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2, mac=p['mac_address']) # Returns the IP's for the port - ips = self._allocate_ips_for_port(context, network, port) + ips = self._allocate_ips_for_port(context, port) if 'status' not in p: status = constants.PORT_STATUS_ACTIVE