fix(redfish): fix Redfish GET /Systems returns empty body after power state transitions#1051
Draft
DevipriyaS17 wants to merge 1 commit into
Draft
fix(redfish): fix Redfish GET /Systems returns empty body after power state transitions#1051DevipriyaS17 wants to merge 1 commit into
DevipriyaS17 wants to merge 1 commit into
Conversation
7cc44bc to
28c451c
Compare
ede1b7d to
13e6192
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## redfish #1051 +/- ##
===========================================
- Coverage 42.98% 42.71% -0.28%
===========================================
Files 153 153
Lines 14853 14952 +99
===========================================
+ Hits 6385 6387 +2
- Misses 7888 7984 +96
- Partials 580 581 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR addresses cases where GET /redfish/v1/Systems/{id} could return HTTP 200 with an empty body after power state transitions, by increasing HTTP server write timeouts and making Redfish system hydration more resilient to slow/failing WS-MAN calls.
Changes:
- Increased default HTTP server
WriteTimeoutto accommodate slow WS-MAN responses after power transitions. - Updated WS-MAN system aggregation to fan out calls in parallel and return a partial (non-nil)
ComputerSystemwhen some WS-MAN calls fail/timeout. - Added bounded-timeout boot settings retrieval (only when the system is reported as powered on) and adjusted logging to use formatted messages.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| redfish/internal/usecase/wsman_repo.go | Parallelizes WS-MAN hydration, adds per-subcall timeouts, cached fallbacks, and context/time-budget helpers to avoid empty responses. |
| redfish/internal/usecase/computer_system.go | Bounds boot settings retrieval with a timeout and skips it when the system is powered off. |
| redfish/internal/controller/http/v1/handler/systems.go | Updates error logging to formatted messages for system GET handlers. |
| redfish/internal/controller/http/v1/handler/systems_test.go | Updates logger message assertions to match the new formatted logging strings. |
| pkg/httpserver/server.go | Increases the default HTTP server write timeout from 15s to 60s. |
Comment on lines
+116
to
+120
| // Parallel call and timeout constants for system aggregation. | ||
| parallelCallCount = 2 | ||
| wsmanCallTimeout = 8 * time.Second | ||
| consoleBudgetMinimum = 1500 * time.Millisecond | ||
| controlModeTimeout = 2 * time.Second |
Comment on lines
+1087
to
+1097
| func isContextTimeoutOrCancelError(err error) bool { | ||
| if err == nil { | ||
| return false | ||
| } | ||
|
|
||
| errText := strings.ToLower(err.Error()) | ||
|
|
||
| return strings.Contains(errText, "context deadline exceeded") || | ||
| strings.Contains(errText, "context canceled") || | ||
| strings.Contains(errText, "ctx.done") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After power off or power on actions,
GET /redfish/v1/Systems/{id}returns HTTP 200 with an empty response body instead of valid JSON. This affected both power state transitions:Root Causes
HTTP write timeout too short — Server's
WriteTimeoutwas 15s. After power transitions, WS-MAN calls take 18–25s, causing the server to close the connection before writing the response body.Sequential WS-MAN calls with strict error handling — Power state and hardware info calls were sequential. If either failed (device offline, 401 auth error, connection reset), the code returned
nilinstead of a partial response, resulting in HTTP 200 with empty body.