Commit 40b3f70e authored by Julien Muchembled's avatar Julien Muchembled

master: review conditions to check uuid/address conflicts when identifying nodes

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2677 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent d792ca6b
......@@ -31,21 +31,20 @@ class IdentificationHandler(MasterHandler):
self.checkClusterName(name)
app = self.app
node_by_uuid = app.nm.getByUUID(uuid)
# handle conflicts and broken nodes
node = node_by_uuid or app.nm.getByAddress(address)
node = app.nm.getByUUID(uuid)
if node:
if node_by_uuid and node.getAddress() == address:
# the node is still alive
if node.isBroken():
raise BrokenNodeDisallowedError
elif node.isRunning():
# still running, reject this new node
raise ProtocolError('invalid server address')
if node.isConnected():
# more than one connection from this node
else:
node = app.nm.getByAddress(address)
if node:
if node.isRunning():
# cloned/evil/buggy node connecting to us
raise ProtocolError('already connected')
else:
assert not node.isConnected()
node.setAddress(address)
node.setRunning()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment