Crudely fixed #7786 by eliminating check of parent bandwidth when children are sepcified in %

This commit is contained in:
Steve Beaver 2017-11-02 11:22:13 -04:00
parent 4ede18de89
commit fbbd7d2b53

View File

@ -998,15 +998,28 @@ class priq_queue {
}
function CheckBandwidth($bw, $bwtype) {
$parent = $this->GetParent();
$sum = $parent->GetTotalBw(($bw > 0) ? $this : NULL);
if ($bw > 0)
$sum += get_bandwidth($bw, $bwtype, $parent);
if ($sum > get_queue_bandwidth($parent))
return 1;
// If the child queues have bandwidth specified in %, there is no point trying
// to compare the total to the parent's bandwidth, which is defined in Kb/S or Mb/S etc.
// ToDo: Add check for total % > 100
// If one child is in %, they must all be
if ($bwtype != "%") {
$sum = $parent->GetTotalBw(($bw > 0) ? $this : NULL);
if ($bw > 0) {
$sum += get_bandwidth($bw, $bwtype, $parent);
}
if ($sum > get_queue_bandwidth($parent)) {
return 1;
}
}
foreach ($this->subqueues as $q) {
if ($q->CheckBandwidth(0, ''))
if ($q->CheckBandwidth(0, '')) {
return 1;
}
}
return 0;
@ -1214,7 +1227,7 @@ class priq_queue {
}
if ($this->CheckBandwidth($data['bandwidth'], $data['bandwidthtype']))
$input_errors[] = "The sum of child bandwidth is higher than parent.";
if (isset($data['priority']) && (!is_numeric($data['priority']) ||
($data['priority'] < 0) || ($data['priority'] > 15))) {
$input_errors[] = gettext("The priority must be an integer between 1 and 15.");