MCPcopy Create free account
hub / github.com/NVIDIA/gpu-operator / validateHostDriver

Function validateHostDriver

cmd/nvidia-validator/main.go:745–763  ·  view source on GitHub ↗
(silent bool)

Source from the content-addressed store, hash-verified

743}
744
745func validateHostDriver(silent bool) error {
746 log.Info("Attempting to validate a pre-installed driver on the host")
747 if fileInfo, err := os.Lstat(filepath.Join("/host", wslNvidiaSMIPath)); err == nil && fileInfo.Size() != 0 {
748 log.Infof("WSL2 system detected, assuming driver is pre-installed")
749 disableDevCharSymlinkCreation = true
750 return nil
751 }
752 fileInfo, err := os.Lstat("/host/usr/bin/nvidia-smi")
753 if err != nil {
754 return fmt.Errorf("no 'nvidia-smi' file present on the host: %w", err)
755 }
756 if fileInfo.Size() == 0 {
757 return fmt.Errorf("empty 'nvidia-smi' file found on the host")
758 }
759 command := "chroot"
760 args := []string{"/host", "nvidia-smi"}
761
762 return runCommand(command, args, silent)
763}
764
765func validateDriverContainer(silent bool, driverManagedByOperator bool) error {
766 if driverManagedByOperator {

Callers 1

runValidationMethod · 0.85

Calls 1

runCommandFunction · 0.85

Tested by

no test coverage detected