Skip to content

Commit

Permalink
Merge pull request #1 from Zexi/bugfix/scheduler-port-usage
Browse files Browse the repository at this point in the history
scheduler: fix specified network not enough still pass.
  • Loading branch information
zexi authored Jul 30, 2018
2 parents 264440f + 7a8352c commit 81b50f5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/scheduler/algorithm/predicates/guest/network_predicate.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ func (p *NetworkPredicate) Execute(u *core.Unit, c core.Candidater) (bool, []cor
// add resource
reservedNetworks := 0
counter := counterOfNetwork(u, net, reservedNetworks)
if counter.GetCount() < d.Count {
errMsgs = append(errMsgs, fmt.Sprintf("%s: ports not enough, free: %d, required: %d", net.Name, counter.GetCount(), d.Count))
continue
}
p.SelectedNetworks.Store(net.ID, counter.GetCount())
counters.Add(counter)
return ""
Expand Down

0 comments on commit 81b50f5

Please # to comment.