Merge pull request #762 from elezar/fix-auto-cdi-runtime-mode
Some checks are pending
CodeQL / Analyze Go code with CodeQL (push) Waiting to run
Golang / check (push) Waiting to run
Golang / Unit test (push) Waiting to run
Golang / Build (push) Waiting to run
image / packages (${{github.event_name == 'pull_request'}}, centos7-aarch64) (push) Waiting to run
image / packages (${{github.event_name == 'pull_request'}}, centos7-x86_64) (push) Waiting to run
image / packages (${{github.event_name == 'pull_request'}}, centos8-ppc64le) (push) Waiting to run
image / packages (${{github.event_name == 'pull_request'}}, ubuntu18.04-amd64) (push) Waiting to run
image / packages (${{github.event_name == 'pull_request'}}, ubuntu18.04-arm64) (push) Waiting to run
image / packages (${{github.event_name == 'pull_request'}}, ubuntu18.04-ppc64le) (push) Waiting to run
image / image (packaging, ${{github.event_name == 'pull_request'}}) (push) Blocked by required conditions
image / image (ubi8, ${{github.event_name == 'pull_request'}}) (push) Blocked by required conditions
image / image (ubuntu20.04, ${{github.event_name == 'pull_request'}}) (push) Blocked by required conditions

Fix bug when using just-in-time CDI spec generation
This commit is contained in:
Evan Lezar 2024-10-30 13:08:26 +01:00 committed by GitHub
commit efb18a72ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -103,7 +103,7 @@ func (l *nvmllib) GetDeviceSpecsByID(ids ...string) ([]specs.Device, error) {
return l.GetDeviceSpecsBy(identifiers...) 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) { func (l *nvmllib) GetDeviceSpecsBy(identifiers ...device.Identifier) ([]specs.Device, error) {
for _, id := range identifiers { for _, id := range identifiers {
if id == "all" { if id == "all" {
@ -118,10 +118,23 @@ func (l *nvmllib) GetDeviceSpecsBy(identifiers ...device.Identifier) ([]specs.De
} }
defer func() { defer func() {
if r := l.nvmllib.Shutdown(); r != nvml.SUCCESS { 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)
l.nvsandboxutilslib = nil
}
defer func() {
if l.nvsandboxutilslib == nil {
return
}
_ = l.nvsandboxutilslib.Shutdown()
}()
}
nvmlDevices, err := l.getNVMLDevicesByID(identifiers...) nvmlDevices, err := l.getNVMLDevicesByID(identifiers...)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to get NVML device handles: %w", err) return nil, fmt.Errorf("failed to get NVML device handles: %w", err)