Skip to content

Commit e810a73

Browse files
elezarArangoGutierrez
authored andcommitted
Fix duplicate specs for jit-cdi mode
Signed-off-by: Evan Lezar <[email protected]>
1 parent 8c210ac commit e810a73

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

internal/modifier/cdi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ type cdiModeIdentifiers struct {
212212
func cdiModeIdentfiersFromDevices(devices ...string) *cdiModeIdentifiers {
213213
perModeIdentifiers := make(map[string][]string)
214214
perModeDeviceClass := map[string]string{"auto": automaticDeviceClass}
215-
uniqueModes := []string{"auto"}
215+
var uniqueModes []string
216216
seen := make(map[string]bool)
217217
for _, device := range devices {
218218
mode, id := getModeIdentifier(device)

internal/modifier/cdi_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func Test_cdiModeIdentfiersFromDevices(t *testing.T) {
181181
description: "empty device list",
182182
devices: []string{},
183183
expected: &cdiModeIdentifiers{
184-
modes: []string{"auto"},
184+
modes: nil,
185185
idsByMode: map[string][]string{},
186186
deviceClassByMode: map[string]string{"auto": "gpu"},
187187
},
@@ -208,7 +208,7 @@ func Test_cdiModeIdentfiersFromDevices(t *testing.T) {
208208
description: "device with explicit mode",
209209
devices: []string{"mode=gds,id=foo"},
210210
expected: &cdiModeIdentifiers{
211-
modes: []string{"auto", "gds"},
211+
modes: []string{"gds"},
212212
idsByMode: map[string][]string{"gds": {"foo"}},
213213
deviceClassByMode: map[string]string{"auto": "gpu"},
214214
},
@@ -231,15 +231,15 @@ func Test_cdiModeIdentfiersFromDevices(t *testing.T) {
231231
devices: []string{"mode=nvswitch"},
232232
expected: &cdiModeIdentifiers{
233233
modes: []string{"nvswitch"},
234-
idsByMode: map[string][]string{"nvswitch": {}},
234+
idsByMode: map[string][]string{},
235235
deviceClassByMode: map[string]string{"auto": "gpu"},
236236
},
237237
},
238238
{
239239
description: "duplicate modes",
240240
devices: []string{"mode=gds,id=x", "mode=gds,id=y", "mode=gds"},
241241
expected: &cdiModeIdentifiers{
242-
modes: []string{"auto", "gds"},
242+
modes: []string{"gds"},
243243
idsByMode: map[string][]string{"gds": {"x", "y"}},
244244
deviceClassByMode: map[string]string{"auto": "gpu"},
245245
},

0 commit comments

Comments
 (0)