diff --git a/redfish/internal/entity/v1/computer_system.go b/redfish/internal/entity/v1/computer_system.go index a87d9887a..8aa49c955 100644 --- a/redfish/internal/entity/v1/computer_system.go +++ b/redfish/internal/entity/v1/computer_system.go @@ -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"` @@ -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"` } diff --git a/redfish/internal/usecase/computer_system.go b/redfish/internal/usecase/computer_system.go index 9ceb4314e..feaa296ee 100644 --- a/redfish/internal/usecase/computer_system.go +++ b/redfish/internal/usecase/computer_system.go @@ -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) diff --git a/redfish/internal/usecase/wsman_repo.go b/redfish/internal/usecase/wsman_repo.go index 1c31df442..6249696a0 100644 --- a/redfish/internal/usecase/wsman_repo.go +++ b/redfish/internal/usecase/wsman_repo.go @@ -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)