Merge branch 'cherry-pick-v1.13.5' into 'release-1.13'

Cherry pick changes for v1.13.5 release

See merge request nvidia/container-toolkit/container-toolkit!446
This commit is contained in:
Carlos Eduardo Arango Gutierrez 2023-07-18 11:28:52 +00:00
commit 6b8589dcb4
6 changed files with 70 additions and 20 deletions

View File

@ -138,16 +138,6 @@ scan-centos7-amd64:
needs: needs:
- image-centos7 - image-centos7
scan-centos7-arm64:
extends:
- .dist-centos7
- .platform-arm64
- .scan
needs:
- image-centos7
- scan-centos7-amd64
allow_failure: true
scan-ubuntu20.04-amd64: scan-ubuntu20.04-amd64:
extends: extends:
- .dist-ubuntu20.04 - .dist-ubuntu20.04

View File

@ -1,5 +1,11 @@
# NVIDIA Container Toolkit Changelog # 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 ## v1.13.4
* [toolkit-container] Bump CUDA base image version to 12.2.0. * [toolkit-container] Bump CUDA base image version to 12.2.0.

View File

@ -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 install -m 644 -t %{buildroot}/usr/share/containers/oci/hooks.d oci-nvidia-hook.json
%post %post
mkdir -p %{_localstatedir}/lib/rpm-state/nvidia-container-toolkit if [ $1 -gt 1 ]; then # only on package upgrade
cp -af %{_bindir}/nvidia-container-runtime-hook %{_localstatedir}/lib/rpm-state/nvidia-container-toolkit 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 %posttrans
if [ ! -e %{_bindir}/nvidia-container-runtime-hook ]; then 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} cp -avf %{_localstatedir}/lib/rpm-state/nvidia-container-toolkit/nvidia-container-runtime-hook %{_bindir}
fi fi
rm -rf %{_localstatedir}/lib/rpm-state/nvidia-container-toolkit rm -rf %{_localstatedir}/lib/rpm-state/nvidia-container-toolkit

View File

@ -18,6 +18,7 @@ package nvcdi
import ( import (
"fmt" "fmt"
"os"
"path/filepath" "path/filepath"
"strings" "strings"
@ -26,6 +27,7 @@ import (
"github.com/NVIDIA/nvidia-container-toolkit/internal/lookup/cuda" "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup/cuda"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"gitlab.com/nvidia/cloud-native/go-nvlib/pkg/nvml" "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. // 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) 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) binaries := NewDriverBinariesDiscoverer(logger, driverRoot)
@ -100,18 +105,65 @@ func NewDriverLibraryDiscoverer(logger *logrus.Logger, driverRoot string, nvidia
return d, nil 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. // NewDriverFirmwareDiscoverer creates a discoverer for GSP firmware associated with the specified driver version.
func NewDriverFirmwareDiscoverer(logger *logrus.Logger, driverRoot string, version string) discover.Discover { func NewDriverFirmwareDiscoverer(logger *logrus.Logger, driverRoot string, version string) (discover.Discover, error) {
gspFirmwarePath := filepath.Join("/lib/firmware/nvidia", version, "gsp*.bin") 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( return discover.NewMounts(
logger, logger,
lookup.NewFileLocator( lookup.NewFileLocator(
lookup.WithLogger(logger), lookup.WithLogger(logger),
lookup.WithRoot(driverRoot), lookup.WithRoot(driverRoot),
lookup.WithSearchPaths(gspFirmwareSearchPaths...),
), ),
driverRoot, driverRoot,
[]string{gspFirmwarePath}, []string{gspFirmwarePaths},
) ), nil
} }
// NewDriverBinariesDiscoverer creates a discoverer for GSP firmware associated with the GPU driver. // NewDriverBinariesDiscoverer creates a discoverer for GSP firmware associated with the GPU driver.

@ -1 +1 @@
Subproject commit 31e068e7ab3e2294a379cbf11cc7a99281f41b66 Subproject commit 66607bd046341f7aad7de80a9f022f122d1f2fce

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
LIB_NAME := nvidia-container-toolkit LIB_NAME := nvidia-container-toolkit
LIB_VERSION := 1.13.4 LIB_VERSION := 1.13.5
LIB_TAG := LIB_TAG :=
# The package version is the combination of the library version and tag. # The package version is the combination of the library version and tag.