From 82fba3c357e202a0f70b6ab9929d16db4f28f5ad Mon Sep 17 00:00:00 2001 From: Santhosh Manohar Date: Fri, 16 Sep 2016 15:15:46 -0700 Subject: [PATCH] Make nodenames unique in Gossip cluster Signed-off-by: Santhosh Manohar --- agent.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/agent.go b/agent.go index 2b2ecf4324..e83ee9f375 100644 --- a/agent.go +++ b/agent.go @@ -9,6 +9,7 @@ import ( "sort" "github.com/Sirupsen/logrus" + "github.com/docker/docker/pkg/stringid" "github.com/docker/go-events" "github.com/docker/libnetwork/datastore" "github.com/docker/libnetwork/discoverapi" @@ -247,9 +248,12 @@ func (c *controller) agentInit(bindAddrOrInterface, advertiseAddr string) error keys, tags := c.getKeys(subsysGossip) hostname, _ := os.Hostname() + nodeName := hostname + "-" + stringid.TruncateID(stringid.GenerateRandomID()) + logrus.Info("Gossip cluster hostname ", nodeName) + nDB, err := networkdb.New(&networkdb.Config{ AdvertiseAddr: advertiseAddr, - NodeName: hostname, + NodeName: nodeName, Keys: keys, })