mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-25 21:39:10 +00:00
Skip missing by-path symlinks instead of failing
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
9faf11ddf3
commit
5575b391ff
@ -109,6 +109,13 @@ func (d drmDevicesByPath) Hooks() ([]Hook, error) {
|
|||||||
if len(devices) == 0 {
|
if len(devices) == 0 {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
links, err := d.getSpecificLinkArgs(devices)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to determine specific links: %v", err)
|
||||||
|
}
|
||||||
|
if len(links) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
hookPath := nvidiaCTKDefaultFilePath
|
hookPath := nvidiaCTKDefaultFilePath
|
||||||
targets, err := d.lookup.Locate(d.nvidiaCTKExecutablePath)
|
targets, err := d.lookup.Locate(d.nvidiaCTKExecutablePath)
|
||||||
@ -123,10 +130,6 @@ func (d drmDevicesByPath) Hooks() ([]Hook, error) {
|
|||||||
d.logger.Debugf("Using NVIDIA Container Toolkit CLI path %v", hookPath)
|
d.logger.Debugf("Using NVIDIA Container Toolkit CLI path %v", hookPath)
|
||||||
|
|
||||||
args := []string{hookPath, "hook", "create-symlinks"}
|
args := []string{hookPath, "hook", "create-symlinks"}
|
||||||
links, err := d.getSpecificLinkArgs(devices)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to determine specific links: %v", err)
|
|
||||||
}
|
|
||||||
for _, l := range links {
|
for _, l := range links {
|
||||||
args = append(args, "--link", l)
|
args = append(args, "--link", l)
|
||||||
}
|
}
|
||||||
@ -150,7 +153,8 @@ func (d drmDevicesByPath) getSpecificLinkArgs(devices []Device) ([]string, error
|
|||||||
linkLocator := lookup.NewFileLocator(d.logger, d.root)
|
linkLocator := lookup.NewFileLocator(d.logger, d.root)
|
||||||
candidates, err := linkLocator.Locate("/dev/dri/by-path/pci-*-*")
|
candidates, err := linkLocator.Locate("/dev/dri/by-path/pci-*-*")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to locate devices by path: %v", err)
|
d.logger.Warningf("Failed to locate by-path links: %v; ignoring", err)
|
||||||
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var links []string
|
var links []string
|
||||||
|
Loading…
Reference in New Issue
Block a user