Skip to content

Exclude libnvidia-allocator from graphics mounts #663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions internal/discover/graphics.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,27 @@ func newGraphicsLibrariesDiscoverer(logger logger.Interface, driver *root.Driver
}
}

// Mounts discovers the required libraries and filters out libnvidia-allocator.so.
// The library libnvidia-allocator.so is already handled by either the *.RM_VERSION
// injection or by libnvidia-container. We therefore filter it out here as a
// workaround for the case where libnvidia-container will re-mount this in the
// container, which causes issues with shared mount propagation.
func (d graphicsDriverLibraries) Mounts() ([]Mount, error) {
mounts, err := d.Discover.Mounts()
if err != nil {
return nil, fmt.Errorf("failed to get library mounts: %v", err)
}

var filtered []Mount
for _, mount := range mounts {
if d.isDriverLibrary(filepath.Base(mount.Path), "libnvidia-allocator.so") {
continue
}
filtered = append(filtered, mount)
}
return filtered, nil
}

// Create necessary library symlinks for graphics drivers
func (d graphicsDriverLibraries) Hooks() ([]Hook, error) {
mounts, err := d.Discover.Mounts()
Expand Down
9 changes: 1 addition & 8 deletions internal/discover/graphics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ func TestGraphicsLibrariesDiscoverer(t *testing.T) {
return mounts, nil
},
},
expectedMounts: []Mount{
{
Path: "/usr/lib64/libnvidia-allocator.so.123.45.67",
},
},
expectedMounts: nil,
expectedHooks: []Hook{
{
Lifecycle: "createContainer",
Expand Down Expand Up @@ -121,9 +117,6 @@ func TestGraphicsLibrariesDiscoverer(t *testing.T) {
},
},
expectedMounts: []Mount{
{
Path: "/usr/lib64/libnvidia-allocator.so.123.45.67",
},
{
Path: "/usr/lib64/libnvidia-vulkan-producer.so.123.45.67",
},
Expand Down