Add --dev-root option to CDI spec generation

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2023-11-20 14:24:39 +01:00
parent d4e21fdd10
commit 00a712d018

View File

@ -45,6 +45,7 @@ type options struct {
format string format string
deviceNameStrategy string deviceNameStrategy string
driverRoot string driverRoot string
devRoot string
nvidiaCTKPath string nvidiaCTKPath string
mode string mode string
vendor string vendor string
@ -101,6 +102,11 @@ func (m command) build() *cli.Command {
Value: nvcdi.ModeAuto, Value: nvcdi.ModeAuto,
Destination: &opts.mode, 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{ &cli.StringFlag{
Name: "device-name-strategy", Name: "device-name-strategy",
Usage: "Specify the strategy for generating device names. One of [index | uuid | type-index]", 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( cdilib, err := nvcdi.New(
nvcdi.WithLogger(m.logger), nvcdi.WithLogger(m.logger),
nvcdi.WithDriverRoot(opts.driverRoot), nvcdi.WithDriverRoot(opts.driverRoot),
nvcdi.WithDevRoot(opts.devRoot),
nvcdi.WithNVIDIACTKPath(opts.nvidiaCTKPath), nvcdi.WithNVIDIACTKPath(opts.nvidiaCTKPath),
nvcdi.WithDeviceNamer(deviceNamer), nvcdi.WithDeviceNamer(deviceNamer),
nvcdi.WithMode(opts.mode), nvcdi.WithMode(opts.mode),