From 5f6a257e0ca0b17a8cddc200a05d11f6d0186872 Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Mon, 5 Jan 2015 23:54:20 +0700 Subject: [PATCH] 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 }