diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-07-08 13:29:57 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-07-08 13:29:57 -0700 |
commit | 7f78fa942890465cace2e478c7f0795991722074 (patch) | |
tree | a83fbce00c7c4cdd287eb81dc781ffae8fe2d6ce /scripts | |
parent | 9feafc076767ded8a1133a83fb02a699cd2816cd (diff) | |
download | vyatta-cfg-qos-7f78fa942890465cace2e478c7f0795991722074.tar.gz vyatta-cfg-qos-7f78fa942890465cace2e478c7f0795991722074.zip |
validate traffic shaper rates at commit time if possible
Bugfix 2919
As long as the bandwidth isn't auto, then validate at commit time.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/VyattaQosTrafficShaper.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/VyattaQosTrafficShaper.pm b/scripts/VyattaQosTrafficShaper.pm index 6b76eb0..28c84cb 100644 --- a/scripts/VyattaQosTrafficShaper.pm +++ b/scripts/VyattaQosTrafficShaper.pm @@ -253,9 +253,27 @@ sub new { bless $self, $class; $self->_define($config); + $self->_validate($config); + return $self; } +sub _validate { + my $self = shift; + + if ( $self->{_rate} ne "auto" ) { + my $classes = $self->{_classes}; + my $default = shift @$classes; + my $rate = VyattaQosUtil::getRate($self->{_rate}); + + $default->rateCheck($rate, "$self->{_level} default"); + + foreach my $class (@$classes) { + $class->rateCheck($rate, "$self->{_level} class $class->{id}"); + } + } +} + # Rate can be something like "auto" or "10.2mbit" sub _getAutoRate { my ($rate, $dev) = @_; |