Skip to content

Commit 2c926bb

Browse files
committed
Fix duplicate specs for jit-cdi mode
Signed-off-by: Evan Lezar <[email protected]>
1 parent 1ffedf2 commit 2c926bb

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
@@ -211,7 +211,7 @@ type cdiModeIdentifiers struct {
211211
func cdiModeIdentfiersFromDevices(devices ...string) *cdiModeIdentifiers {
212212
perModeIdentifiers := make(map[string][]string)
213213
perModeDeviceClass := map[string]string{"auto": automaticDeviceClass}
214-
uniqueModes := []string{"auto"}
214+
var uniqueModes []string
215215
seen := make(map[string]bool)
216216
for _, device := range devices {
217217
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)