-
Notifications
You must be signed in to change notification settings - Fork 492
Fix bug when using just-in-time CDI spec generation #762
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,7 +103,7 @@ func (l *nvmllib) GetDeviceSpecsByID(ids ...string) ([]specs.Device, error) { | |
| return l.GetDeviceSpecsBy(identifiers...) | ||
| } | ||
|
|
||
| // GetDeviceSpecsBy is not supported for the gdslib specs. | ||
| // GetDeviceSpecsBy returns the device specs for devices with the specified identifiers. | ||
| func (l *nvmllib) GetDeviceSpecsBy(identifiers ...device.Identifier) ([]specs.Device, error) { | ||
| for _, id := range identifiers { | ||
| if id == "all" { | ||
|
|
@@ -118,10 +118,23 @@ func (l *nvmllib) GetDeviceSpecsBy(identifiers ...device.Identifier) ([]specs.De | |
| } | ||
| defer func() { | ||
| if r := l.nvmllib.Shutdown(); r != nvml.SUCCESS { | ||
| l.logger.Warningf("failed to shutdown NVML: %w", r) | ||
| l.logger.Warningf("failed to shutdown NVML: %v", r) | ||
| } | ||
| }() | ||
|
|
||
| if l.nvsandboxutilslib != nil { | ||
| if r := l.nvsandboxutilslib.Init(l.driverRoot); r != nvsandboxutils.SUCCESS { | ||
| l.logger.Warningf("Failed to init nvsandboxutils: %v; ignoring", r) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Warning log on line 121 is lowercase and here is upper cased, is there a reason for the diff?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No specific reason. I will update these for consistency once we refactor. |
||
| l.nvsandboxutilslib = nil | ||
| } | ||
| defer func() { | ||
| if l.nvsandboxutilslib == nil { | ||
| return | ||
| } | ||
| _ = l.nvsandboxutilslib.Shutdown() | ||
| }() | ||
| } | ||
|
|
||
| nvmlDevices, err := l.getNVMLDevicesByID(identifiers...) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to get NVML device handles: %w", err) | ||
|
|
||
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.
For the time being, I have duplicated the code for
GetAllDeviceSpecs-- which is exercised more frequently -- and will clean the up more in a post-release follow-up.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.
Would it be worth to create a func now that we have the same code in 2 funcs?
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.
I don't know whether a functon would work since we need to defer the calls to
Shutdown(). It is something we could look into, but I don't want to make that change this close to the release.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, something to workshop for the next release. The patch does as described.