From cdaaf5e46fe8fd05cbb7de0ebe0a2db849c16a4d Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Mon, 27 Mar 2023 23:02:24 +0200 Subject: [PATCH] Generate device nodes when creating management spec Signed-off-by: Evan Lezar --- tools/container/toolkit/toolkit.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/container/toolkit/toolkit.go b/tools/container/toolkit/toolkit.go index f07d48b9..e33a9d2b 100644 --- a/tools/container/toolkit/toolkit.go +++ b/tools/container/toolkit/toolkit.go @@ -23,6 +23,7 @@ import ( "path/filepath" "strings" + "github.com/NVIDIA/nvidia-container-toolkit/internal/system" "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi" "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/transform" "github.com/container-orchestrated-devices/container-device-interface/pkg/cdi" @@ -608,6 +609,16 @@ func generateCDISpec(opts *options, nvidiaCTKPath string) error { return nil } + log.Infof("Creating control device nodes at %v", opts.DriverRootCtrPath) + s, err := system.New() + if err != nil { + return fmt.Errorf("failed to create library: %v", err) + } + if err := s.CreateNVIDIAControlDeviceNodesAt(opts.DriverRootCtrPath); err != nil { + return fmt.Errorf("failed to create control device nodes: %v", err) + } + + log.Info("Generating CDI spec for management containers") cdilib, err := nvcdi.New( nvcdi.WithMode(nvcdi.ModeManagement), nvcdi.WithDriverRoot(opts.DriverRootCtrPath),