From d2bd78435e512577f8a5d653c105aa82817808a9 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Mon, 15 Sep 2014 12:43:58 +0100 Subject: [PATCH] add 'weave reset' Closes #20. --- README.md | 18 ++++++++++++++++++ weaver/weave | 14 ++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/README.md b/README.md index 3cf56309..7d661868 100644 --- a/README.md +++ b/README.md @@ -363,6 +363,24 @@ One can ask a weave router to report its status with weave status +To stop weave, run + + weave stop + +Note that this leaves the local application container network intact; +containers on the local host can continue to communicate, whereas +communication with containers on different hosts, as well as service +export/import, is disrupted but resumes when weave is relaunched. + +To stop weave and completely remove all traces of the weave network on +the local host, run + + weave reset + +Any running application containers will permanently lose connectivity +with the weave network and have to be restarted in order to +re-connect. + ## Installation with Boot2Docker If you are running Docker inside the Boot2Docker VM, e.g. because you diff --git a/weaver/weave b/weaver/weave index ca40708d..189be878 100755 --- a/weaver/weave +++ b/weaver/weave @@ -9,6 +9,7 @@ usage() { echo "weave hide /" echo "weave status" echo "weave stop" + echo "weave reset" exit 1 } @@ -60,6 +61,12 @@ create_bridge() { ip link set dev $BRIDGE up } +destroy_bridge() { + if [ -d /sys/class/net/$BRIDGE ] ; then + ip link del dev $BRIDGE + fi +} + run_iptables() { # -w is recent addition to iptables if [ -z "$CHECKED_IPTABLES_W" ] ; then @@ -215,6 +222,13 @@ case "$COMMAND" in check_command_and_run conntrack conntrack -D -p udp --dport 6783 >/dev/null 2>&1 || true stop_masquerading ;; + reset) + docker kill weave >/dev/null 2>&1 || true + docker rm -f weave >/dev/null 2>&1 || true + check_command_and_run conntrack conntrack -D -p udp --dport 6783 >/dev/null 2>&1 || true + stop_masquerading + destroy_bridge + ;; *) echo "Unknown weave command '$COMMAND'" usage