mirror of https://github.com/status-im/consul.git
Display IPs of machines when node names conflict to ease troubleshooting
When there is an node name conflicts, such messages are displayed within Consul: `consul.fsm: EnsureRegistration failed: failed inserting node: Error while renaming Node ID: "e1d456bc-f72d-98e5-ebb3-26ae80d785cf": Node name node001 is reserved by node 05f10209-1b9c-b90c-e3e2-059e64556d4a with name node001` While it is easy to find the node that has reserved the name, it is hard to find the node trying to aquire the name since it is not registered, because it is not part of `consul members` output This PR will display the IP of the offender and solve far more easily those issues.
This commit is contained in:
parent
2f37d68d9b
commit
58f04815d5
|
@ -393,7 +393,7 @@ func (s *Store) ensureNoNodeWithSimilarNameTxn(tx *memdb.Txn, node *structs.Node
|
|||
}
|
||||
|
||||
if !(enode.ID == "" && allowClashWithoutID) && nodeHealthy {
|
||||
return fmt.Errorf("Node name %s is reserved by node %s with name %s", node.Node, enode.ID, enode.Node)
|
||||
return fmt.Errorf("Node name %s is reserved by node %s with name %s (%s)", node.Node, enode.ID, enode.Node, enode.Address)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -447,13 +447,13 @@ func (s *Store) ensureNodeTxn(tx *memdb.Txn, idx uint64, node *structs.Node) err
|
|||
// Lets first get all nodes and check whether name do match, we do not allow clash on nodes without ID
|
||||
dupNameError := s.ensureNoNodeWithSimilarNameTxn(tx, node, false)
|
||||
if dupNameError != nil {
|
||||
return fmt.Errorf("Error while renaming Node ID: %q: %s", node.ID, dupNameError)
|
||||
return fmt.Errorf("Error while renaming Node ID: %q (%s): %s", node.ID, node.Address, dupNameError)
|
||||
}
|
||||
// We are actually renaming a node, remove its reference first
|
||||
err := s.deleteNodeTxn(tx, idx, n.Node)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error while renaming Node ID: %q from %s to %s",
|
||||
node.ID, n.Node, node.Node)
|
||||
return fmt.Errorf("Error while renaming Node ID: %q (%s) from %s to %s",
|
||||
node.ID, node.Address, n.Node, node.Node)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue