Skip to content

Commit

Permalink
Update driver validation to account for WSL2
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Desiniotis <cdesiniotis@nvidia.com>
  • Loading branch information
cdesiniotis committed Jan 14, 2025
1 parent 39978ef commit c4af38b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions validator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ const (
CCCapableLabelKey = "nvidia.com/cc.capable"
// appComponentLabelKey indicates the label key of the component
appComponentLabelKey = "app.kubernetes.io/component"
// wslNvidiaSMIPath indicates the path to the nvidia-smi binary on WSL
wslNvidiaSMIPath = "/usr/lib/wsl/lib/nvidia-smi"
)

func main() {
Expand Down Expand Up @@ -693,6 +695,11 @@ func isDriverManagedByOperator(ctx context.Context) (bool, error) {

func validateHostDriver(silent bool) error {
log.Info("Attempting to validate a pre-installed driver on the host")
if fileInfo, err := os.Lstat(filepath.Join("/host", wslNvidiaSMIPath)); err == nil && fileInfo.Size() != 0 {
log.Infof("WSL2 system detected, assuming driver is pre-installed")
disableDevCharSymlinkCreation = true
return nil
}
fileInfo, err := os.Lstat("/host/usr/bin/nvidia-smi")
if err != nil {
return fmt.Errorf("no 'nvidia-smi' file present on the host: %w", err)
Expand Down

0 comments on commit c4af38b

Please sign in to comment.