Merge pull request #660 from elezar/fix-libnvidia-allocator-duplicate-mount

Exclude libnvidia-allocator from graphics mounts
This commit is contained in:
Evan Lezar 2024-08-22 14:00:25 +02:00 committed by GitHub
commit c3c0cdcc89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 8 deletions

View File

@ -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()

View File

@ -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",
@ -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",
},