@@ -144,8 +144,8 @@ func (i CUDA) HasDisableRequire() bool {
144144 return false
145145}
146146
147- // DevicesFromEnvvars returns the devices requested by the image through environment variables
148- func (i CUDA ) DevicesFromEnvvars (envVars ... string ) VisibleDevices {
147+ // devicesFromEnvvars returns the devices requested by the image through environment variables
148+ func (i CUDA ) devicesFromEnvvars (envVars ... string ) [] string {
149149 // We concantenate all the devices from the specified env.
150150 var isSet bool
151151 var devices []string
@@ -166,15 +166,15 @@ func (i CUDA) DevicesFromEnvvars(envVars ...string) VisibleDevices {
166166
167167 // Environment variable unset with legacy image: default to "all".
168168 if ! isSet && len (devices ) == 0 && i .IsLegacy () {
169- return NewVisibleDevices ( "all" )
169+ devices = [] string { "all" }
170170 }
171171
172172 // Environment variable unset or empty or "void": return nil
173173 if len (devices ) == 0 || requested ["void" ] {
174- return NewVisibleDevices ( "void" )
174+ devices = [] string { "void" }
175175 }
176176
177- return NewVisibleDevices (devices ... )
177+ return NewVisibleDevices (devices ... ). List ()
178178}
179179
180180// GetDriverCapabilities returns the requested driver capabilities.
@@ -328,7 +328,7 @@ func (i CUDA) cdiDeviceRequestsFromAnnotations() []string {
328328// NVIDIA_VISIBLE_DEVICES environment variable is used.
329329func (i CUDA ) visibleDevicesFromEnvVar () []string {
330330 envVars := i .visibleEnvVars ()
331- return i .DevicesFromEnvvars (envVars ... ). List ( )
331+ return i .devicesFromEnvvars (envVars ... )
332332}
333333
334334// visibleDevicesFromMounts returns the set of visible devices requested as mounts.
@@ -414,7 +414,7 @@ func (m cdiDeviceMountRequest) qualifiedName() (string, error) {
414414
415415// ImexChannelsFromEnvVar returns the list of IMEX channels requested for the image.
416416func (i CUDA ) ImexChannelsFromEnvVar () []string {
417- imexChannels := i .DevicesFromEnvvars (EnvVarNvidiaImexChannels ). List ( )
417+ imexChannels := i .devicesFromEnvvars (EnvVarNvidiaImexChannels )
418418 if len (imexChannels ) == 1 && imexChannels [0 ] == "all" {
419419 return nil
420420 }
0 commit comments