Merge pull request #2657 from weaveworks/remove-bridge-on-error
Remove weave bridge if something goes wrong when creating it
This commit is contained in:
commit
597c6c111d
1 file changed
+11
-1
@@ -571,7 +571,7 @@ detect_bridge_type() {
|
|||||||
MTU=${WEAVE_MTU:-$(cat /sys/class/net/$BRIDGE/mtu)}
|
MTU=${WEAVE_MTU:-$(cat /sys/class/net/$BRIDGE/mtu)}
|
||||||
}
|
}
|
||||||
|
|
||||||
create_bridge() {
|
try_create_bridge() {
|
||||||
if ! detect_bridge_type ; then
|
if ! detect_bridge_type ; then
|
||||||
BRIDGE_TYPE=bridge
|
BRIDGE_TYPE=bridge
|
||||||
if [ -z "$WEAVE_NO_FASTDP" ] ; then
|
if [ -z "$WEAVE_NO_FASTDP" ] ; then
|
||||||
@@ -656,6 +656,16 @@ EOF
|
|||||||
configure_arp_cache $BRIDGE
|
configure_arp_cache $BRIDGE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create_bridge() {
|
||||||
|
if ! try_create_bridge "$@" ; then
|
||||||
|
echo "Creating bridge '$BRIDGE' failed" >&2
|
||||||
|
# reset to original value so we destroy both kinds
|
||||||
|
DATAPATH=datapath
|
||||||
|
destroy_bridge
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
expose_ip() {
|
expose_ip() {
|
||||||
ipam_cidrs allocate_no_check_alive weave:expose $CIDR_ARGS
|
ipam_cidrs allocate_no_check_alive weave:expose $CIDR_ARGS
|
||||||
for CIDR in $ALL_CIDRS ; do
|
for CIDR in $ALL_CIDRS ; do
|
||||||
|
|||||||
Reference in new issue
Block a user