Merge remote-tracking branch 'upstream/master' into 23_retry_peers

This commit is contained in:
Bryan Boreham committed 2014-09-11 19:32:12 +01:00
commit ef35839d4b
1 file changed
+26 -5
+26 -5
View File
@@ -82,14 +82,34 @@ case "$COMMAND" in
# (eth0, wlan0, etc) so the name becomes stable across host
# restarts.
MACADDR=`cat /sys/class/net/$BRIDGE/address`
case $(docker inspect --format '{{ .State.Running }} {{ .Config.Image }}' weave 2>/dev/null) in
"true zettio/weave")
echo "Weave is already running." >&2
exit 1
;;
"false zettio/weave")
docker rm weave >/dev/null
;;
true*)
echo "Found another running container named 'weave'. Aborting." >&2
exit 1
;;
false*)
echo "Found another container named 'weave'. Aborting." >&2
exit 1
;;
esac
CONTAINER=$(docker run --privileged -d --name=weave -p 6783:6783/tcp -p 6783:6783/udp $WEAVE_DOCKER_ARGS zettio/weave -name $MACADDR "$@")
echo $CONTAINER
IFACE=eth0
;;
status)
DOCKERIP=$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' weave)
if ! DOCKERIP=$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' weave 2>/dev/null) ; then
echo "Weave is not running." >&2
exit 1
fi
if [ -z "$DOCKERIP" ] ; then
echo "The weave container is not running." >&2
echo "Weave is not running." >&2
exit 1
fi
if command_exists wget ; then
@@ -132,8 +152,9 @@ case "$COMMAND" in
exit 0
;;
stop)
docker kill weave > /dev/null
docker rm weave > /dev/null
if ! docker rm -f weave >/dev/null 2>&1 ; then
echo "Weave is not running."
fi
if command_exists conntrack
then
conntrack -D -p udp --dport 6783 >/dev/null 2>&1
@@ -178,7 +199,7 @@ ip netns exec $NSPID ip link set $CONTAINER_IFNAME up
if command_exists ethtool
then
ip netns exec $NSPID ethtool -K $IFACE tx off > /dev/null
ip netns exec $NSPID ethtool -K $IFACE tx off >/dev/null
else
echo "Cannot find ethtool; please install it. Continuing without it." >&2
fi