Remove unnecessary union after call to GetPreferredAllocation()

There is no need to try and allocate already-allocated devices again.
This commit is contained in:
Kevin Klues 2020-07-04 12:35:04 +00:00
parent 67ecc11c44
commit 26cb650655

View File

@ -709,7 +709,7 @@ func (m *ManagerImpl) devicesToAllocate(podUID, contName, resource string, requi
if err != nil {
return nil, err
}
if allocateRemainingFrom(preferred.Intersection(aligned.Union(allocated))) {
if allocateRemainingFrom(preferred.Intersection(aligned)) {
return allocated, nil
}
// Then fallback to allocate from the aligned set if no preferred list
@ -734,7 +734,7 @@ func (m *ManagerImpl) devicesToAllocate(podUID, contName, resource string, requi
if err != nil {
return nil, err
}
if allocateRemainingFrom(preferred.Intersection(available.Union(allocated))) {
if allocateRemainingFrom(preferred.Intersection(available)) {
return allocated, nil
}