From 69e604a82027bb6461204106edd11be61767aa2a Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 22 Jan 2009 15:24:23 +1100 Subject: Fix delete of bonding interface Don't allow removal of a bonded device that still has slaves. Bug 4045 --- templates/interfaces/bonding/node.def | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'templates') diff --git a/templates/interfaces/bonding/node.def b/templates/interfaces/bonding/node.def index a0a56a8d..ece131b4 100644 --- a/templates/interfaces/bonding/node.def +++ b/templates/interfaces/bonding/node.def @@ -4,6 +4,12 @@ help: Set bonding interface syntax:expression: pattern $VAR(@) "^bond[0-9]+$" \ ; "bonding must be (bond0-bond99)" create: ${vyatta_sbindir}/vyatta-bonding.pl --create $VAR(@) -delete: ${vyatta_sbindir}/vyatta-bonding.pl --delete $VAR(@) +delete: SLAVES=`cat /sys/class/net/$VAR(@)/bonding/slaves`; + if [ -z $SLAVES ] + then ${vyatta_sbindir}/vyatta-bonding.pl --delete $VAR(@) + else + echo "bonded interface $VAR(@) still has slaves: $SLAVES" + exit 1; + fi end: ${vyatta_sbindir}/vyatta-bonding.pl --mode-change $VAR(@) comp_help: Enter bond interface name (bond0 - bond99) -- cgit v1.2.3