Skip to content

Commit

Permalink
Do not create HFC for non-redfish BMH
Browse files Browse the repository at this point in the history
Currently we are creating HFC for all BMH.
HFC only works for redfish based hardware, so we should only create
when we detect that is redfish is in use.

Signed-off-by: Iury Gregory Melo Ferreira <[email protected]>
  • Loading branch information
iurygregory committed Jan 30, 2025
1 parent f397543 commit b44e141
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions controllers/metal3.io/baremetalhost_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,13 @@ func (r *BareMetalHostReconciler) registerHost(prov provisioner.Provisioner, inf
return actionUpdate{}
}

// Check if the host can support firmware components before creating the resrouce
_, errGetFirmwareComponents := prov.GetFirmwareComponents()
supportsFirmwareComponents := true
if errGetFirmwareComponents != nil && errors.Is(errGetFirmwareComponents, provisioner.ErrFirmwareUpdateUnsupported) {
supportsFirmwareComponents = false
}

// Create the hostFirmwareSettings resource with same host name/namespace if it doesn't exist
// Create the hostFirmwareComponents resource with same host name/namespace if it doesn't exist
if info.host.Name != "" {
Expand All @@ -901,9 +908,11 @@ func (r *BareMetalHostReconciler) registerHost(prov provisioner.Provisioner, inf
info.log.Info("failed creating hostfirmwaresettings")
return actionError{errors.Wrap(err, "failed creating hostFirmwareSettings")}
}
if err = r.createHostFirmwareComponents(info); err != nil {
info.log.Info("failed creating hostfirmwarecomponents")
return actionError{errors.Wrap(err, "failed creating hostFirmwareComponents")}
if supportsFirmwareComponents {
if err = r.createHostFirmwareComponents(info); err != nil {
info.log.Info("failed creating hostfirmwarecomponents")
return actionError{errors.Wrap(err, "failed creating hostFirmwareComponents")}
}
}
if _, err = r.acquireHostUpdatePolicy(info); err != nil {
info.log.Info("failed setting owner reference on hostupdatepolicy")
Expand Down

0 comments on commit b44e141

Please sign in to comment.