-
Notifications
You must be signed in to change notification settings - Fork 36
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
Redfish stream multipart uploads #345
Conversation
These changes were already part of bmclib v1 but missed out from being included in v2, #279
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #345 +/- ##
=======================================
Coverage 42.67% 42.68%
=======================================
Files 44 44
Lines 3691 3730 +39
=======================================
+ Hits 1575 1592 +17
- Misses 1937 1951 +14
- Partials 179 187 +8
☔ View full report in Codecov by Sentry. |
providers/redfish/firmware.go
Outdated
|
||
size = finfo.Size() | ||
|
||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any clue what other kinds of readers might show up here? It might be nice to see if the implementation of reader might have a .Len method so we can avoid unnecessary reads.
type Lenner interface {
Len() int
}
...
if file, ok := reader.(*os.File); ok {
...
} else if lenner, ok := reader.(Lenner); ok {
...
} else {
// read the file to get size
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this might need some rethinking - since we also require the file name here,
if file, ok := reader.(*os.File); ok {
// Add update file fields
if _, err = form.CreateFormFile(key, filepath.Base(file.Name())); err != nil {
return 0, body, err
}
...
}
@mmlb whenever you're back, PTAL :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…t instead This makes the code easier to read and maintain. As of now we limit the method to expect an os.File as an io.Reader, once its clear theres other implementations of io.Readers required we can accept those and figure how to determine the file size for the multipart payload
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree that this looks much better! I think if we drop io.Reader for the updateParameters it will similarly make it simpler too.
This makes the UpdateParameters handling easier to grok and maintain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
What does this PR implement/change/remove?
The Redfish provider currently reads the firmware files into memory before a multipart upload,
this results in high memory consumption for the client and can be problematic for cases
where firmware installs have to be performed simultaneously.
This change was part of bmclib v1 #279
but was somehow missed from being included in v2.
Tested with Dell R6515's, R7640.
heap profile - with streaming uploads
heap profile - without streaming uploads
Checklist
Description for changelog/release notes