Commit efa09d24 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Change the way of handling UUID conflicts, should be better and still need more tests.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@421 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent d786514f
......@@ -86,12 +86,15 @@ class RecoveryEventHandler(MasterEventHandler):
# may claim a server address used by another node.
addr = (ip_address, port)
# generate a new uuid for this node
while not app.isValidUUID(uuid, addr):
uuid = app.getNewUUID(node_type)
# First, get the node by the UUID.
node = app.nm.getNodeByUUID(uuid)
if node is not None and node.getServer() != addr:
# Here we have an UUID conflict, assume that's a new node
node = None
if node is None:
# generate an uuid for this node
while not app.isValidUUID(uuid, addr):
uuid = app.getNewUUID(node_type)
# If nothing is present, try with the server address.
node = app.nm.getNodeByServer(addr)
if node is None:
......@@ -141,6 +144,7 @@ class RecoveryEventHandler(MasterEventHandler):
if node.getServer() != addr:
# This node has a different server address.
if node.getState() == RUNNING_STATE:
# If it is still running, reject this node.
conn.addPacket(Packet().protocolError(packet.getId(),
'invalid server address'))
......
......@@ -156,13 +156,16 @@ class ServiceEventHandler(MasterEventHandler):
# However, master nodes can be known only as the server addresses.
# And, a node may claim a server address used by another node.
addr = (ip_address, port)
# generate a new uuid for this node
while not app.isValidUUID(uuid, addr):
uuid = app.getNewUUID(node_type)
# First, get the node by the UUID.
node = app.nm.getNodeByUUID(uuid)
if node is not None and node.getServer() != addr:
# Here we have an UUID conflict, assume that's a new node
node = None
old_node = None
if node is None:
# generate a new uuid for this node
while not app.isValidUUID(uuid, addr):
uuid = app.getNewUUID(node_type)
# If nothing is present, try with the server address.
node = app.nm.getNodeByServer(addr)
if node is None:
......
......@@ -109,13 +109,15 @@ class VerificationEventHandler(MasterEventHandler):
# may claim a server address used by another node.
addr = (ip_address, port)
# generate a new uuid for this node
while not app.isValidUUID(uuid, addr):
uuid = app.getNewUUID(node_type)
# First, get the node by the UUID.
node = app.nm.getNodeByUUID(uuid)
if node is not None and node.getServer() != addr:
# Here we have an UUID conflict, assume that's a new node
node = None
if node is None:
# generate a new uuid for this node
while not app.isValidUUID(uuid, addr):
uuid = app.getNewUUID(node_type)
# If nothing is present, try with the server address.
node = app.nm.getNodeByServer(addr)
if node is None:
......
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