Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions redfish/internal/entity/v1/computer_system.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Package redfish provides entity definitions for Redfish computer systems.
package redfish

import "github.com/device-management-toolkit/console/redfish/internal/controller/http/v1/generated"

// ComputerSystem represents a Redfish Computer System entity.
type ComputerSystem struct {
ID string `json:"Id"`
Expand All @@ -18,6 +20,7 @@ type ComputerSystem struct {
Status *Status `json:"Status,omitempty"`
MemorySummary *ComputerSystemMemorySummary `json:"MemorySummary,omitempty"`
ProcessorSummary *ComputerSystemProcessorSummary `json:"ProcessorSummary,omitempty"`
Boot *generated.ComputerSystemBoot `json:"Boot,omitempty"`
ODataID string `json:"@odata.id"`
ODataType string `json:"@odata.type"`
}
Expand Down
17 changes: 12 additions & 5 deletions redfish/internal/usecase/computer_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,19 @@ func (uc *ComputerSystemUseCase) GetComputerSystem(ctx context.Context, systemID
}
}

// Fetch boot settings
boot, err := uc.Repo.GetBootSettings(ctx, systemID)
if err != nil {
// Log error but don't fail the entire request - boot settings may not be available
boot = nil
// Use boot settings retrieved alongside the rest of the system data when
// available; otherwise fetch them separately to preserve backward behaviour.
boot := system.Boot
if boot == nil {
var bootErr error

boot, bootErr = uc.Repo.GetBootSettings(ctx, systemID)
if bootErr != nil {
// Log error but don't fail the entire request - boot settings may not be available
boot = nil
}
}

// Create Actions for this system using the generated Actions type
actions := uc.createActionsStruct(systemID)

Expand Down
6 changes: 6 additions & 0 deletions redfish/internal/usecase/wsman_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,12 @@ func (r *WsmanComputerSystemRepo) GetByID(ctx context.Context, systemID string)
// Build and return the complete ComputerSystem using CIM data and hardware info
system := r.buildComputerSystemFromCIMData(systemID, redfishPowerState, cimData, hwInfo)

// Fetch boot settings best-effort so GetComputerSystem can reuse them
// without issuing a second WS-Man round-trip.
if boot, bootErr := r.GetBootSettings(ctx, systemID); bootErr == nil {
system.Boot = boot
}

// Fetch GraphicalConsole data best-effort, but avoid returning guessed values
// when feature retrieval fails.
_, featuresV2, err := r.usecase.GetFeatures(ctx, systemID)
Expand Down
Loading