@@ -253,9 +253,6 @@ def subscribe(self):
253
253
registry .subscribe (self ._create_security_group ,
254
254
resources .SECURITY_GROUP ,
255
255
events .AFTER_CREATE )
256
- registry .subscribe (self ._delete_security_group_precommit ,
257
- resources .SECURITY_GROUP ,
258
- events .PRECOMMIT_DELETE )
259
256
registry .subscribe (self ._delete_security_group ,
260
257
resources .SECURITY_GROUP ,
261
258
events .AFTER_DELETE )
@@ -268,6 +265,9 @@ def subscribe(self):
268
265
registry .subscribe (self ._process_sg_rule_notification ,
269
266
resources .SECURITY_GROUP_RULE ,
270
267
events .BEFORE_DELETE )
268
+ registry .subscribe (self ._process_sg_rule_after_del_notification ,
269
+ resources .SECURITY_GROUP_RULE ,
270
+ events .AFTER_DELETE )
271
271
272
272
def _clean_hash_ring (self , * args , ** kwargs ):
273
273
admin_context = n_context .get_admin_context ()
@@ -384,14 +384,6 @@ def _create_security_group(self, resource, event, trigger, payload):
384
384
self ._ovn_client .create_security_group (context ,
385
385
security_group )
386
386
387
- def _delete_security_group_precommit (self , resource , event , trigger ,
388
- payload ):
389
- context = n_context .get_admin_context ()
390
- security_group_id = payload .resource_id
391
- for sg_rule in self ._plugin .get_security_group_rules (
392
- context , filters = {'remote_group_id' : [security_group_id ]}):
393
- self ._ovn_client .delete_security_group_rule (context , sg_rule )
394
-
395
387
def _delete_security_group (self , resource , event , trigger , payload ):
396
388
context = payload .context
397
389
security_group_id = payload .resource_id
@@ -449,6 +441,12 @@ def _process_sg_rule_notification(
449
441
context ,
450
442
sg_rule )
451
443
444
+ def _process_sg_rule_after_del_notification (
445
+ self , resource , event , trigger , payload ):
446
+ context = payload .context
447
+ sg_rule = payload .metadata ['rule' ]
448
+ self ._ovn_client .delete_security_group_rule (context , sg_rule )
449
+
452
450
def _sg_has_rules_with_same_normalized_cidr (self , sg_rule ):
453
451
compare_keys = [
454
452
'ethertype' , 'direction' , 'protocol' ,
0 commit comments