From 9f46c345871ab7ee51ba20869ab5009a1fa02e71 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Tue, 18 Jul 2023 14:12:00 +0200 Subject: [PATCH] Support device name strategies for Tegra devices This change generates CDI specifications for Tegra devices with the nvidia.com/gpu=0 name by default. The type-index nameing strategy is also supported and will generate a device with the name nvidia.com/gpu=gpu0. The uuid naming strategy will raise an error if selected. Signed-off-by: Evan Lezar --- pkg/nvcdi/lib-csv.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/nvcdi/lib-csv.go b/pkg/nvcdi/lib-csv.go index 127c4beb..997724bf 100644 --- a/pkg/nvcdi/lib-csv.go +++ b/pkg/nvcdi/lib-csv.go @@ -53,8 +53,13 @@ func (l *csvlib) GetAllDeviceSpecs() ([]specs.Device, error) { return nil, fmt.Errorf("failed to create container edits for CSV files: %v", err) } + name, err := l.deviceNamer.GetDeviceName(0, uuidUnsupported{}) + if err != nil { + return nil, fmt.Errorf("failed to get device name: %v", err) + } + deviceSpec := specs.Device{ - Name: "all", + Name: name, ContainerEdits: *e.ContainerEdits, } return []specs.Device{deviceSpec}, nil