mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-26 18:18:24 +00:00
Use go-nvlib nvlib/info package
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
a9fb7a4a88
commit
fb016dca86
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package info
|
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
|
// Logger is a basic interface for logging to allow these functions to be called
|
||||||
// from code where logrus is not used.
|
// 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)
|
logger.Infof("Auto-detected mode as '%v'", rmode)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
nvinfo := info.New()
|
||||||
|
|
||||||
isTegra, reason := nvinfo.IsTegraSystem()
|
isTegra, reason := nvinfo.IsTegraSystem()
|
||||||
logger.Debugf("Is Tegra-based system? %v: %v", isTegra, reason)
|
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)
|
logger.Debugf("Has NVML? %v: %v", hasNVML, reason)
|
||||||
|
|
||||||
if isTegra && !hasNVML {
|
if isTegra && !hasNVML {
|
||||||
|
@ -21,12 +21,12 @@ import (
|
|||||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/lookup"
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/lookup"
|
||||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/oci"
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/oci"
|
||||||
"github.com/sirupsen/logrus"
|
"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.
|
// NewTegraPlatformFiles creates a modifier to inject the Tegra platform files into a container.
|
||||||
func NewTegraPlatformFiles(logger *logrus.Logger) (oci.SpecModifier, error) {
|
func NewTegraPlatformFiles(logger *logrus.Logger) (oci.SpecModifier, error) {
|
||||||
isTegra, _ := nvinfo.IsTegraSystem()
|
isTegra, _ := info.New().IsTegraSystem()
|
||||||
if !isTegra {
|
if !isTegra {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user