Adapt SG payload implementation

Change-Id: Icdce873757ecbce3f9c2eaa9ccfc2f4f8a22d124
This commit is contained in:
Kobi Samoray 2021-06-29 10:54:39 +03:00
parent 70d1156b26
commit f54c9cf148

View File

@ -489,14 +489,15 @@ def _validate_network_has_subnet(resource, event, trigger, payload=None):
raise n_exc.InvalidInput(error_message=msg) raise n_exc.InvalidInput(error_message=msg)
def _delete_sg_group_related_rules(resource, event, trigger, **kwargs): def _delete_sg_group_related_rules(resource, event, trigger, payload):
"""Upon SG deletion, call the explicit delete method for rules with that """Upon SG deletion, call the explicit delete method for rules with that
SG as the remote one. SG as the remote one.
Otherwise those will be deleted with on_delete cascade, leaving the NSX Otherwise those will be deleted with on_delete cascade, leaving the NSX
backend unaware. backend unaware.
""" """
sg_id = kwargs["security_group"]["id"] security_group = payload.latest_state
context = kwargs["context"] context = payload.context
sg_id = security_group["id"]
core_plugin = directory.get_plugin() core_plugin = directory.get_plugin()
filters = {'remote_group_id': [sg_id]} filters = {'remote_group_id': [sg_id]}
rules = core_plugin.get_security_group_rules(context, filters=filters) rules = core_plugin.get_security_group_rules(context, filters=filters)