Browse Source

Merge "Create _mech_context before delete to avoid race"

tags/15.0.0.0b1
Zuul 1 week ago
parent
commit
a190ca6b65

+ 9
- 2
neutron/plugins/ml2/plugin.py View File

@@ -1200,7 +1200,11 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
1200 1200
         # called inside of a transaction.
1201 1201
         return super(Ml2Plugin, self).delete_network(context, id)
1202 1202
 
1203
-    @registry.receives(resources.NETWORK, [events.PRECOMMIT_DELETE])
1203
+    # NOTE(mgoddard): Use a priority of zero to ensure this handler runs before
1204
+    # other precommit handlers. This is necessary to ensure we avoid another
1205
+    # handler deleting a subresource of the network, e.g. segments.
1206
+    @registry.receives(resources.NETWORK, [events.PRECOMMIT_DELETE],
1207
+                       priority=0)
1204 1208
     def _network_delete_precommit_handler(self, rtype, event, trigger,
1205 1209
                                           context, network_id, **kwargs):
1206 1210
         network = self.get_network(context, network_id)
@@ -1311,7 +1315,10 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
1311 1315
         # called inside of a transaction.
1312 1316
         return super(Ml2Plugin, self).delete_subnet(context, id)
1313 1317
 
1314
-    @registry.receives(resources.SUBNET, [events.PRECOMMIT_DELETE])
1318
+    # NOTE(mgoddard): Use a priority of zero to ensure this handler runs before
1319
+    # other precommit handlers. This is necessary to ensure we avoid another
1320
+    # handler deleting a subresource of the subnet.
1321
+    @registry.receives(resources.SUBNET, [events.PRECOMMIT_DELETE], priority=0)
1315 1322
     def _subnet_delete_precommit_handler(self, rtype, event, trigger,
1316 1323
                                          context, subnet_id, **kwargs):
1317 1324
         subnet_obj = self._get_subnet_object(context, subnet_id)

+ 9
- 0
releasenotes/notes/fix-net-delete-race-f2fa5bac3ab35a5b.yaml View File

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

Loading…
Cancel
Save