Merge "Create _mech_context before delete to avoid race"

This commit is contained in:
Zuul 2019-09-11 22:59:37 +00:00 committed by Gerrit Code Review
commit a190ca6b65
2 changed files with 18 additions and 2 deletions

View File

@ -1200,7 +1200,11 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
# called inside of a transaction. # called inside of a transaction.
return super(Ml2Plugin, self).delete_network(context, id) return super(Ml2Plugin, self).delete_network(context, id)
@registry.receives(resources.NETWORK, [events.PRECOMMIT_DELETE]) # NOTE(mgoddard): Use a priority of zero to ensure this handler runs before
# other precommit handlers. This is necessary to ensure we avoid another
# handler deleting a subresource of the network, e.g. segments.
@registry.receives(resources.NETWORK, [events.PRECOMMIT_DELETE],
priority=0)
def _network_delete_precommit_handler(self, rtype, event, trigger, def _network_delete_precommit_handler(self, rtype, event, trigger,
context, network_id, **kwargs): context, network_id, **kwargs):
network = self.get_network(context, network_id) network = self.get_network(context, network_id)
@ -1311,7 +1315,10 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
# called inside of a transaction. # called inside of a transaction.
return super(Ml2Plugin, self).delete_subnet(context, id) return super(Ml2Plugin, self).delete_subnet(context, id)
@registry.receives(resources.SUBNET, [events.PRECOMMIT_DELETE]) # NOTE(mgoddard): Use a priority of zero to ensure this handler runs before
# other precommit handlers. This is necessary to ensure we avoid another
# handler deleting a subresource of the subnet.
@registry.receives(resources.SUBNET, [events.PRECOMMIT_DELETE], priority=0)
def _subnet_delete_precommit_handler(self, rtype, event, trigger, def _subnet_delete_precommit_handler(self, rtype, event, trigger,
context, subnet_id, **kwargs): context, subnet_id, **kwargs):
subnet_obj = self._get_subnet_object(context, subnet_id) subnet_obj = self._get_subnet_object(context, subnet_id)

View File

@ -0,0 +1,9 @@
---
fixes:
- |
Fixes an issue where deletion of a provider network could result in ML2
mechanism drivers not being passed information about the network's provider
fields. The consequences of this depend on the mechanism driver in use, but
could result in the event being ignored, leading to an incorrectly
configured network. See `bug 1841967
<https://bugs.launchpad.net/neutron/+bug/1841967>`__ for details.