@@ -253,9 +253,6 @@ def subscribe(self):
253253 registry .subscribe (self ._create_security_group ,
254254 resources .SECURITY_GROUP ,
255255 events .AFTER_CREATE )
256- registry .subscribe (self ._delete_security_group_precommit ,
257- resources .SECURITY_GROUP ,
258- events .PRECOMMIT_DELETE )
259256 registry .subscribe (self ._delete_security_group ,
260257 resources .SECURITY_GROUP ,
261258 events .AFTER_DELETE )
@@ -268,6 +265,9 @@ def subscribe(self):
268265 registry .subscribe (self ._process_sg_rule_notification ,
269266 resources .SECURITY_GROUP_RULE ,
270267 events .BEFORE_DELETE )
268+ registry .subscribe (self ._process_sg_rule_after_del_notification ,
269+ resources .SECURITY_GROUP_RULE ,
270+ events .AFTER_DELETE )
271271
272272 def _clean_hash_ring (self , * args , ** kwargs ):
273273 admin_context = n_context .get_admin_context ()
@@ -384,14 +384,6 @@ def _create_security_group(self, resource, event, trigger, payload):
384384 self ._ovn_client .create_security_group (context ,
385385 security_group )
386386
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-
395387 def _delete_security_group (self , resource , event , trigger , payload ):
396388 context = payload .context
397389 security_group_id = payload .resource_id
@@ -449,6 +441,12 @@ def _process_sg_rule_notification(
449441 context ,
450442 sg_rule )
451443
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+
452450 def _sg_has_rules_with_same_normalized_cidr (self , sg_rule ):
453451 compare_keys = [
454452 'ethertype' , 'direction' , 'protocol' ,
0 commit comments