Merge branch 'minor-refactor' into 'main'

Include xorg discoverer with graphics mounts

See merge request nvidia/container-toolkit/container-toolkit!392
This commit is contained in:
Evan Lezar 2023-05-12 13:12:06 +00:00
commit 5bc72b70b8
2 changed files with 6 additions and 6 deletions

View File

@ -32,7 +32,7 @@ import (
// NewGraphicsDiscoverer returns the discoverer for graphics tools such as Vulkan. // NewGraphicsDiscoverer returns the discoverer for graphics tools such as Vulkan.
func NewGraphicsDiscoverer(logger *logrus.Logger, devices image.VisibleDevices, driverRoot string, nvidiaCTKPath string) (Discover, error) { func NewGraphicsDiscoverer(logger *logrus.Logger, devices image.VisibleDevices, driverRoot string, nvidiaCTKPath string) (Discover, error) {
mounts, err := NewGraphicsMountsDiscoverer(logger, driverRoot) mounts, err := NewGraphicsMountsDiscoverer(logger, driverRoot, nvidiaCTKPath)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to create mounts discoverer: %v", err) return nil, fmt.Errorf("failed to create mounts discoverer: %v", err)
} }
@ -44,19 +44,16 @@ func NewGraphicsDiscoverer(logger *logrus.Logger, devices image.VisibleDevices,
drmByPathSymlinks := newCreateDRMByPathSymlinks(logger, drmDeviceNodes, driverRoot, nvidiaCTKPath) drmByPathSymlinks := newCreateDRMByPathSymlinks(logger, drmDeviceNodes, driverRoot, nvidiaCTKPath)
xorg := optionalXorgDiscoverer(logger, driverRoot, nvidiaCTKPath)
discover := Merge( discover := Merge(
Merge(drmDeviceNodes, drmByPathSymlinks), Merge(drmDeviceNodes, drmByPathSymlinks),
mounts, mounts,
xorg,
) )
return discover, nil return discover, nil
} }
// NewGraphicsMountsDiscoverer creates a discoverer for the mounts required by graphics tools such as vulkan. // NewGraphicsMountsDiscoverer creates a discoverer for the mounts required by graphics tools such as vulkan.
func NewGraphicsMountsDiscoverer(logger *logrus.Logger, driverRoot string) (Discover, error) { func NewGraphicsMountsDiscoverer(logger *logrus.Logger, driverRoot string, nvidiaCTKPath string) (Discover, error) {
locator, err := lookup.NewLibraryLocator(logger, driverRoot) locator, err := lookup.NewLibraryLocator(logger, driverRoot)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to construct library locator: %v", err) return nil, fmt.Errorf("failed to construct library locator: %v", err)
@ -87,9 +84,12 @@ func NewGraphicsMountsDiscoverer(logger *logrus.Logger, driverRoot string) (Disc
}, },
) )
xorg := optionalXorgDiscoverer(logger, driverRoot, nvidiaCTKPath)
discover := Merge( discover := Merge(
libraries, libraries,
jsonMounts, jsonMounts,
xorg,
) )
return discover, nil return discover, nil

View File

@ -44,7 +44,7 @@ func newCommonNVMLDiscoverer(logger *logrus.Logger, driverRoot string, nvidiaCTK
}, },
) )
graphicsMounts, err := discover.NewGraphicsMountsDiscoverer(logger, driverRoot) graphicsMounts, err := discover.NewGraphicsMountsDiscoverer(logger, driverRoot, nvidiaCTKPath)
if err != nil { if err != nil {
return nil, fmt.Errorf("error constructing discoverer for graphics mounts: %v", err) return nil, fmt.Errorf("error constructing discoverer for graphics mounts: %v", err)
} }