From c2e11e22c87421fbbe0e14651bde7e1776c060d7 Mon Sep 17 00:00:00 2001 From: mathieu-rohon Date: Fri, 23 May 2014 15:45:32 +0200 Subject: [PATCH] l2-pop : removing a TODO for the delete port use case since this commit : d9bcd597c67900472709cd11604afe1616e0af4e port info are accessible during the delete_post_commit Change-Id: I2c560b78c59fc178e668ae73fb994f1ef4b68dc4 --- .../plugins/ml2/drivers/l2pop/mech_driver.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/neutron/plugins/ml2/drivers/l2pop/mech_driver.py b/neutron/plugins/ml2/drivers/l2pop/mech_driver.py index 7c2719ddd..faa75256a 100644 --- a/neutron/plugins/ml2/drivers/l2pop/mech_driver.py +++ b/neutron/plugins/ml2/drivers/l2pop/mech_driver.py @@ -38,23 +38,13 @@ class L2populationMechanismDriver(api.MechanismDriver, LOG.debug(_("Experimental L2 population driver")) self.rpc_ctx = n_context.get_admin_context_without_session() self.migrated_ports = {} - self.deleted_ports = {} def _get_port_fdb_entries(self, port): return [[port['mac_address'], ip['ip_address']] for ip in port['fixed_ips']] - def delete_port_precommit(self, context): - # TODO(matrohon): revisit once the original bound segment will be - # available in delete_port_postcommit. in delete_port_postcommit - # agent_active_ports will be equal to 0, and the _update_port_down - # won't need agent_active_ports_count_for_flooding anymore - port_context = context.current - fdb_entries = self._update_port_down(context, port_context, 1) - self.deleted_ports[context.current['id']] = fdb_entries - def delete_port_postcommit(self, context): - fanout_msg = self.deleted_ports.pop(context.current['id'], None) + fanout_msg = self._update_port_down(context, context.current) if fanout_msg: l2pop_rpc.L2populationAgentNotify.remove_fdb_entries( self.rpc_ctx, fanout_msg) @@ -215,8 +205,7 @@ class L2populationMechanismDriver(api.MechanismDriver, l2pop_rpc.L2populationAgentNotify.add_fdb_entries(self.rpc_ctx, other_fdb_entries) - def _update_port_down(self, context, port_context, - agent_active_ports_count_for_flooding=0): + def _update_port_down(self, context, port_context): port_infos = self._get_port_infos(context, port_context) if not port_infos: return @@ -233,7 +222,7 @@ class L2populationMechanismDriver(api.MechanismDriver, {'segment_id': segment['segmentation_id'], 'network_type': segment['network_type'], 'ports': {agent_ip: []}}} - if agent_active_ports == agent_active_ports_count_for_flooding: + if not agent_active_ports: # Agent is removing its last activated port in this network, # other agents needs to be notified to delete their flooding entry. other_fdb_entries[network_id]['ports'][agent_ip].append( -- 2.45.2