From fab23c4e4b7e5566e43ccbaa9f4dbc7d1b60fc69 Mon Sep 17 00:00:00 2001 From: Mohit Mehta Date: Thu, 18 Feb 2010 17:11:35 -0800 Subject: Fix Bug 5064 can't delete bridge group and membership in one commit * fix this for eth, eth.vif, bond, bond.vif interfaces * also, bridge-group code for bonding interfaces wasn't changed with commit ec080f99 that re-strucutred bridging code in eth and eth.vifs to fix bug 4708. bridge-group code for bond and bond.vif interfaces is now similar to the fix for 4708 --- .../ethernet/node.tag/bridge-group/node.def | 20 ++++++++++++++++++-- .../node.tag/vif/node.tag/bridge-group/node.def | 20 ++++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) (limited to 'templates/interfaces/ethernet') diff --git a/templates/interfaces/ethernet/node.tag/bridge-group/node.def b/templates/interfaces/ethernet/node.tag/bridge-group/node.def index b30a9e10..7590dc96 100644 --- a/templates/interfaces/ethernet/node.tag/bridge-group/node.def +++ b/templates/interfaces/ethernet/node.tag/bridge-group/node.def @@ -22,7 +22,17 @@ end: fi elif [ ${COMMIT_ACTION} = 'DELETE' ]; then echo "Removing interface $ethif from bridge $oldbridge." - sudo brctl delif $oldbridge $ethif + if /opt/vyatta/sbin/vyatta-bridgegroup-depedency.pl \ + --bridge-notin-proposedcfg \ + --bridge-interface="$oldbridge"; then \ + # this is the case where the bridge that this interface is assigned + # to is getting deleted in the same commit as the bridge node under + # this interface - Bug 5064|4734. Since bridge has a higher priority; + # it gets deleted before the removal of bridge-groups under interfaces + exit 0 + else + sudo brctl delif $oldbridge $ethif + fi else if [ -z "$newbridge" ]; then echo "Must specify bridge name." @@ -30,7 +40,13 @@ end: else if [ "$oldbridge" != "$newbridge" ]; then echo "Removing interface $ethif from bridge $oldbridge and adding it to $newbridge." - sudo brctl delif $oldbridge $ethif + # do not remove interface from bridge if bridge not in proposed config + # reason is same as mentioned in the ${COMMIT_ACTION} = 'DELETE' section + if ! /opt/vyatta/sbin/vyatta-bridgegroup-depedency.pl \ + --bridge-notin-proposedcfg \ + --bridge-interface="$oldbridge"; then \ + sudo brctl delif $oldbridge $ethif + fi sudo brctl addif $newbridge $ethif fi if [ -n "$VAR(./cost/@)" ]; then diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/bridge-group/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/bridge-group/node.def index e3645b1c..dd3863a0 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/bridge-group/node.def +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/bridge-group/node.def @@ -25,7 +25,17 @@ end: fi elif [ ${COMMIT_ACTION} = 'DELETE' ]; then echo "Removing interface $ethif from bridge $oldbridge." - sudo brctl delif $oldbridge $ethif + if /opt/vyatta/sbin/vyatta-bridgegroup-depedency.pl \ + --bridge-notin-proposedcfg \ + --bridge-interface="$oldbridge"; then \ + # this is the case where the bridge that this interface is assigned + # to is getting deleted in the same commit as the bridge node under + # this interface - Bug 5064|4734. Since bridge has a higher priority; + # it gets deleted before the removal of bridge-groups under interfaces + exit 0 + else + sudo brctl delif $oldbridge $ethif + fi else if [ -z "$newbridge" ]; then echo "Must specify bridge name." @@ -33,7 +43,13 @@ end: else if [ "$oldbridge" != "$newbridge" ]; then echo "Removing interface $ethif from bridge $oldbridge and adding it to $newbridge." - sudo brctl delif $oldbridge $ethif + # do not remove interface from bridge if bridge not in proposed config + # reason is same as mentioned in the ${COMMIT_ACTION} = 'DELETE' section + if ! /opt/vyatta/sbin/vyatta-bridgegroup-depedency.pl \ + --bridge-notin-proposedcfg \ + --bridge-interface="$oldbridge"; then \ + sudo brctl delif $oldbridge $ethif + fi sudo brctl addif $newbridge $ethif fi if [ -n "$VAR(./cost/@)" ]; then -- cgit v1.2.3