Skip to content

Commit

Permalink
actions/NICUpdater: extend interface for update requirements method
Browse files Browse the repository at this point in the history
The UpdateRequirements() method is implemented by the mlxup NIC update
utility
  • Loading branch information
joelrebel committed Aug 8, 2024
1 parent 6123f22 commit 968097b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions actions/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ type DriveUpdater interface {
type NICUpdater interface {
UtilAttributeGetter
UpdateNIC(ctx context.Context, updateFile, modelNumber string, force bool) error
UpdateRequirements() model.UpdateRequirements
}

// BMCUpdater defines an interface to update BMC firmware
Expand Down
5 changes: 5 additions & 0 deletions model/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ type UpdateOptions struct {
RepositoryVersion string // The update repository version to activate when defined
BaseURL string // The BaseURL for the updates
}

// UpdateRequirements holds attributes that indicate requirements for before/after a component firmware install
type UpdateRequirements struct {
PostInstallPowerCycle bool
}
5 changes: 5 additions & 0 deletions utils/mlxup.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ func setNICFirmware(d *MlxupDevice, firmware *common.Firmware) {
}
}

// UpdateRequirements implements the actions/NICUpdater interface to return any pre/post firmware install requirements.
func (m *Mlxup) UpdateRequirements() model.UpdateRequirements {
return model.UpdateRequirements{PostInstallPowerCycle: true}
}

// UpdateNIC updates mellanox NIC with the given update file
func (m *Mlxup) UpdateNIC(ctx context.Context, updateFile, modelNumber string, force bool) error {
// query list of nics
Expand Down

0 comments on commit 968097b

Please sign in to comment.