diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-06-10 15:59:05 -0700 |
---|---|---|
committer | Stephen Hemminger <shemminger@lenny.localdomain> | 2009-10-01 13:51:19 -0700 |
commit | 4e41f747e53ebdba0e6f835ec701fa9ee6bb2ead (patch) | |
tree | d054a6dced54a4d1784019ee1681febdc99d7f88 /scripts | |
parent | 969064d17f9cc50a68e2922ec30ec5bb63b31763 (diff) | |
download | vyatta-cfg-qos-4e41f747e53ebdba0e6f835ec701fa9ee6bb2ead.tar.gz vyatta-cfg-qos-4e41f747e53ebdba0e6f835ec701fa9ee6bb2ead.zip |
Fix management of delete of policy in use
Minor config confusion in script.
Bug 4532
(cherry picked from commit 28650945b96e0990fbe39e4743bca436662bae66)
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/vyatta-qos.pl | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl index 693da36..86b8fe2 100755 --- a/scripts/vyatta-qos.pl +++ b/scripts/vyatta-qos.pl @@ -182,6 +182,7 @@ sub update_interface { } } + # return array of names using given qos-policy sub interfaces_using { my $policy = shift; @@ -191,9 +192,13 @@ sub interfaces_using { foreach my $name ( getInterfaces() ) { my $intf = new Vyatta::Interface($name); next unless $intf; - - $config->setLevel( $intf->path() ); - push @inuse, $name if ( $config->exists("qos-policy $policy") ); + $config->setLevel($intf->path() . ' qos-policy'); + + foreach my $direction ($config->listNodes()) { + my $cur = $config->returnValue($direction); + next unless $cur; + push @inuse, $name if ($cur eq $policy); + } } return @inuse; } @@ -204,7 +209,7 @@ sub delete_policy { my @inuse = interfaces_using($name); die "QoS policy still in use on ", join( ' ', @inuse ), "\n" - if (@inuse); + if @inuse; } } |