Skip to content

Fix CDI spec generation to respect driver root for Tegra CSV files#1675

Merged
elezar merged 4 commits intoNVIDIA:mainfrom
elezar:fix-csv-cdi-spec-generation
Apr 17, 2026
Merged

Fix CDI spec generation to respect driver root for Tegra CSV files#1675
elezar merged 4 commits intoNVIDIA:mainfrom
elezar:fix-csv-cdi-spec-generation

Conversation

@elezar
Copy link
Copy Markdown
Member

@elezar elezar commented Mar 25, 2026

On Tegra-based systems the nvcdi library resolves CSV mount specs from /etc/nvidia-container-runtime/host-files-for-container.d using hardcoded absolute paths, ignoring the configured driver root. When the device plugin runs in a container with the host filesystem mounted at a non-default driver root the CSV files are unreachable at their absolute paths, causing CDI spec generation to fail.

Inject driver-root-aware CSV file paths via nvcdi.WithCSVFiles() when the platform is detected as Tegra. The helper csvFilesForRoot() checks for the CSV directory under the driver root first, falling back to the absolute path, and returns nil (letting nvcdi use its own defaults) if neither location exists.

Also extend the NVML guard so that pure iGPU Tegra systems without NVML are not incorrectly reduced to a null CDI handler.

@elezar elezar force-pushed the fix-csv-cdi-spec-generation branch from 12ccba2 to 2ab68c1 Compare March 26, 2026 12:58
@elezar elezar force-pushed the fix-csv-cdi-spec-generation branch from 2ab68c1 to 2a9c65b Compare April 13, 2026 14:16
@elezar elezar marked this pull request as ready for review April 14, 2026 09:13
elezar and others added 4 commits April 15, 2026 10:40
On Tegra-based systems the nvcdi library resolves CSV mount specs from
/etc/nvidia-container-runtime/host-files-for-container.d using hardcoded
absolute paths, ignoring the configured driver root. When the device
plugin runs in a container with the host filesystem mounted at a
non-default driver root the CSV files are unreachable at their absolute
paths, causing CDI spec generation to fail.

Inject driver-root-aware CSV file paths via nvcdi.WithCSVFiles() when
the platform is detected as Tegra. The helper csvFilesForRoot() checks
for the CSV directory under the driver root first, falling back to the
absolute path, and returns nil (letting nvcdi use its own defaults) if
neither location exists.

Also extend the NVML guard so that pure iGPU Tegra systems without NVML
are not incorrectly reduced to a null CDI handler.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Evan Lezar <[email protected]>
…kages

Resolve the device discovery strategy once in GetPlugins() using a local
resolveStrategy() helper and pass the concrete value ("nvml", "tegra",
etc.) to both cdi.New() and plugin.New() via new WithDeviceDiscoveryStrategy
options. This eliminates duplicate infolib.ResolvePlatform() calls and
makes the dependency on platform detection explicit at the call site.

Both constructors now return an error when the strategy is not set rather
than falling back to their own resolution logic. The CDI handler uses the
strategy directly to gate CSV-mode behaviour instead of re-checking the
platform independently.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Evan Lezar <[email protected]>
When the device discovery strategy is "auto" but no supported platform
is detected, default to "nvml" instead of returning the unresolved
"auto" value. Log a warning so that the fallback is visible in the
device plugin output.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Evan Lezar <[email protected]>
This change updates the nvcdi API to 2c0c91d0ebaa45873d997b42beffad3706e8d734
to include the changes for NVIDIA/nvidia-container-toolkit#1745.

Signed-off-by: Evan Lezar <[email protected]>
@elezar elezar force-pushed the fix-csv-cdi-spec-generation branch from 2a9c65b to fe18b02 Compare April 15, 2026 08:40
Copy link
Copy Markdown
Contributor

@cdesiniotis cdesiniotis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one question.

Comment thread internal/cdi/cdi.go
@elezar elezar merged commit 93042e1 into NVIDIA:main Apr 17, 2026
11 checks passed
@elezar elezar deleted the fix-csv-cdi-spec-generation branch April 17, 2026 07:06
@elezar
Copy link
Copy Markdown
Member Author

elezar commented Apr 17, 2026

/cherry-pick release-0.19

@github-actions
Copy link
Copy Markdown

🤖 Backport PR created for release-0.19: #1701

@elezar elezar mentioned this pull request Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants