From 90156cef695b26d6f8bcf5f7f0329effafc4e322 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Wed, 22 Dec 2021 08:37:45 +0100 Subject: [PATCH] [Stable only] Fix callback function arguments Fixes [1] and [2] for bug [3] are using new callabacks mechanism and expects payload as one of the arguments passed to the callback functions. This works fine in Xena+ releases but not in Wallaby and olders where old callbacks mechanism is still used, at least for the security group AFTER_DELETE events. So this patch fixes that by changing to the old callbacks mechanism in the logging service plugin in stable/wallaby and older branches only. Closes-Bug: #1955546 [1] https://review.opendev.org/c/openstack/neutron/+/804237 [2] https://review.opendev.org/c/openstack/neutron/+/812459 [3] https://bugs.launchpad.net/neutron/+bug/1939558 Change-Id: I0003bd566dc769436ad1342351ad058394bd52da --- neutron/services/logapi/logging_plugin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/neutron/services/logapi/logging_plugin.py b/neutron/services/logapi/logging_plugin.py index 8fbb0f8d1bd..d6fd0c979c8 100644 --- a/neutron/services/logapi/logging_plugin.py +++ b/neutron/services/logapi/logging_plugin.py @@ -58,9 +58,11 @@ class LoggingPlugin(log_ext.LoggingPluginBase): self.delete_log(context, log['id']) @registry.receives(resources.SECURITY_GROUP, [events.AFTER_DELETE]) - def _clean_logs_by_resource_id(self, resource, event, trigger, payload): + def _clean_logs_by_resource_id(self, resource, event, trigger, **kwargs): # log.resource_id == SG - self._clean_logs(payload.context.elevated(), sg_id=payload.resource_id) + context = kwargs['context'] + sg_id = kwargs['security_group_id'] + self._clean_logs(context.elevated(), sg_id=sg_id) @registry.receives(resources.PORT, [events.AFTER_DELETE]) def _clean_logs_by_target_id(self, resource, event, trigger, **kwargs):