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

Support unstructured HTTP update #342

Closed
wants to merge 3 commits into from
Closed

Conversation

ofaurax
Copy link
Collaborator

@ofaurax ofaurax commented Aug 9, 2023

What does this PR implement/change/remove?

Even if deprecated, this PR adds support for the "unstructured HTTP update" from Redfish specification.
The current implementation only support multipart update.
This PR adds a fallback to "unstructured HTTP update" as a fallback of HTTP multipart is not available.

Checklist

  • Tests added
  • Similar commits squashed

The BMC firmware and/or BIOS versions that this change applies to (if applicable)

OpenBMC redfish implementation

Description for changelog/release notes

Initial release

@codecov
Copy link

codecov bot commented Aug 9, 2023

Codecov Report

Patch coverage: 57.14% and project coverage change: +0.44% 🎉

Comparison is base (a1b87e2) 42.67% compared to head (a3f230e) 43.11%.

❗ Current head a3f230e differs from pull request most recent head 9365e6c. Consider uploading reports for the commit 9365e6c to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #342      +/-   ##
==========================================
+ Coverage   42.67%   43.11%   +0.44%     
==========================================
  Files          44       44              
  Lines        3691     3746      +55     
==========================================
+ Hits         1575     1615      +40     
- Misses       1937     1946       +9     
- Partials      179      185       +6     
Files Changed Coverage Δ
providers/redfish/firmware.go 49.46% <40.00%> (+2.44%) ⬆️
providers/redfish/tasks.go 75.55% <100.00%> (+6.11%) ⬆️

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

Copy link
Member

@joelrebel joelrebel left a comment

Choose a reason for hiding this comment

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

Thanks for the efforts here, I've left a few suggestions inline

@@ -106,7 +106,23 @@ func (c *Conn) FirmwareInstall(ctx context.Context, component, applyAt string, f
"UpdateFile": reader,
}

resp, err := c.runRequestWithMultipartPayload(http.MethodPost, "/redfish/v1/UpdateService/MultipartUpload", payload)
updateService, err := c.redfishwrapper.UpdateService()
Copy link
Member

Choose a reason for hiding this comment

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

I suggest we update the firmwareUpdateCompatible() with the logic below, to return the update URI and it returns an error if the URI is not supported.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The URI is not enough to know the kind of update. Once the URI will be returned, we won't be able to know if we need to perform a multipart update or an unstructured one.

providers/redfish/firmware.go Show resolved Hide resolved
@@ -138,6 +161,47 @@ func (c *Conn) FirmwareInstallStatus(ctx context.Context, installVersion, compon
switch {
case strings.Contains(vendor, constants.Dell):
task, err = c.dellJobAsRedfishTask(taskID)
case strings.Contains(vendor, constants.Packet):
resp, _ := c.redfishwrapper.Get("/redfish/v1/TaskService/Tasks/" + taskID)
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried but it seems all Clients are not created equal:

../../providers/redfish/firmware.go:185:33: cannot use c.redfishwrapper (variable of type *redfishwrapper.Client) as type "github.com/stmcginnis/gofish/common".Client in argument to gofishrf.GetTask:
	*redfishwrapper.Client does not implement "github.com/stmcginnis/gofish/common".Client (missing DeleteWithHeaders method)

providers/redfish/firmware.go Outdated Show resolved Hide resolved
return nil, fmt.Errorf("unable to execute request, no target provided")
}

b, _ := io.ReadAll(payload)
Copy link
Member

Choose a reason for hiding this comment

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

I'd like to see if we have other options than reading the whole file into memory

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The payloadReadSeeker needs to be of type io.ReadSeeker meaning we need to be able to read and seek anywhere in the data, so we're forced to have it all.

On the multipart update, I see bytes.NewReader(payloadBuffer.Bytes()).
I'm not sure if the whole update is not in memory at that time.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for pointing this out, I realised that this was a regression and its supposed to be a stream upload #345

@ofaurax ofaurax force-pushed the unstructured-update-support branch from a3f230e to c57b61d Compare August 10, 2023 17:31
@ofaurax ofaurax force-pushed the unstructured-update-support branch from c57b61d to 9365e6c Compare August 10, 2023 17:32
@ofaurax ofaurax marked this pull request as ready for review August 10, 2023 17:32
Intel = "Intel"
// Equinix, formerly Packet
Copy link
Member

@jacobweinstock jacobweinstock Aug 10, 2023

Choose a reason for hiding this comment

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

what are these identifying? does Packet and Equinix have hardware like Intel and or Quanta does? or do they have a custom redfish implementation?

Copy link
Member

@jacobweinstock jacobweinstock Aug 10, 2023

Choose a reason for hiding this comment

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

maybe this is related to a custom openBMC build Equinix/Packet is running with redfish in it? If this is the case we should make that clear here. Without it I'm left to assume this is hardware that is built by Equinix/Packet like Supermico or Dell hardware.

Copy link
Member

Choose a reason for hiding this comment

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

In this case the hardware was manufactured with the vendor attribute set to Packet.

@joelrebel
Copy link
Member

The work on this PR was moved into #346 since we reworked the implementation.

@joelrebel joelrebel closed this Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants