From ac718804de7cb2766420ed1eff4e4bc10190fb1c Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Thu, 20 Jan 2022 15:40:05 +0100 Subject: [PATCH] Add extra logs around enabling/disabling nova notifier code I should helps with debugging why the nova notifier is at some point disabled for one neutron worker thus notifications aren't send to nova from that worker. Related-Bug: #1958363 Change-Id: Ifd88d5bc7515b5f29240bd12be1d3257b308fd67 --- neutron/notifiers/nova.py | 4 ++++ neutron/plugins/ml2/plugin.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/neutron/notifiers/nova.py b/neutron/notifiers/nova.py index 5165cb4ac0a..0f45e9837ad 100644 --- a/neutron/notifiers/nova.py +++ b/neutron/notifiers/nova.py @@ -73,10 +73,14 @@ class Notifier(object): @contextlib.contextmanager def context_enabled(self, enabled): stored_enabled = self._enabled + LOG.debug("nova notifier stored_enabled: %s; enabled: %s", + stored_enabled, enabled) try: self._enabled = enabled yield finally: + LOG.debug("Restoring value: %s for the _enabled flag.", + stored_enabled) self._enabled = stored_enabled def _get_nova_client(self): diff --git a/neutron/plugins/ml2/plugin.py b/neutron/plugins/ml2/plugin.py index 011baf48955..c99b3fa4838 100644 --- a/neutron/plugins/ml2/plugin.py +++ b/neutron/plugins/ml2/plugin.py @@ -364,8 +364,14 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2, send_nova_event = bool(trigger == provisioning_blocks.L2_AGENT_ENTITY) with self.nova_notifier.context_enabled(send_nova_event): + LOG.debug("Updating port %s status to %s; " + "nova_notifier enabled: %s", + port_id, const.PORT_STATUS_ACTIVE, send_nova_event) self.update_port_status(payload.context, port_id, const.PORT_STATUS_ACTIVE) + LOG.debug("After port %s status update nova_notifier is now " + "restored to old value: %s", + port_id, self.nova_notifier._enabled) else: self.update_port_status(payload.context, port_id, const.PORT_STATUS_ACTIVE)