Commit 7f5695cb authored by Aurel's avatar Aurel

when registering nodes, if no uuid given register nodes with the

INVALID_UUID, thus they can be reported to the admin tool


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@577 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 823c9d7a
...@@ -94,7 +94,7 @@ class AdminEventHandler(BaseEventHandler): ...@@ -94,7 +94,7 @@ class AdminEventHandler(BaseEventHandler):
ip, port = node.getServer() ip, port = node.getServer()
except TypeError: except TypeError:
ip = "0.0.0.0" ip = "0.0.0.0"
port = 0 port = 0
node_information_list.append((node.getNodeType(), ip, port, node.getUUID(), node.getState())) node_information_list.append((node.getNodeType(), ip, port, node.getUUID(), node.getState()))
p = protocol.answerNodeList(node_information_list) p = protocol.answerNodeList(node_information_list)
conn.ask(p) conn.ask(p)
...@@ -268,6 +268,8 @@ class MonitoringEventHandler(BaseEventHandler): ...@@ -268,6 +268,8 @@ class MonitoringEventHandler(BaseEventHandler):
# told me at the moment. # told me at the moment.
if n.getUUID() is None or n.getUUID() != uuid: if n.getUUID() is None or n.getUUID() != uuid:
n.setUUID(uuid) n.setUUID(uuid)
else:
n.setUUID(INVALID_UUID)
if primary_uuid != INVALID_UUID: if primary_uuid != INVALID_UUID:
primary_node = app.nm.getNodeByUUID(primary_uuid) primary_node = app.nm.getNodeByUUID(primary_uuid)
...@@ -366,14 +368,15 @@ class MonitoringEventHandler(BaseEventHandler): ...@@ -366,14 +368,15 @@ class MonitoringEventHandler(BaseEventHandler):
dump(uuid)) dump(uuid))
return return
for node_type, ip_address, port, uuid, state in node_list: for node_type, ip_address, port, uuid, state in node_list:
logging.info("got node info %s %s %s" %(ip_address, port, state))
# Register/update nodes. # Register/update nodes.
addr = (ip_address, port) addr = (ip_address, port)
# Try to retrieve it from nm # Try to retrieve it from nm
n = nm.getNodeByUUID(uuid) n = None
if uuid != INVALID_UUID:
n = nm.getNodeByUUID(uuid)
if n is None: if n is None:
n = nm.getNodeByServer(addr) n = nm.getNodeByServer(addr)
if n is not None: if n is not None and uuid != INVALID_UUID:
# node only exists by address, remove it # node only exists by address, remove it
nm.remove(n) nm.remove(n)
n = None n = None
...@@ -391,6 +394,8 @@ class MonitoringEventHandler(BaseEventHandler): ...@@ -391,6 +394,8 @@ class MonitoringEventHandler(BaseEventHandler):
# told me at the moment. # told me at the moment.
if n.getUUID() is None: if n.getUUID() is None:
n.setUUID(uuid) n.setUUID(uuid)
else:
n.setUUID(INVALID_UUID)
elif node_type in (STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, ADMIN_NODE_TYPE): elif node_type in (STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, ADMIN_NODE_TYPE):
if uuid == INVALID_UUID: if uuid == INVALID_UUID:
# No interest. # No interest.
......
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