From 5f6a257e0ca0b17a8cddc200a05d11f6d0186872 Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Mon, 5 Jan 2015 23:54:20 +0700 Subject: [PATCH 1/2] report error when two Docker's IDs are duplicated Signed-off-by: Chanwit Kaewkasi --- cluster/cluster.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cluster/cluster.go b/cluster/cluster.go index 204f1e1d93..28471f1885 100644 --- a/cluster/cluster.go +++ b/cluster/cluster.go @@ -48,7 +48,11 @@ func (c *Cluster) AddNode(n *Node) error { c.Lock() defer c.Unlock() - if _, exists := c.nodes[n.ID]; exists { + if old, exists := c.nodes[n.ID]; exists { + if old.IP != n.IP { + log.Errorf("ID duplicated: %s", n.ID) + log.Errorf("IP [%s] and [%s] share the same ID", old.IP, n.IP) + } return ErrNodeAlreadyRegistered } From 93026e166a608d5214fa9ef01cbad7118e5bf93d Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Tue, 6 Jan 2015 09:08:55 +0700 Subject: [PATCH 2/2] adjust error report to be a single entry Signed-off-by: Chanwit Kaewkasi --- cluster/cluster.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cluster/cluster.go b/cluster/cluster.go index 28471f1885..5c1e9c6219 100644 --- a/cluster/cluster.go +++ b/cluster/cluster.go @@ -50,8 +50,7 @@ func (c *Cluster) AddNode(n *Node) error { if old, exists := c.nodes[n.ID]; exists { if old.IP != n.IP { - log.Errorf("ID duplicated: %s", n.ID) - log.Errorf("IP [%s] and [%s] share the same ID", old.IP, n.IP) + log.Errorf("ID duplicated. %s shared by %s and %s", n.ID, old.IP, n.IP) } return ErrNodeAlreadyRegistered }