From 00a712d0183b0ed0ac7fc15019321838b706de69 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Mon, 20 Nov 2023 14:24:39 +0100 Subject: [PATCH] Add --dev-root option to CDI spec generation Signed-off-by: Evan Lezar --- cmd/nvidia-ctk/cdi/generate/generate.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/nvidia-ctk/cdi/generate/generate.go b/cmd/nvidia-ctk/cdi/generate/generate.go index 63828336..124fbc0f 100644 --- a/cmd/nvidia-ctk/cdi/generate/generate.go +++ b/cmd/nvidia-ctk/cdi/generate/generate.go @@ -45,6 +45,7 @@ type options struct { format string deviceNameStrategy string driverRoot string + devRoot string nvidiaCTKPath string mode string vendor string @@ -101,6 +102,11 @@ func (m command) build() *cli.Command { Value: nvcdi.ModeAuto, Destination: &opts.mode, }, + &cli.StringFlag{ + Name: "dev-root", + Usage: "Specify the root where `/dev` is located. If this is not specified, the driver-root is assumed.", + Destination: &opts.devRoot, + }, &cli.StringFlag{ Name: "device-name-strategy", Usage: "Specify the strategy for generating device names. One of [index | uuid | type-index]", @@ -236,6 +242,7 @@ func (m command) generateSpec(opts *options) (spec.Interface, error) { cdilib, err := nvcdi.New( nvcdi.WithLogger(m.logger), nvcdi.WithDriverRoot(opts.driverRoot), + nvcdi.WithDevRoot(opts.devRoot), nvcdi.WithNVIDIACTKPath(opts.nvidiaCTKPath), nvcdi.WithDeviceNamer(deviceNamer), nvcdi.WithMode(opts.mode),