The ML2 plugin calls the bind_port() operation on the registered mechanism drivers in order to establish a binding for a neutron port (i.e. determining the binding:vif_type and what network segment is being used). It currently makes these calls from within a DB transaction. This is fine for mechanism drivers such as those for the L2 agents that base their binding decision solely on information from the neutron DB. But if mechanism drivers for controllers or devices need to make remote calls to determine if binding is possible, they should not do this from within a DB transaction. Therefore, the bind_port() call must be made by the plugin outside of any enclosing DB transaction, and the drivers should manage any needed DB transactions themselves.
Once [re]binding is moved outside the DB transaction that triggers it, the possibility that multiple threads or processes will concurrently try to bind the same port must also be addressed.
Details of planned fix are at https:/ /docs.google. com/document/ d/1k8tAqfQr8Ujz x5TzpXTYEUaym- 0U-pE3YL9wjrS8c Dg.