diff --git a/internal/discover/graphics.go b/internal/discover/graphics.go index c0f058da..7847314c 100644 --- a/internal/discover/graphics.go +++ b/internal/discover/graphics.go @@ -25,7 +25,6 @@ import ( "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/lookup" - "github.com/container-orchestrated-devices/container-device-interface/pkg/cdi" "github.com/sirupsen/logrus" ) @@ -130,18 +129,18 @@ func (d drmDevicesByPath) Hooks() ([]Hook, error) { return nil, nil } - args := []string{d.nvidiaCTKPath, "hook", "create-symlinks"} + var args []string for _, l := range links { args = append(args, "--link", l) } - h := Hook{ - Lifecycle: cdi.CreateContainerHook, - Path: d.nvidiaCTKPath, - Args: args, - } + hook := CreateNvidiaCTKHook( + d.nvidiaCTKPath, + "create-symlinks", + args..., + ) - return []Hook{h}, nil + return []Hook{hook}, nil } // getSpecificLinkArgs returns the required specic links that need to be created diff --git a/internal/discover/symlinks.go b/internal/discover/symlinks.go index a8f904c1..b5d344e3 100644 --- a/internal/discover/symlinks.go +++ b/internal/discover/symlinks.go @@ -21,7 +21,6 @@ import ( "path/filepath" "strings" - "github.com/container-orchestrated-devices/container-device-interface/pkg/cdi" "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 func (d symlinks) Hooks() ([]Hook, error) { - args := []string{d.nvidiaCTKPath, "hook", "create-symlinks"} + var args []string for _, f := range d.csvFiles { args = append(args, "--csv-filename", f) } @@ -58,13 +57,13 @@ func (d symlinks) Hooks() ([]Hook, error) { } args = append(args, links...) - h := Hook{ - Lifecycle: cdi.CreateContainerHook, - Path: d.nvidiaCTKPath, - Args: args, - } + hook := CreateNvidiaCTKHook( + d.nvidiaCTKPath, + "create-symlinks", + args..., + ) - return []Hook{h}, nil + return []Hook{hook}, nil } // getSpecificLinkArgs returns the required specic links that need to be created