Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3/3] supermicro firmware install rewrite #363

Merged
merged 5 commits into from
Nov 10, 2023

Conversation

joelrebel
Copy link
Member

What does this PR implement/change/remove?

  • Reworks the supermicro provider for x12 firmware update support using the newer firmware install interface methods

Checklist

  • Tests added
  • Similar commits squashed

Copy link

codecov bot commented Nov 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (new-firmware-interfaces@49efe08). Click here to learn what that means.

Additional details and impacted files
@@                    Coverage Diff                     @@
##             new-firmware-interfaces     #363   +/-   ##
==========================================================
  Coverage                           ?   45.02%           
==========================================================
  Files                              ?       60           
  Lines                              ?     5017           
  Branches                           ?        0           
==========================================================
  Hits                               ?     2259           
  Misses                             ?     2501           
  Partials                           ?      257           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


// FirmwareTaskStatus returns the status of a firmware related task queued on the BMC.
func (c *Client) FirmwareTaskStatus(ctx context.Context, kind constants.FirmwareInstallStep, component, taskID, installVersion string) (state, status string, err error) {
if err := c.firmwareInstallSupported(ctx); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like there should be a better way to encapsulate this rather than repeat a sanity check 4-ish times, but right now I don't have a ready answer. More food-for-thought.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because of the way these bmc client interface methods are called - FirmwareUpload, FirmwareTaskStatus - each method is attempted on every provider (dell, redfish, smc...) and so each provider implementation has to make sure its running on supported hardware before proceeding (atleast I'd like to be twice as careful for firmware related actions).

providers/supermicro/supermicro.go Outdated Show resolved Hide resolved
providers/supermicro/supermicro.go Outdated Show resolved Hide resolved
providers/supermicro/x11.go Outdated Show resolved Hide resolved
// at the end of the install the BMC resets itself and the response is in HTML
//
switch {
part := strings.Split(string(resp), "<percent>")[1]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sort of string manipulation is brittle and only used for reporting progress. Do we need a fine-grained measure of progress? Maybe we'd be better served with a watchdog timer or something?

Copy link
Member Author

@joelrebel joelrebel Nov 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need it as much as having to track if the install succeeded or not, and its a nice to have when installing firmware that takes a while. A watchdog timer would be more of a hammer - how do we define a timeout that works across models.

if bytes.Contains(resp, []byte(`<html>`)) || !bytes.Contains(resp, []byte(`<percent>`)) {
tries to validate we have the percent values to extract, and hopefully makes it less brittle.

@joelrebel joelrebel force-pushed the new-firmware-interfaces branch from 4004cbc to 49efe08 Compare November 9, 2023 09:51
@joelrebel
Copy link
Member Author

rebased on parent branch, fixed up FirmwareUpload interface method to accept a *os.File.

… x11, x12

based on feedback recieved this approach made more sense
Copy link
Collaborator

@DoctorVin DoctorVin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside the x12 test question, I'm OK with this. LMK if you want this approved explicitly or want to manage getting it into main some other way.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there tests for the x12 side of things?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the x12 code is calling into the redfishwrapper, which is pretty well covered https://github.com/bmc-toolbox/bmclib/blob/smc-rewrite/internal/redfishwrapper/firmware_test.go

One of the methods could use some testing - I'll add that in a separate PR

func noTasksRunning(component string, t *redfish.Task) error {

@joelrebel joelrebel merged commit a551c62 into new-firmware-interfaces Nov 10, 2023
5 of 7 checks passed
@joelrebel joelrebel deleted the smc-rewrite branch November 10, 2023 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants