@@ -595,6 +595,12 @@ func (alloc *allocator) allocateOne(r deviceIndices) (bool, error) {
595
595
596
596
// We need to find suitable devices.
597
597
for _ , pool := range alloc .pools {
598
+ // If the pool is not valid, then fail now. It's okay when pools of one driver
599
+ // are invalid if we allocate from some other pool, but it's not safe to
600
+ // allocated from an invalid pool.
601
+ if pool .IsInvalid {
602
+ return false , fmt .Errorf ("pool %s is invalid: %s" , pool .Pool , pool .InvalidReason )
603
+ }
598
604
for _ , slice := range pool .Slices {
599
605
for deviceIndex := range slice .Spec .Devices {
600
606
deviceID := DeviceID {Driver : pool .Driver , Pool : pool .Pool , Device : slice .Spec .Devices [deviceIndex ].Name }
@@ -615,13 +621,6 @@ func (alloc *allocator) allocateOne(r deviceIndices) (bool, error) {
615
621
continue
616
622
}
617
623
618
- // If the pool is not valid, then fail now. It's okay when pools of one driver
619
- // are invalid if we allocate from some other pool, but it's not safe to
620
- // allocated from an invalid pool.
621
- if pool .IsInvalid {
622
- return false , fmt .Errorf ("pool %s is invalid: %s" , pool .Pool , pool .InvalidReason )
623
- }
624
-
625
624
// Finally treat as allocated and move on to the next device.
626
625
device := deviceWithID {
627
626
id : deviceID ,
0 commit comments