Skip to content

Commit 20abfcc

Browse files
committed
Remove create-soname-symlinks hook
This change removes the create-soname-symlinks hook introduced in v1.18.0-rc.1. Instead we rely on explicitly creating the .so -> SONAME -> .so.RM_VERSION symlink chain through the create-symlink hook. Signed-off-by: Evan Lezar <[email protected]>
1 parent 3a1f96c commit 20abfcc

File tree

9 files changed

+1
-263
lines changed

9 files changed

+1
-263
lines changed

cmd/nvidia-cdi-hook/commands/commands.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"github.com/urfave/cli/v3"
2121

2222
"github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-cdi-hook/chmod"
23-
createsonamesymlinks "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-cdi-hook/create-soname-symlinks"
2423
symlinks "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-cdi-hook/create-symlinks"
2524
"github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-cdi-hook/cudacompat"
2625
disabledevicenodemodification "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-cdi-hook/disable-device-node-modification"
@@ -36,7 +35,6 @@ func New(logger logger.Interface) []*cli.Command {
3635
symlinks.NewCommand(logger),
3736
chmod.NewCommand(logger),
3837
cudacompat.NewCommand(logger),
39-
createsonamesymlinks.NewCommand(logger),
4038
disabledevicenodemodification.NewCommand(logger),
4139
}
4240
}

cmd/nvidia-cdi-hook/create-soname-symlinks/soname-symlinks.go

Lines changed: 0 additions & 166 deletions
This file was deleted.

cmd/nvidia-ctk-installer/toolkit/toolkit_test.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,6 @@ containerEdits:
9898
- libcuda.so.1::/lib/x86_64-linux-gnu/libcuda.so
9999
env:
100100
- NVIDIA_CTK_DEBUG=false
101-
- hookName: createContainer
102-
path: {{ .toolkitRoot }}/nvidia-cdi-hook
103-
args:
104-
- nvidia-cdi-hook
105-
- create-soname-symlinks
106-
- --folder
107-
- /lib/x86_64-linux-gnu
108-
env:
109-
- NVIDIA_CTK_DEBUG=false
110101
- hookName: createContainer
111102
path: {{ .toolkitRoot }}/nvidia-cdi-hook
112103
args:

cmd/nvidia-ctk/cdi/generate/generate_test.go

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,6 @@ containerEdits:
102102
- --host-driver-version=999.88.77
103103
env:
104104
- NVIDIA_CTK_DEBUG=false
105-
- hookName: createContainer
106-
path: /usr/bin/nvidia-cdi-hook
107-
args:
108-
- nvidia-cdi-hook
109-
- create-soname-symlinks
110-
- --folder
111-
- /lib/x86_64-linux-gnu
112-
env:
113-
- NVIDIA_CTK_DEBUG=false
114105
- hookName: createContainer
115106
path: /usr/bin/nvidia-cdi-hook
116107
args:
@@ -188,15 +179,6 @@ containerEdits:
188179
- libcuda.so.1::/lib/x86_64-linux-gnu/libcuda.so
189180
env:
190181
- NVIDIA_CTK_DEBUG=false
191-
- hookName: createContainer
192-
path: /usr/bin/nvidia-cdi-hook
193-
args:
194-
- nvidia-cdi-hook
195-
- create-soname-symlinks
196-
- --folder
197-
- /lib/x86_64-linux-gnu
198-
env:
199-
- NVIDIA_CTK_DEBUG=false
200182
- hookName: createContainer
201183
path: /usr/bin/nvidia-cdi-hook
202184
args:
@@ -274,15 +256,6 @@ containerEdits:
274256
- libcuda.so.1::/lib/x86_64-linux-gnu/libcuda.so
275257
env:
276258
- NVIDIA_CTK_DEBUG=false
277-
- hookName: createContainer
278-
path: /usr/bin/nvidia-cdi-hook
279-
args:
280-
- nvidia-cdi-hook
281-
- create-soname-symlinks
282-
- --folder
283-
- /lib/x86_64-linux-gnu
284-
env:
285-
- NVIDIA_CTK_DEBUG=false
286259
- hookName: createContainer
287260
path: /usr/bin/nvidia-cdi-hook
288261
args:

internal/discover/hooks.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ const (
4646
// An UpdateLDCacheHook is the hook used to update the ldcache in the
4747
// container. This allows injected libraries to be discoverable.
4848
UpdateLDCacheHook = HookName("update-ldcache")
49-
// A CreateSonameSymlinksHook is the hook used to ensure that soname symlinks
50-
// for injected libraries exist in the container.
51-
CreateSonameSymlinksHook = HookName("create-soname-symlinks")
5249

5350
defaultNvidiaCDIHookPath = "/usr/bin/nvidia-cdi-hook"
5451
)

internal/discover/ldconfig.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,7 @@ func (d ldconfig) Hooks() ([]Hook, error) {
6161
args = append(args, "--folder", f)
6262
}
6363

64-
h := Merge(
65-
d.hookCreator.Create(CreateSonameSymlinksHook, args...),
66-
d.hookCreator.Create(UpdateLDCacheHook, args...),
67-
)
68-
69-
return h.Hooks()
64+
return d.hookCreator.Create(UpdateLDCacheHook, args...).Hooks()
7065
}
7166

7267
// getLibraryPaths extracts the library dirs from the specified mounts

internal/discover/ldconfig_test.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ func TestLDCacheUpdateHook(t *testing.T) {
4444
{
4545
description: "empty mounts",
4646
expectedHooks: []Hook{
47-
{
48-
Lifecycle: "createContainer",
49-
Path: testNvidiaCDIHookPath,
50-
Args: []string{"nvidia-cdi-hook", "create-soname-symlinks"},
51-
Env: []string{"NVIDIA_CTK_DEBUG=false"},
52-
},
5347
{
5448
Lifecycle: "createContainer",
5549
Path: testNvidiaCDIHookPath,
@@ -80,12 +74,6 @@ func TestLDCacheUpdateHook(t *testing.T) {
8074
},
8175
},
8276
expectedHooks: []Hook{
83-
{
84-
Lifecycle: "createContainer",
85-
Path: testNvidiaCDIHookPath,
86-
Args: []string{"nvidia-cdi-hook", "create-soname-symlinks", "--folder", "/usr/local/lib", "--folder", "/usr/local/libother"},
87-
Env: []string{"NVIDIA_CTK_DEBUG=false"},
88-
},
8977
{
9078
Lifecycle: "createContainer",
9179
Path: testNvidiaCDIHookPath,
@@ -103,12 +91,6 @@ func TestLDCacheUpdateHook(t *testing.T) {
10391
},
10492
},
10593
expectedHooks: []Hook{
106-
{
107-
Lifecycle: "createContainer",
108-
Path: testNvidiaCDIHookPath,
109-
Args: []string{"nvidia-cdi-hook", "create-soname-symlinks", "--folder", "/usr/local/lib"},
110-
Env: []string{"NVIDIA_CTK_DEBUG=false"},
111-
},
11294
{
11395
Lifecycle: "createContainer",
11496
Path: testNvidiaCDIHookPath,
@@ -121,12 +103,6 @@ func TestLDCacheUpdateHook(t *testing.T) {
121103
description: "explicit ldconfig path is passed",
122104
ldconfigPath: testLdconfigPath,
123105
expectedHooks: []Hook{
124-
{
125-
Lifecycle: "createContainer",
126-
Path: testNvidiaCDIHookPath,
127-
Args: []string{"nvidia-cdi-hook", "create-soname-symlinks", "--ldconfig-path", testLdconfigPath},
128-
Env: []string{"NVIDIA_CTK_DEBUG=false"},
129-
},
130106
{
131107
Lifecycle: "createContainer",
132108
Path: testNvidiaCDIHookPath,

internal/ldconfig/ldconfig.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -69,29 +69,6 @@ func New(ldconfigPath string, inRoot string) (*Ldconfig, error) {
6969
return l, nil
7070
}
7171

72-
// CreateSonameSymlinks uses ldconfig to create the soname symlinks in the
73-
// specified directories.
74-
func (l *Ldconfig) CreateSonameSymlinks(directories ...string) error {
75-
if len(directories) == 0 {
76-
return nil
77-
}
78-
ldconfigPath, err := l.prepareRoot()
79-
if err != nil {
80-
return err
81-
}
82-
83-
args := []string{
84-
filepath.Base(ldconfigPath),
85-
// Explicitly disable updating the LDCache.
86-
"-N",
87-
// Specify -n to only process the specified directories.
88-
"-n",
89-
}
90-
args = append(args, directories...)
91-
92-
return SafeExec(ldconfigPath, args, nil)
93-
}
94-
9572
func (l *Ldconfig) UpdateLDCache(directories ...string) error {
9673
ldconfigPath, err := l.prepareRoot()
9774
if err != nil {

pkg/nvcdi/api.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ const (
6363
EnableCudaCompatHook = discover.EnableCudaCompatHook
6464
// An UpdateLDCacheHook is used to update the ldcache in the container.
6565
UpdateLDCacheHook = discover.UpdateLDCacheHook
66-
// A CreateSonameSymlinksHook is the hook used to ensure that soname symlinks
67-
// for injected libraries exist in the container.
68-
CreateSonameSymlinksHook = discover.CreateSonameSymlinksHook
6966

7067
// Deprecated: Use CreateSymlinksHook instead.
7168
HookCreateSymlinks = CreateSymlinksHook

0 commit comments

Comments
 (0)