Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly pass configSearchPaths to a Driver constructor #847

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mihalicyn
Copy link

Without this fix it's not possible to use a custom config search path option with nvcdi interface.

mihalicyn added a commit to mihalicyn/lxd-pkg-snap that referenced this pull request Jan 7, 2025
…variable

We have to adjust XDG_DATA_DIRS variable to make nvidia-container-toolkit
happy and find necessary configuration files. Actually, XDG_DATA_DIRS environment
variable value we provided with is already correct (it's getting prepared for us in
https://github.com/canonical/mesa-2404/blob/main/scripts/bin/gpu-2404-provider-wrapper.in
and
https://git.launchpad.net/~canonical-kernel-snaps/canonical-kernel-snaps/+git/kernel-snaps-u24.04/tree/hooks/kernel-gpu-2404-provider-mangler?h=pc-components)
but for some reason nvidia-container-toolkit library expects these path to be relative to driver root,
which leads to a situation when driver root is getting appended twice to a path and files
can not be found. One possible (and clean) solution would be to explicitly
specify config files seach path with nvcdi.WithConfigSearchPaths() but it doesn't
work because of a bug NVIDIA/nvidia-container-toolkit#847.

So the easiest way I found is to adjust XDG_DATA_DIRS variable in that weird way
so when nvidia-container-toolkit prepend driverRoot to it a final path became
valid and everything works.

Signed-off-by: Alexander Mikhalitsyn <[email protected]>
mihalicyn added a commit to mihalicyn/lxd-pkg-snap that referenced this pull request Jan 8, 2025
…variable

We have to adjust XDG_DATA_DIRS variable to make nvidia-container-toolkit
happy and find necessary configuration files. Actually, XDG_DATA_DIRS environment
variable value we provided with is already correct (it's getting prepared for us in
https://github.com/canonical/mesa-2404/blob/main/scripts/bin/gpu-2404-provider-wrapper.in
and
https://git.launchpad.net/~canonical-kernel-snaps/canonical-kernel-snaps/+git/kernel-snaps-u24.04/tree/hooks/kernel-gpu-2404-provider-mangler?h=pc-components)
but for some reason nvidia-container-toolkit library expects these path to be relative to driver root,
which leads to a situation when driver root is getting appended twice to a path and files
can not be found. One possible (and clean) solution would be to explicitly
specify config files seach path with nvcdi.WithConfigSearchPaths() but it doesn't
work because of a bug NVIDIA/nvidia-container-toolkit#847.

So the easiest way I found is to adjust XDG_DATA_DIRS variable in that weird way
so when nvidia-container-toolkit prepend driverRoot to it a final path became
valid and everything works.

Signed-off-by: Alexander Mikhalitsyn <[email protected]>
tomponline added a commit to canonical/lxd-pkg-snap that referenced this pull request Jan 8, 2025
…variable (#679)

We have to adjust XDG_DATA_DIRS variable to make
nvidia-container-toolkit happy and find necessary configuration files.
Actually, XDG_DATA_DIRS environment variable value we provided with is
already correct (it's getting prepared for us in
https://github.com/canonical/mesa-2404/blob/main/scripts/bin/gpu-2404-provider-wrapper.in
and

https://git.launchpad.net/~canonical-kernel-snaps/canonical-kernel-snaps/+git/kernel-snaps-u24.04/tree/hooks/kernel-gpu-2404-provider-mangler?h=pc-components)
but for some reason nvidia-container-toolkit library expects these path
to be relative to driver root, which leads to a situation when driver
root is getting appended twice to a path and files can not be found. One
possible (and clean) solution would be to explicitly specify config
files search path with nvcdi.WithConfigSearchPaths() but it doesn't work
because of a bug
NVIDIA/nvidia-container-toolkit#847.

So the easiest way I found is to adjust XDG_DATA_DIRS variable in that
weird way so when nvidia-container-toolkit prepend driverRoot to it a
final path became valid and everything works.

This is to fix an issue with delivering some of the nvidia files that
CDI does by default, which are the config files for things like Vulkan
and EGL The files are included in the kernels user components, so it
just seems like LXD is excluding passing them through via CDI.

Please don't consider this an exhaustive list of files, necessarily, but
examples are:

```
/usr/share/glvnd/egl_vendor.d/10_nvidia.json
/usr/share/glvnd/egl_vendor.d/50_mesa.json
/usr/share/vulkan/icd.d/nvidia_icd.json
/usr/share/vulkan/implicit_layer.d/nvidia_layers.json
/usr/share/egl/egl_external_platform.d/15_nvidia_gbm.json
/usr/share/egl/egl_external_platform.d/10_nvidia_wayland.json
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant