-
Notifications
You must be signed in to change notification settings - Fork 292
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
Fix cdi mode resolution #428
Conversation
21c5d69
to
035af48
Compare
035af48
to
ec1fae1
Compare
ec1fae1
to
a57badd
Compare
a57badd
to
65a6ecb
Compare
switch nvinfo.ResolvePlatform() { | ||
case info.PlatformNVML, info.PlatformWSL: | ||
return "legacy" | ||
case info.PlatformTegra: |
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.
Question -- this case aligns with the original conditional because usesNVGPUModule
will only be true on a Tegra platform, correct?
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.
Yes, the logic for checking the use of the nvgpu
module has been pulled into the platform check. PlatformTegra
now means that either the Tegra sysfs files are present and NVML is not, or NVML is present and the nvgpu
module is used.
65a6ecb
to
8824828
Compare
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.
Just a couple comments, looks good
pkg/nvcdi/lib.go
Outdated
@@ -180,30 +185,23 @@ func (m *wrapper) GetCommonEdits() (*cdi.ContainerEdits, error) { | |||
|
|||
// resolveMode resolves the mode for CDI spec generation based on the current system. | |||
func (l *nvcdilib) resolveMode() (rmode string) { | |||
if l.mode != ModeAuto { | |||
if l.mode != "auto" { |
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.
Why moving away from a const var, isn't that preferred?
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.
Updated.
internal/info/auto_test.go
Outdated
@@ -23,6 +23,8 @@ import ( | |||
testlog "github.com/sirupsen/logrus/hooks/test" | |||
"github.com/stretchr/testify/require" | |||
|
|||
"github.com/NVIDIA/go-nvlib/pkg/nvlib/info" | |||
|
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.
is this extra line wanted/needed?
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.
You're right. It isn't.
Signed-off-by: Evan Lezar <[email protected]>
Signed-off-by: Evan Lezar <[email protected]>
8824828
to
52d0383
Compare
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.
Looks good to me
This change incorporates the changes from NVIDIA/go-nvlib#28 to make the mode resolution consistent.
This ensures that CDI spec generation works on Tegra-based systems where nvml is present.