Merge branch 'CNT-3963/deduplicate-wsl-driverstore-paths' into 'main'

Deduplicate WSL driverstore paths

See merge request nvidia/container-toolkit/container-toolkit!304
This commit is contained in:
Evan Lezar 2023-02-27 13:27:31 +00:00
commit 7986ff9cee

View File

@ -49,9 +49,15 @@ func Shutdown() error {
// GetDriverStorePaths returns the list of driver store paths // GetDriverStorePaths returns the list of driver store paths
func GetDriverStorePaths() []string { func GetDriverStorePaths() []string {
var paths []string var paths []string
selected := make(map[string]bool)
for i := 0; i < dxcore.getAdapterCount(); i++ { for i := 0; i < dxcore.getAdapterCount(); i++ {
adapter := dxcore.getAdapter(i) path := dxcore.getAdapter(i).getDriverStorePath()
paths = append(paths, adapter.getDriverStorePath()) if selected[path] {
continue
}
selected[path] = true
paths = append(paths, path)
} }
return paths return paths