Add csv mode to nvidia-ctk cdi generate command

This chagne allows the csv mode option to specified in the
nvidia-ctk cdi generate command and adds a --csv.file option
that can be repeated to specify the CSV files to be processed.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2023-05-10 16:28:59 +02:00
parent 418e4014e6
commit e30fd0f4ad
3 changed files with 31 additions and 6 deletions

View File

@@ -33,6 +33,22 @@ const (
DefaultMountSpecPath = "/etc/nvidia-container-runtime/host-files-for-container.d"
)
// DefaultFileList returns the list of CSV files that are used by default.
func DefaultFileList() []string {
files := []string{
"devices.csv",
"drivers.csv",
"l4t.csv",
}
var paths []string
for _, file := range files {
paths = append(paths, filepath.Join(DefaultMountSpecPath, file))
}
return paths
}
// GetFileList returns the (non-recursive) list of CSV files in the specified
// folder
func GetFileList(root string) ([]string, error) {