From: Guillaume Abrioux Date: Mon, 16 Feb 2026 12:49:46 +0000 (+0100) Subject: node-proxy: improve HTTP error logging in client X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4a657956b0e3405cab26fd2b7f118a859a475270;p=ceph-ci.git 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 (cherry picked from commit a61bd5f07639ec3ef86b954042e9b3a007aa6918) --- 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