From 1597ede2afe96a9f6e5e5770480301ba78435e2e Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Mon, 10 Oct 2022 10:19:08 +0200 Subject: [PATCH] Add all device Signed-off-by: Evan Lezar --- cmd/nvidia-ctk/info/generate-cdi/generate-cdi.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cmd/nvidia-ctk/info/generate-cdi/generate-cdi.go b/cmd/nvidia-ctk/info/generate-cdi/generate-cdi.go index 23508423..7ef290b4 100644 --- a/cmd/nvidia-ctk/info/generate-cdi/generate-cdi.go +++ b/cmd/nvidia-ctk/info/generate-cdi/generate-cdi.go @@ -176,6 +176,21 @@ func (m command) generateSpec() (*specs.Spec, error) { return nil, fmt.Errorf("falied to generate CDI spec for MIG devices: %v", err) } + // We create an "all" device with all the discovered device nodes + var allDeviceNodes []*specs.DeviceNode + for _, d := range spec.Devices { + for _, dn := range d.ContainerEdits.DeviceNodes { + allDeviceNodes = append(allDeviceNodes, dn) + } + } + all := specs.Device{ + Name: "all", + ContainerEdits: specs.ContainerEdits{ + DeviceNodes: allDeviceNodes, + }, + } + + spec.Devices = append(spec.Devices, all) spec.ContainerEdits.DeviceNodes = m.getExistingMetaDeviceNodes() libraries, err := m.findLibs(nvmllib)