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
This commit is contained in:
Slawek Kaplonski 2022-01-20 15:40:05 +01:00
parent 9672df6461
commit ac718804de
2 changed files with 10 additions and 0 deletions

View File

@ -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):

View File

@ -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)