Skip to content

Commit c3e363f

Browse files
authored
Set boot mode override on SuperMicro servers explicitly (#607)
1 parent fa8b23b commit c3e363f

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

bmc/bmc.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ import (
1919
type Manufacturer string
2020

2121
const (
22-
ManufacturerDell Manufacturer = "Dell Inc."
23-
ManufacturerLenovo Manufacturer = "Lenovo"
24-
ManufacturerHPE Manufacturer = "HPE"
22+
ManufacturerDell Manufacturer = "Dell Inc."
23+
ManufacturerLenovo Manufacturer = "Lenovo"
24+
ManufacturerHPE Manufacturer = "HPE"
25+
ManufacturerSupermicro Manufacturer = "Supermicro"
2526
)
2627

2728
// BMC defines an interface for interacting with a Baseboard Management Controller.

bmc/redfish.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,17 @@ func (r *RedfishBMC) SetPXEBootOnce(ctx context.Context, systemURI string) error
196196
var setBoot redfish.Boot
197197
// TODO: cover setting BootSourceOverrideMode with BIOS settings profile
198198
// Only skip setting BootSourceOverrideMode for older BMCs that don't report it
199-
if system.Boot.BootSourceOverrideMode != "" {
199+
if system.Boot.BootSourceOverrideMode != "" && system.Boot.BootSourceOverrideMode != redfish.UEFIBootSourceOverrideMode {
200200
setBoot = pxeBootWithSettingUEFIBootMode
201201
} else {
202202
setBoot = pxeBootWithoutSettingUEFIBootMode
203203
}
204+
205+
// TODO: hack for SuperMicro: set explicitly the BootSourceOverrideMode to UEFI
206+
if isSuperMicroSystem(system) {
207+
setBoot.BootSourceOverrideMode = redfish.UEFIBootSourceOverrideMode
208+
}
209+
204210
// TODO: pass logging context from caller
205211
log := ctrl.LoggerFrom(ctx)
206212
log.V(2).Info("Setting PXE boot once", "SystemURI", systemURI, "Boot settings", setBoot)
@@ -210,6 +216,11 @@ func (r *RedfishBMC) SetPXEBootOnce(ctx context.Context, systemURI string) error
210216
return nil
211217
}
212218

219+
func isSuperMicroSystem(system *redfish.ComputerSystem) bool {
220+
m := strings.TrimSpace(system.Manufacturer)
221+
return strings.EqualFold(m, string(ManufacturerSupermicro))
222+
}
223+
213224
func (r *RedfishBMC) GetManager(bmcUUID string) (*redfish.Manager, error) {
214225
if r.client == nil {
215226
return nil, fmt.Errorf("no client found")

0 commit comments

Comments
 (0)