Merge pull request #1 from Zexi/bugfix/scheduler-port-usage

scheduler: fix specified network not enough still pass.
This commit is contained in:
Zexi Li
2018-07-30 19:01:51 +08:00
committed by GitHub
@@ -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 ""