Make discovery of Xorg libraries optional

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2023-04-13 14:21:57 +02:00
parent a95232dd33
commit 2136266d1d
2 changed files with 13 additions and 4 deletions

View File

@ -4,6 +4,7 @@
* Update `update-ldcache` hook to only update ldcache if it exists. * Update `update-ldcache` hook to only update ldcache if it exists.
* Update `update-ldcache` hook to create `/etc/ld.so.conf.d` folder if it doesn't exist. * Update `update-ldcache` hook to create `/etc/ld.so.conf.d` folder if it doesn't exist.
* Fix failure when libcuda cannot be located during XOrg library discovery.
## v1.13.0 ## v1.13.0

View File

@ -46,10 +46,7 @@ func NewGraphicsDiscoverer(logger *logrus.Logger, devices image.VisibleDevices,
drmByPathSymlinks := newCreateDRMByPathSymlinks(logger, drmDeviceNodes, cfg) drmByPathSymlinks := newCreateDRMByPathSymlinks(logger, drmDeviceNodes, cfg)
xorg, err := newXorgDiscoverer(logger, driverRoot, cfg.NvidiaCTKPath) xorg := optionalXorgDiscoverer(logger, driverRoot, cfg.NvidiaCTKPath)
if err != nil {
return nil, fmt.Errorf("failed to create Xorg discoverer: %v", err)
}
discover := Merge( discover := Merge(
Merge(drmDeviceNodes, drmByPathSymlinks), Merge(drmDeviceNodes, drmByPathSymlinks),
@ -259,6 +256,17 @@ type xorgHooks struct {
var _ Discover = (*xorgHooks)(nil) var _ Discover = (*xorgHooks)(nil)
// optionalXorgDiscoverer creates a discoverer for Xorg libraries.
// If the creation of the discoverer fails, a None discoverer is returned.
func optionalXorgDiscoverer(logger *logrus.Logger, driverRoot string, nvidiaCTKPath string) Discover {
xorg, err := newXorgDiscoverer(logger, driverRoot, nvidiaCTKPath)
if err != nil {
logger.Warnf("Failed to create Xorg discoverer: %v; skipping xorg libraries", err)
return None{}
}
return xorg
}
func newXorgDiscoverer(logger *logrus.Logger, driverRoot string, nvidiaCTKPath string) (Discover, error) { func newXorgDiscoverer(logger *logrus.Logger, driverRoot string, nvidiaCTKPath string) (Discover, error) {
libCudaPaths, err := cuda.New( libCudaPaths, err := cuda.New(
cuda.WithLogger(logger), cuda.WithLogger(logger),