Commit 56bcd323 authored by Aurel's avatar Aurel

try to retrieve node by uuid and address before updating their data


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@579 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 36f2c2f7
......@@ -184,9 +184,22 @@ class PrimaryBootstrapHandler(BaseHandler):
for node_type, ip_address, port, uuid, state in node_list:
# Register new nodes.
addr = (ip_address, port)
if node_type == MASTER_NODE_TYPE:
# Try to retrieve it from nm
n = None
if uuid != INVALID_UUID:
n = nm.getNodeByUUID(uuid)
if n is None:
n = nm.getNodeByServer(addr)
if n is not None and uuid != INVALID_UUID:
# node only exists by address, remove it
nm.remove(n)
n = None
elif n.getServer() != addr:
# same uuid but different address, remove it
nm.remove(n)
n = None
if node_type == MASTER_NODE_TYPE:
if n is None:
n = MasterNode(server = addr)
nm.add(n)
......@@ -199,12 +212,9 @@ class PrimaryBootstrapHandler(BaseHandler):
if uuid == INVALID_UUID:
# No interest.
continue
n = nm.getNodeByUUID(uuid)
if n is None:
n = StorageNode(server = addr, uuid = uuid)
nm.add(n)
else:
n.setServer(addr)
elif node_type == CLIENT_NODE_TYPE:
continue
......
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