Commit 07cee755 authored by Vincent Pelletier's avatar Vincent Pelletier

When primary master node gets disconnected, use NodeManager.update method with...

When primary master node gets disconnected, use NodeManager.update method with DOWN_STATE, so that it gets removed.
Clear node manager content and re-add all master node given in the configuration before trying to reconnect to primary master.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1174 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent fa76ea8b
......@@ -85,9 +85,6 @@ class Application(object):
if len(self.name) == 0:
raise RuntimeError, 'cluster name must be non-empty'
for server in self.master_node_list:
self.nm.add(MasterNode(server = server))
# Make a listening port.
handler = AdminEventHandler(self)
ListeningConnection(self.em, handler, addr = self.server,
......@@ -114,6 +111,11 @@ class Application(object):
Note that I do not accept any connection from non-master nodes
at this stage."""
nm = self.nm
nm.clear()
for server in self.master_node_list:
nm.add(MasterNode(server = server))
# search, find, connect and identify to the primary master
bootstrap = BootstrapManager(self, self.name, protocol.ADMIN_NODE_TYPE,
self.uuid, self.server)
......
......@@ -137,9 +137,12 @@ class MasterEventHandler(EventHandler):
app.master_conn = None
app.master_node = None
app.uuid = None
node = app.nm.getNodeByUUID(conn.getUUID())
nm = app.nm
uuid = conn.getUUID()
node = nm.getNodeByUUID(uuid)
assert node is not None
node.setState(protocol.TEMPORARILY_DOWN_STATE)
nm.update([(node.getType(), node.getServer(), uuid,
protocol.DOWN_STATE)])
raise PrimaryFailure
def connectionFailed(self, conn):
......
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