Merge branch '1.6'

This commit is contained in:
Bryan Boreham committed 2016-06-29 14:42:17 +01:00
commit cc3359dfe5
3 files changed
+20 -11

No files matched your search

+2
View File
@@ -119,6 +119,8 @@ func New(start, end address.Address, peer mesh.PeerName, f OnUpdate) *Ring {
} }
func (r *Ring) Restore(other *Ring) { func (r *Ring) Restore(other *Ring) {
defer r.trackUpdates()()
onUpdate := r.onUpdate onUpdate := r.onUpdate
*r = *other *r = *other
r.onUpdate = onUpdate r.onUpdate = onUpdate
+8 -9
View File
@@ -21,6 +21,7 @@ package tracker
import ( import (
"fmt" "fmt"
"net" "net"
"syscall"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/ec2metadata" "github.com/aws/aws-sdk-go/aws/ec2metadata"
@@ -94,14 +95,14 @@ func (t *AWSVPCTracker) HandleUpdate(prevRanges, currRanges []address.Range, loc
for _, cidr := range curr { for _, cidr := range curr {
cidrStr := cidr.String() cidrStr := cidr.String()
t.debugf("adding route %s to %s", cidrStr, t.instanceID) t.debugf("adding route %s to %s", cidrStr, t.instanceID)
_, err := t.createVPCRoute(cidrStr) if _, err := t.createVPCRoute(cidrStr); err != nil {
if err != nil {
return fmt.Errorf("createVPCRoutes failed: %s", err) return fmt.Errorf("createVPCRoutes failed: %s", err)
} }
if local { if local {
err = t.createHostRoute(cidrStr) if err := t.createHostRoute(cidrStr); err != nil {
if err != nil { if errno, ok := err.(syscall.Errno); !(ok && errno == syscall.EEXIST) {
return fmt.Errorf("createHostRoute failed: %s", err) return fmt.Errorf("createHostRoute failed: %s", err)
}
} }
} }
} }
@@ -110,13 +111,11 @@ func (t *AWSVPCTracker) HandleUpdate(prevRanges, currRanges []address.Range, loc
for _, cidr := range prev { for _, cidr := range prev {
cidrStr := cidr.String() cidrStr := cidr.String()
t.debugf("removing %s route", cidrStr) t.debugf("removing %s route", cidrStr)
_, err := t.deleteVPCRoute(cidrStr) if _, err := t.deleteVPCRoute(cidrStr); err != nil {
if err != nil {
return fmt.Errorf("deleteVPCRoute failed: %s", err) return fmt.Errorf("deleteVPCRoute failed: %s", err)
} }
if local { if local {
err = t.deleteHostRoute(cidrStr) if err := t.deleteHostRoute(cidrStr); err != nil {
if err != nil {
return fmt.Errorf("deleteHostRoute failed: %s", err) return fmt.Errorf("deleteHostRoute failed: %s", err)
} }
} }
+10 -2
View File
@@ -1655,9 +1655,12 @@ launch_router() {
"$@") "$@")
setup_router_iface_$BRIDGE_TYPE setup_router_iface_$BRIDGE_TYPE
wait_for_status $CONTAINER_NAME http_call $HTTP_ADDR wait_for_status $CONTAINER_NAME http_call $HTTP_ADDR
setup_awsvpc
populate_router populate_router
}
setup_awsvpc() {
if [ -n "$AWSVPC" ]; then if [ -n "$AWSVPC" ]; then
expose_ip
# Set proxy_arp on the bridge, so that it could accept packets destined # Set proxy_arp on the bridge, so that it could accept packets destined
# to containers within the same subnet but running on remote hosts. # to containers within the same subnet but running on remote hosts.
# Without it, exact routes on each container are required. # Without it, exact routes on each container are required.
@@ -1666,6 +1669,7 @@ launch_router() {
# placing the request into a bounded queue as it can be seen: # placing the request into a bounded queue as it can be seen:
# https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/net/ipv4/arp.c?id=refs/tags/v4.6.1#n819 # https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/net/ipv4/arp.c?id=refs/tags/v4.6.1#n819
echo 0 >/proc/sys/net/ipv4/neigh/$BRIDGE/proxy_delay echo 0 >/proc/sys/net/ipv4/neigh/$BRIDGE/proxy_delay
expose_ip
fi fi
} }
@@ -1679,7 +1683,8 @@ fetch_router_args() {
populate_router() { populate_router() {
if [ -n "$IPRANGE" ] ; then if [ -n "$IPRANGE" ] ; then
# Tell the newly-started weave IP allocator about existing weave IPs # Tell the newly-started weave IP allocator about existing weave IPs
with_container_addresses ipam_reclaim_no_check_alive weave:expose # In the case of AWSVPC, we do expose before calling populate_router
[ -n "$AWSVPC" ] || with_container_addresses ipam_reclaim_no_check_alive weave:expose
with_container_addresses ipam_reclaim $(docker ps -q --no-trunc) with_container_addresses ipam_reclaim $(docker ps -q --no-trunc)
fi fi
if [ -z "$NO_DNS_OPT" ] ; then if [ -z "$NO_DNS_OPT" ] ; then
@@ -1956,10 +1961,13 @@ EOF
attach-router) attach-router)
check_running $CONTAINER_NAME check_running $CONTAINER_NAME
enforce_docker_bridge_addr_assign_type enforce_docker_bridge_addr_assign_type
# We cannot use detect_awsvpc here, because HTTP server might not be started
! docker inspect -f '{{.Config.Cmd}}' $CONTAINER_NAME | grep -q -- "--awsvpc" || AWSVPC=1
create_bridge create_bridge
fetch_router_args fetch_router_args
setup_router_iface_$BRIDGE_TYPE setup_router_iface_$BRIDGE_TYPE
wait_for_status $CONTAINER_NAME http_call $HTTP_ADDR wait_for_status $CONTAINER_NAME http_call $HTTP_ADDR
setup_awsvpc
populate_router populate_router
;; ;;
launch-proxy) launch-proxy)