summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Qos/TrafficShaper.pm
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-04-13 16:49:02 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-04-13 16:49:02 -0700
commitd222de9c4110494f2621fe9251254a724fa20dc5 (patch)
tree571b9b967df0a2c492aaa8060e5bcd2ad93f191f /lib/Vyatta/Qos/TrafficShaper.pm
parent1c240e8ba32f96b002ecaf0b7a1e87e1e15d1605 (diff)
downloadvyatta-cfg-qos-d222de9c4110494f2621fe9251254a724fa20dc5.tar.gz
vyatta-cfg-qos-d222de9c4110494f2621fe9251254a724fa20dc5.zip
Fix RoundRobin scheduler
Need to change assumptions in ShaperClass about bandwidth and this goes over to TrafficShaper and RR.
Diffstat (limited to 'lib/Vyatta/Qos/TrafficShaper.pm')
-rw-r--r--lib/Vyatta/Qos/TrafficShaper.pm17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/Vyatta/Qos/TrafficShaper.pm b/lib/Vyatta/Qos/TrafficShaper.pm
index 721dac9..114bba7 100644
--- a/lib/Vyatta/Qos/TrafficShaper.pm
+++ b/lib/Vyatta/Qos/TrafficShaper.pm
@@ -33,8 +33,7 @@ sub new {
my $level = $config->setLevel();
my @classes = _getClasses($level);
- _checkClasses( $level, getRate($rate), @classes )
- if ( $rate ne "auto" );
+ _checkClasses( $level, $rate, @classes );
my $self = {};
my $class = ref($that) || $that;
@@ -86,15 +85,19 @@ sub _getClasses {
return @classes;
}
+# Check constraints on class bandwidth values
sub _checkClasses {
- my $level = shift;
- my $rate = shift;
+ my $level = shift;
+ my $rate = shift;
my $default = shift;
-
- $default->rateCheck( $rate, "$level default" );
+
+ # if auto, can't check at create must wait for policy to be applied
+ $rate = ( $rate eq "auto") ? undef : getRate($rate);
+ $default->rateCheck( $rate, "$level default" ) if $rate;
foreach my $class (@_) {
- $class->rateCheck( $rate, "$level class $class->{id}" );
+ die "$class->{level} bandwidth not defined\n" unless $class->{_rate};
+ $class->rateCheck( $rate, "$level class $class->{id}" ) if $rate;
}
}