Total priority buffer overflow check

This commit is contained in:
ravisantoshgudimetla
2017-04-28 16:31:53 -04:00
parent dbce213ea6
commit 7ae3136f5d
5 changed files with 75 additions and 5 deletions

View File

@@ -29,8 +29,8 @@ func ValidatePolicy(policy schedulerapi.Policy) error {
var validationErrors []error
for _, priority := range policy.Priorities {
if priority.Weight <= 0 {
validationErrors = append(validationErrors, fmt.Errorf("Priority %s should have a positive weight applied to it", priority.Name))
if priority.Weight <= 0 || priority.Weight >= schedulerapi.MaxWeight {
validationErrors = append(validationErrors, fmt.Errorf("Priority %s should have a positive weight applied to it or it has overflown", priority.Name))
}
}