]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
l2-pop : removing a TODO for the delete port use case
authormathieu-rohon <mathieu.rohon@gmail.com>
Fri, 23 May 2014 13:45:32 +0000 (15:45 +0200)
committermathieu-rohon <mathieu.rohon@gmail.com>
Wed, 28 May 2014 10:05:08 +0000 (12:05 +0200)
since this commit : d9bcd597c67900472709cd11604afe1616e0af4e
port info are accessible during the delete_post_commit

Change-Id: I2c560b78c59fc178e668ae73fb994f1ef4b68dc4

neutron/plugins/ml2/drivers/l2pop/mech_driver.py

index 7c2719ddd6ccb7450f3868342bd552d1b18afef4..faa75256acc23006b1749d4814dbf7beced2a16d 100644 (file)
@@ -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(