From fb016dca8643a19b7db43b65d4e7b99b388f24f8 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Wed, 28 Sep 2022 13:39:39 +0200 Subject: [PATCH] Use go-nvlib nvlib/info package Signed-off-by: Evan Lezar --- internal/info/auto.go | 6 ++++-- internal/modifier/tegra.go | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/info/auto.go b/internal/info/auto.go index c70265f8..c7863b97 100644 --- a/internal/info/auto.go +++ b/internal/info/auto.go @@ -16,7 +16,7 @@ package info -import "gitlab.com/nvidia/cloud-native/go-nvlib/pkg/nvinfo" +import "gitlab.com/nvidia/cloud-native/go-nvlib/pkg/nvlib/info" // Logger is a basic interface for logging to allow these functions to be called // from code where logrus is not used. @@ -34,10 +34,12 @@ func ResolveAutoMode(logger Logger, mode string) (rmode string) { logger.Infof("Auto-detected mode as '%v'", rmode) }() + nvinfo := info.New() + isTegra, reason := nvinfo.IsTegraSystem() logger.Debugf("Is Tegra-based system? %v: %v", isTegra, reason) - hasNVML, reason := nvinfo.HasNVML() + hasNVML, reason := nvinfo.HasNvml() logger.Debugf("Has NVML? %v: %v", hasNVML, reason) if isTegra && !hasNVML { diff --git a/internal/modifier/tegra.go b/internal/modifier/tegra.go index 459d1f0d..b6a7ef22 100644 --- a/internal/modifier/tegra.go +++ b/internal/modifier/tegra.go @@ -21,12 +21,12 @@ import ( "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup" "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" "github.com/sirupsen/logrus" - "gitlab.com/nvidia/cloud-native/go-nvlib/pkg/nvinfo" + "gitlab.com/nvidia/cloud-native/go-nvlib/pkg/nvlib/info" ) // NewTegraPlatformFiles creates a modifier to inject the Tegra platform files into a container. func NewTegraPlatformFiles(logger *logrus.Logger) (oci.SpecModifier, error) { - isTegra, _ := nvinfo.IsTegraSystem() + isTegra, _ := info.New().IsTegraSystem() if !isTegra { return nil, nil }