Skip to content

Commit 013af89

Browse files
committed
Raise an error if a device has migEnabled=true but has no MIG devices
This change aligns the behaviour of mig.strategy=mixed with that of mig.strategy=single when a device is configured with migEnabled=true but has no MIG devices associated with it. Signed-off-by: Evan Lezar <[email protected]>
1 parent f8b50cc commit 013af89

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mig-strategy.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,11 @@ func (s *migStrategySingle) MatchesResource(mig *nvml.Device, resource string) b
167167
func (s *migStrategyMixed) GetPlugins() []*NvidiaDevicePlugin {
168168
devices := NewMIGCapableDevices()
169169

170-
resources := make(MigStrategyResourceSet)
170+
if err := devices.AssertAllMigEnabledDevicesAreValid(); err != nil {
171+
panic(fmt.Errorf("At least one device with migEnabled=true was not configured corectly: %v", err))
172+
}
171173

174+
resources := make(MigStrategyResourceSet)
172175
migs, err := devices.GetAllMigDevices()
173176
if err != nil {
174177
panic(fmt.Errorf("Unable to retrieve list of MIG devices: %v", err))

0 commit comments

Comments
 (0)