diff --git a/.nvidia-ci.yml b/.nvidia-ci.yml index 5b6d7904..0240ca6c 100644 --- a/.nvidia-ci.yml +++ b/.nvidia-ci.yml @@ -138,16 +138,6 @@ scan-centos7-amd64: needs: - image-centos7 -scan-centos7-arm64: - extends: - - .dist-centos7 - - .platform-arm64 - - .scan - needs: - - image-centos7 - - scan-centos7-amd64 - allow_failure: true - scan-ubuntu20.04-amd64: extends: - .dist-ubuntu20.04 diff --git a/CHANGELOG.md b/CHANGELOG.md index 913f4d92..f6cf0b92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # NVIDIA Container Toolkit Changelog +## v1.13.5 +* Remove dependency on `coreutils` when installing the NVIDIA Container Toolkit on RPM-based systems. +* Added support for detecting GSP firmware at custom paths when generating CDI specifications. + +* [libnvidia-container] Include Shared Compiler Library (libnvidia-gpucomp.so) in the list of compute libaries. + ## v1.13.4 * [toolkit-container] Bump CUDA base image version to 12.2.0. diff --git a/packaging/rpm/SPECS/nvidia-container-toolkit.spec b/packaging/rpm/SPECS/nvidia-container-toolkit.spec index ed44bc37..c61a47da 100644 --- a/packaging/rpm/SPECS/nvidia-container-toolkit.spec +++ b/packaging/rpm/SPECS/nvidia-container-toolkit.spec @@ -57,12 +57,14 @@ mkdir -p %{buildroot}/usr/share/containers/oci/hooks.d install -m 644 -t %{buildroot}/usr/share/containers/oci/hooks.d oci-nvidia-hook.json %post -mkdir -p %{_localstatedir}/lib/rpm-state/nvidia-container-toolkit -cp -af %{_bindir}/nvidia-container-runtime-hook %{_localstatedir}/lib/rpm-state/nvidia-container-toolkit +if [ $1 -gt 1 ]; then # only on package upgrade + mkdir -p %{_localstatedir}/lib/rpm-state/nvidia-container-toolkit + cp -af %{_bindir}/nvidia-container-runtime-hook %{_localstatedir}/lib/rpm-state/nvidia-container-toolkit +fi %posttrans if [ ! -e %{_bindir}/nvidia-container-runtime-hook ]; then - # reparing lost file nvidia-container-runtime-hook + # repairing lost file nvidia-container-runtime-hook cp -avf %{_localstatedir}/lib/rpm-state/nvidia-container-toolkit/nvidia-container-runtime-hook %{_bindir} fi rm -rf %{_localstatedir}/lib/rpm-state/nvidia-container-toolkit diff --git a/pkg/nvcdi/driver-nvml.go b/pkg/nvcdi/driver-nvml.go index 408da55a..4e5fd538 100644 --- a/pkg/nvcdi/driver-nvml.go +++ b/pkg/nvcdi/driver-nvml.go @@ -18,6 +18,7 @@ package nvcdi import ( "fmt" + "os" "path/filepath" "strings" @@ -26,6 +27,7 @@ import ( "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup/cuda" "github.com/sirupsen/logrus" "gitlab.com/nvidia/cloud-native/go-nvlib/pkg/nvml" + "golang.org/x/sys/unix" ) // NewDriverDiscoverer creates a discoverer for the libraries and binaries associated with a driver installation. @@ -55,7 +57,10 @@ func newDriverVersionDiscoverer(logger *logrus.Logger, driverRoot string, nvidia return nil, fmt.Errorf("failed to create discoverer for IPC sockets: %v", err) } - firmwares := NewDriverFirmwareDiscoverer(logger, driverRoot, version) + firmwares, err := NewDriverFirmwareDiscoverer(logger, driverRoot, version) + if err != nil { + return nil, fmt.Errorf("failed to create discoverer for GSP firmware: %v", err) + } binaries := NewDriverBinariesDiscoverer(logger, driverRoot) @@ -100,18 +105,65 @@ func NewDriverLibraryDiscoverer(logger *logrus.Logger, driverRoot string, nvidia return d, nil } +func getUTSRelease() (string, error) { + utsname := &unix.Utsname{} + if err := unix.Uname(utsname); err != nil { + return "", err + } + return unix.ByteSliceToString(utsname.Release[:]), nil +} + +func getFirmwareSearchPaths(logger *logrus.Logger) ([]string, error) { + + var firmwarePaths []string + if p := getCustomFirmwareClassPath(logger); p != "" { + logger.Debugf("using custom firmware class path: %s", p) + firmwarePaths = append(firmwarePaths, p) + } + + utsRelease, err := getUTSRelease() + if err != nil { + return nil, fmt.Errorf("failed to get UTS_RELEASE: %v", err) + } + + standardPaths := []string{ + filepath.Join("/lib/firmware/updates/", utsRelease), + filepath.Join("/lib/firmware/updates/"), + filepath.Join("/lib/firmware/", utsRelease), + filepath.Join("/lib/firmware/"), + } + + return append(firmwarePaths, standardPaths...), nil +} + +// getCustomFirmwareClassPath returns the custom firmware class path if it exists. +func getCustomFirmwareClassPath(logger *logrus.Logger) string { + customFirmwareClassPath, err := os.ReadFile("/sys/module/firmware_class/parameters/path") + if err != nil { + logger.Warningf("failed to get custom firmware class path: %v", err) + return "" + } + + return strings.TrimSpace(string(customFirmwareClassPath)) +} + // NewDriverFirmwareDiscoverer creates a discoverer for GSP firmware associated with the specified driver version. -func NewDriverFirmwareDiscoverer(logger *logrus.Logger, driverRoot string, version string) discover.Discover { - gspFirmwarePath := filepath.Join("/lib/firmware/nvidia", version, "gsp*.bin") +func NewDriverFirmwareDiscoverer(logger *logrus.Logger, driverRoot string, version string) (discover.Discover, error) { + gspFirmwareSearchPaths, err := getFirmwareSearchPaths(logger) + if err != nil { + return nil, fmt.Errorf("failed to get firmware search paths: %v", err) + } + gspFirmwarePaths := filepath.Join("nvidia", version, "gsp*.bin") return discover.NewMounts( logger, lookup.NewFileLocator( lookup.WithLogger(logger), lookup.WithRoot(driverRoot), + lookup.WithSearchPaths(gspFirmwareSearchPaths...), ), driverRoot, - []string{gspFirmwarePath}, - ) + []string{gspFirmwarePaths}, + ), nil } // NewDriverBinariesDiscoverer creates a discoverer for GSP firmware associated with the GPU driver. diff --git a/third_party/libnvidia-container b/third_party/libnvidia-container index 31e068e7..66607bd0 160000 --- a/third_party/libnvidia-container +++ b/third_party/libnvidia-container @@ -1 +1 @@ -Subproject commit 31e068e7ab3e2294a379cbf11cc7a99281f41b66 +Subproject commit 66607bd046341f7aad7de80a9f022f122d1f2fce diff --git a/versions.mk b/versions.mk index 010ed079..e4186db4 100644 --- a/versions.mk +++ b/versions.mk @@ -13,7 +13,7 @@ # limitations under the License. LIB_NAME := nvidia-container-toolkit -LIB_VERSION := 1.13.4 +LIB_VERSION := 1.13.5 LIB_TAG := # The package version is the combination of the library version and tag.