report error when two Docker's IDs are duplicated

Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
This commit is contained in:
Chanwit Kaewkasi 2015-01-05 23:54:20 +07:00
parent d27e8a35a1
commit 5f6a257e0c
1 changed files with 5 additions and 1 deletions

View File

@ -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
}