Leave container allocations for a time after death
so they will be reclaimed if the container is restarted. Still cancel pending operations immediately a container dies
This commit is contained in:
1 parent
4672e9ec1f
commit
f84b933d7c
5 files changed
+76
-29
No files matched your search
@@ -2,8 +2,6 @@
|
||||
|
||||
. ./config.sh
|
||||
|
||||
C1=10.2.0.78
|
||||
C2=10.2.0.34
|
||||
NAME=seetwo.weave.local
|
||||
|
||||
check_attached() {
|
||||
@@ -26,8 +24,9 @@ wait_for_proxy() {
|
||||
start_suite "Proxy restart reattaches networking to containers"
|
||||
|
||||
WEAVE_DOCKER_ARGS=--restart=always WEAVEPROXY_DOCKER_ARGS=--restart=always weave_on $HOST1 launch
|
||||
proxy_start_container $HOST1 -e WEAVE_CIDR=$C2/24 -di --name=c2 --restart=always -h $NAME
|
||||
proxy_start_container_with_dns $HOST1 -e WEAVE_CIDR=$C1/24 -di --name=c1 --restart=always
|
||||
proxy_start_container $HOST1 -di --name=c2 --restart=always -h $NAME
|
||||
proxy_start_container_with_dns $HOST1 -di --name=c1 --restart=always
|
||||
C2=$(container_ip $HOST1 c2)
|
||||
|
||||
proxy docker_on $HOST1 restart -t=1 c2
|
||||
check_attached
|
||||
@@ -42,11 +41,13 @@ run_on $HOST1 sudo kill -KILL $(docker_on $HOST1 inspect --format='{{.State.Pid}
|
||||
sleep 1
|
||||
check_attached
|
||||
|
||||
# Disabled because Docker 1.8 often fails to restart weave or weaveproxy
|
||||
# Restart docker itself, using different commands for systemd- and upstart-managed.
|
||||
#run_on $HOST1 sh -c "command -v systemctl >/dev/null && sudo systemctl restart docker || sudo service docker restart"
|
||||
#wait_for_proxy $HOST1
|
||||
#check_attached
|
||||
run_on $HOST1 sh -c "command -v systemctl >/dev/null && sudo systemctl restart docker || sudo service docker restart"
|
||||
wait_for_proxy $HOST1
|
||||
sleep 5 # allow for re-tries of attach
|
||||
# Re-fetch the IP since it is not retained on docker restart
|
||||
C2=$(container_ip $HOST1 c2) || (echo "container c2 has no IP address" 2>&1; exit 1)
|
||||
check_attached
|
||||
|
||||
# Restarting proxy shouldn't kill unattachable containers
|
||||
proxy_start_container $HOST1 -di --name=c3 --restart=always # Use ipam, so it won't be attachable w/o weave
|
||||
|
||||
Reference in new issue
Block a user