From a61bd5f07639ec3ef86b954042e9b3a007aa6918 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Mon, 16 Feb 2026 13:49:46 +0100 Subject: [PATCH] node-proxy: improve HTTP error logging in client This commit makes it log the http error with the code and the reason in sessionservice_discover() and log the error code along with the body in query() for 5xx responses. Fixes: https://tracker.ceph.com/issues/74749 Signed-off-by: Guillaume Abrioux --- src/ceph-node-proxy/ceph_node_proxy/redfish_client.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ceph-node-proxy/ceph_node_proxy/redfish_client.py b/src/ceph-node-proxy/ceph_node_proxy/redfish_client.py index 652d2dd832b..d6560f5b4c2 100644 --- a/src/ceph-node-proxy/ceph_node_proxy/redfish_client.py +++ b/src/ceph-node-proxy/ceph_node_proxy/redfish_client.py @@ -30,7 +30,10 @@ class RedFishClient(BaseClient): json_data: Dict[str, Any] = json.loads(_data) self.session_service = json_data["Links"]["Sessions"]["@odata.id"] except (URLError, KeyError) as e: - msg = f"{_error_msg}: {e}" + if isinstance(e, HTTPError): + msg = f"{_error_msg}: {e.code} {e.reason}" + else: + msg = f"{_error_msg}: {e}" self.log.error(msg) raise RuntimeError @@ -153,5 +156,11 @@ class RedFishClient(BaseClient): self.location = "" self.login() return do_req(req_headers()) + if isinstance(e, HTTPError) and e.code >= 500: + msg = f"HTTP query error: {e.code} {e.reason}" + body = e.read().decode("utf-8", errors="replace").strip() + if body: + msg += f" — {body[:4096]}{'...' if len(body) > 4096 else ''}" + self.log.warning(msg) self.log.debug(f"endpoint={endpoint} err={e}") raise -- 2.47.3