From 38ca0f90c75508c2d3df8c66fd471e0f2804d9d6 Mon Sep 17 00:00:00 2001 From: David Shepherd Date: Mon, 4 Sep 2017 22:19:27 -0400 Subject: [PATCH] Simplify mac generation on attach|expose|hide `weaveexec` no longer mounting '/' so we can't access the weavedb file to get persistent peer ID. If `weaver` was running, we couldn't have read the file anyway because BoltDB does not support concurrent access from two processes. Consequence is that if someone really does need the bridge creation on 'weave expose' the peer ID may change if created pre-1.9.0. We'll just live with that (per @bboreham). --- weave | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/weave b/weave index 1b173941..03835370 100755 --- a/weave +++ b/weave @@ -411,13 +411,9 @@ detect_bridge_type() { } try_create_bridge() { - # Running this from 'weave --local' when weaveexec is not on the - # path will run it as a Docker container that does not have access - # to /etc/machine-id, so will not give the full range of persistent IDs - if [ -z "$WEAVEDB_DIR_PATH" ]; then - WEAVEDB_DIR_PATH="$HOST_ROOT/$(docker inspect -f '{{with index .Mounts 0}}{{.Source}}{{end}}' $DB_CONTAINER_NAME 2>/dev/null)" - fi - MAC=$(util_op unique-id "$WEAVEDB_DIR_PATH/weave" "$HOST_ROOT") + # Pass /dev/null because we do not have access to the weavedb files when this runs; BoltDB + # cannot open the file anyway if weaver is running, which is likely for attach|expose|hide. + MAC=$(util_op unique-id "/dev/null" "$HOST_ROOT") BRIDGE_TYPE=$(util_op create-bridge "$DOCKER_BRIDGE" "$BRIDGE" "$DATAPATH" "$WEAVE_MTU" "$PORT" "$MAC" "$WEAVE_NO_FASTDP" "$WEAVE_NO_BRIDGED_FASTDP" "$PROC_PATH" "$1") # Set some variables that are expected by code that comes later [ "$BRIDGE_TYPE" != "fastdp" ] || DATAPATH="$BRIDGE"