summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-10 15:59:05 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-10 15:59:05 -0700
commit28650945b96e0990fbe39e4743bca436662bae66 (patch)
treea7153db9c6e12a9d98a156e81f0d81ed0f0f76d9
parent35748c319cde9d02c758349303871a41ebe15259 (diff)
downloadvyatta-cfg-qos-28650945b96e0990fbe39e4743bca436662bae66.tar.gz
vyatta-cfg-qos-28650945b96e0990fbe39e4743bca436662bae66.zip
Fix management of delete of policy in use
Minor config confusion in script. Bug 4532
-rwxr-xr-xscripts/vyatta-qos.pl13
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;
}
}