mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-04-10 15:25:33 +00:00
Use common code to construct nvidia-ctk hooks
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
27347c98d9
commit
19cfb2774d
internal/discover
@ -25,7 +25,6 @@ import (
|
|||||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/info/drm"
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/info/drm"
|
||||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/info/proc"
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/info/proc"
|
||||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/lookup"
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/lookup"
|
||||||
"github.com/container-orchestrated-devices/container-device-interface/pkg/cdi"
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -130,18 +129,18 @@ func (d drmDevicesByPath) Hooks() ([]Hook, error) {
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
args := []string{d.nvidiaCTKPath, "hook", "create-symlinks"}
|
var args []string
|
||||||
for _, l := range links {
|
for _, l := range links {
|
||||||
args = append(args, "--link", l)
|
args = append(args, "--link", l)
|
||||||
}
|
}
|
||||||
|
|
||||||
h := Hook{
|
hook := CreateNvidiaCTKHook(
|
||||||
Lifecycle: cdi.CreateContainerHook,
|
d.nvidiaCTKPath,
|
||||||
Path: d.nvidiaCTKPath,
|
"create-symlinks",
|
||||||
Args: args,
|
args...,
|
||||||
}
|
)
|
||||||
|
|
||||||
return []Hook{h}, nil
|
return []Hook{hook}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// getSpecificLinkArgs returns the required specic links that need to be created
|
// getSpecificLinkArgs returns the required specic links that need to be created
|
||||||
|
@ -21,7 +21,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/container-orchestrated-devices/container-device-interface/pkg/cdi"
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -47,7 +46,7 @@ func NewCreateSymlinksHook(logger *logrus.Logger, csvFiles []string, mounts Disc
|
|||||||
|
|
||||||
// Hooks returns a hook to create the symlinks from the required CSV files
|
// Hooks returns a hook to create the symlinks from the required CSV files
|
||||||
func (d symlinks) Hooks() ([]Hook, error) {
|
func (d symlinks) Hooks() ([]Hook, error) {
|
||||||
args := []string{d.nvidiaCTKPath, "hook", "create-symlinks"}
|
var args []string
|
||||||
for _, f := range d.csvFiles {
|
for _, f := range d.csvFiles {
|
||||||
args = append(args, "--csv-filename", f)
|
args = append(args, "--csv-filename", f)
|
||||||
}
|
}
|
||||||
@ -58,13 +57,13 @@ func (d symlinks) Hooks() ([]Hook, error) {
|
|||||||
}
|
}
|
||||||
args = append(args, links...)
|
args = append(args, links...)
|
||||||
|
|
||||||
h := Hook{
|
hook := CreateNvidiaCTKHook(
|
||||||
Lifecycle: cdi.CreateContainerHook,
|
d.nvidiaCTKPath,
|
||||||
Path: d.nvidiaCTKPath,
|
"create-symlinks",
|
||||||
Args: args,
|
args...,
|
||||||
}
|
)
|
||||||
|
|
||||||
return []Hook{h}, nil
|
return []Hook{hook}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// getSpecificLinkArgs returns the required specic links that need to be created
|
// getSpecificLinkArgs returns the required specic links that need to be created
|
||||||
|
Loading…
Reference in New Issue
Block a user