From b104cc57d2aa5f7cd35ca155b660a3f4ff304f20 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Wed, 5 Apr 2023 14:14:40 +0200 Subject: [PATCH] node-proxy: logout from redfish api on Exception Otherwise it ends up recreating new session each time whereas the previous session is left. After multiple failures, it reaches the limit and left sessions need to be cleaned up manually. Signed-off-by: Guillaume Abrioux (cherry picked from commit 7c602947e45ceff719c105b0277a10a6e72831e5) --- src/cephadm/node-proxy/redfish_system.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/cephadm/node-proxy/redfish_system.py b/src/cephadm/node-proxy/redfish_system.py index e4a59320768..de80d83d87d 100644 --- a/src/cephadm/node-proxy/redfish_system.py +++ b/src/cephadm/node-proxy/redfish_system.py @@ -91,12 +91,18 @@ class RedfishSystem(System): def update(self): # this loop can have: # - caching logic - while self.run: - self._update_system() - # following calls in theory can be done in parallel - self._update_metadata() - self._update_memory() - self._update_power() - self._update_network() - self._update_storage() - sleep(3) + try: + while self.run: + self._update_system() + # following calls in theory can be done in parallel + self._update_metadata() + self._update_memory() + self._update_power() + self._update_network() + self._update_storage() + sleep(3) + # Catching 'Exception' is probably not a good idea (devel only) + except Exception: + log.error(f"Error detected, logging out from redfish api") + self.client.logout() + raise -- 2.39.5