From 1a1c40be5bdc274919ffaf28afd985f1ef86d33a Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Tue, 19 Dec 2023 09:23:42 +0000 Subject: [PATCH] node-proxy: enhance debug log messages for locking operations This commit updates the debug log messages in the BaseRedfishSystem and Reporter classes. The adjustments made enhance the clarity and precision of the messages by specifically identifying acquired and released locks, detailing their context, thereby improving the understanding of the control flow during locking operations in these components. Signed-off-by: Guillaume Abrioux (cherry picked from commit e68dceb1d2d6b4e6871c77465e1e23f2e726f84c) --- .../cephadmlib/node_proxy/baseredfishsystem.py | 14 +++++++------- src/cephadm/cephadmlib/node_proxy/reporter.py | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cephadm/cephadmlib/node_proxy/baseredfishsystem.py b/src/cephadm/cephadmlib/node_proxy/baseredfishsystem.py index 6102c1a8044..45c80e0209d 100644 --- a/src/cephadm/cephadmlib/node_proxy/baseredfishsystem.py +++ b/src/cephadm/cephadmlib/node_proxy/baseredfishsystem.py @@ -49,9 +49,9 @@ class BaseRedfishSystem(BaseSystem): # this loop can have: # - caching logic while self.run: - self.log.logger.debug('waiting for a lock.') + self.log.logger.debug('waiting for a lock in the update loop.') self.lock.acquire() - self.log.logger.debug('lock acquired.') + self.log.logger.debug('lock acquired in the update loop.') try: self._update_system() self._update_sn() @@ -74,19 +74,19 @@ class BaseRedfishSystem(BaseSystem): self.client.logout() finally: self.lock.release() - self.log.logger.debug('lock released.') + self.log.logger.debug('lock released in the update loop.') def flush(self) -> None: - self.log.logger.info('Acquiring lock to flush data.') + self.log.logger.debug('Acquiring lock to flush data.') self.lock.acquire() - self.log.logger.info('Lock acquired, flushing data.') + self.log.logger.debug('Lock acquired, flushing data.') self._system = {} self.previous_data = {} self.log.logger.info('Data flushed.') self.data_ready = False - self.log.logger.info('Data marked as not ready.') + self.log.logger.debug('Data marked as not ready.') self.lock.release() - self.log.logger.info('Lock released.') + self.log.logger.debug('Released the lock after flushing data.') @retry(retries=10, delay=2) def _get_path(self, path: str) -> Dict: diff --git a/src/cephadm/cephadmlib/node_proxy/reporter.py b/src/cephadm/cephadmlib/node_proxy/reporter.py index 765374483b1..fb92a452346 100644 --- a/src/cephadm/cephadmlib/node_proxy/reporter.py +++ b/src/cephadm/cephadmlib/node_proxy/reporter.py @@ -43,9 +43,9 @@ class Reporter: # scenario probably we should just send the sub-parts # that have changed to minimize the traffic in # dense clusters - self.log.logger.debug('waiting for a lock.') + self.log.logger.debug('waiting for a lock in reporter loop.') self.system.lock.acquire() - self.log.logger.debug('lock acquired.') + self.log.logger.debug('lock acquired in reporter loop.') if self.system.data_ready: self.log.logger.info('data ready to be sent to the mgr.') if not self.system.get_system() == self.system.previous_data: @@ -70,5 +70,5 @@ class Reporter: else: self.log.logger.info('no diff, not sending data to the mgr.') self.system.lock.release() - self.log.logger.debug('lock released.') + self.log.logger.debug('lock released in reporter loop.') time.sleep(5) -- 2.39.5