Reclaim plugin addresses using container ID of '_'

This commit is contained in:
Adam Harrison authored and Matthias Radestock committed 2016-05-07 14:35:15 +01:00
1 parent 260b416cd7
commit 158fa9d8e5
1 file changed
+6 -1
+6 -1
View File
@@ -1382,8 +1382,13 @@ check_overlap() {
# Claim addresses for a container in IPAM. Expects to be called from
# with_container_addresses.
ipam_reclaim() {
CONTAINER_ID="$1"
# The weave IP addresses of containers attached by the plugin are
# recorded specially in IPAM, since the container id is not know
# at the time.
[ "$2" = "$CONTAINER_IFNAME" ] || CONTAINER_ID="_"
for CIDR in $4 ; do
http_call $HTTP_ADDR PUT "/ip/$1/$CIDR?noErrorOnUnknown=true&?check-alive=true" || true
http_call $HTTP_ADDR PUT "/ip/$CONTAINER_ID/$CIDR?noErrorOnUnknown=true&?check-alive=true" || true
done
}