kingamarton commented on a change in pull request #215:
URL: 
https://github.com/apache/incubator-yunikorn-core/pull/215#discussion_r507794230



##########
File path: pkg/common/configs/configvalidator.go
##########
@@ -72,37 +72,68 @@ func checkACL(acl string) error {
        return nil
 }
 
-// Temporary convenience method: should use resource package to do this
-// currently no check for the type of resource as long as the value is OK all 
is OK
-func checkResource(res map[string]string) (int64, error) {
-       var totalres int64
-       for _, val := range res {
-               rescount, err := strconv.ParseInt(val, 10, 64)
-               if err != nil {
-                       return 0, fmt.Errorf("resource parsing failed: %v", err)
+// Check the queue resource configuration settings.
+// - child or children cannot have higher maximum or guaranteed limits than 
parents
+// - children (added together) cannot have a higher guaranteed setting than a 
parent
+func checkResourceConfigurationsForQueue(cur *QueueConfig, parent 
*QueueConfig) error {
+       // If cur has children, make sure sum of children's guaranteed <= 
cur.guaranteed
+       curGuaranteedRes, err := 
resources.NewResourceFromConf(cur.Resources.Guaranteed)
+       if err != nil {
+               return err
+       }
+       if curGuaranteedRes.HasNegativeValue() {
+               return fmt.Errorf("invalid guaranteed resource for queue %s, 
cannot be negative", cur.Name)

Review comment:
       done
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to