Commit 746ac978 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Admin handler forward setClusterState packet to the primary master node.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@669 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent b21e7309
......@@ -115,13 +115,26 @@ class AdminEventHandler(BaseEventHandler):
master_conn = self.app.master_conn
p = protocol.setNodeState(uuid, state, modify_partition_table)
master_conn.ask(p)
self.app.notified = False
self.app.notified = False
while not self.app.notified:
self.app.em.poll(1)
node = self.app.nm.getNodeByUUID(uuid)
p = protocol.answerNodeState(node.getUUID(), node.getState())
conn.answer(p, packet)
def handleSetClusterState(self, conn, packet, name, state):
if name != self.app.name:
logging.error('reject an alien cluster')
raise protocol.ProtocolError('invalid cluster name')
# forward to primary
master_conn = self.app.master_conn
p = protocol.setClusterState(name, state)
master_conn.ask(p)
self.app.cluster_state = None
while self.app.cluster_state is None:
self.app.em.poll(1)
conn.answer(protocol.answerClusterState(self.app.cluster_state), packet)
def handleAddPendingNodes(self, conn, packet, uuid_list):
uuids = ', '.join([dump(uuid) for uuid in uuid_list])
logging.info('Add nodes %s' % uuids)
......@@ -431,6 +444,9 @@ class MonitoringEventHandler(BaseEventHandler):
self.app.notified = True
def handleAnswerClusterState(self, conn, packet, state):
self.app.cluster_state = state
def handleAnswerNewNodes(self, conn, packet, uuid_list):
self.app.uuid_list = uuid_list
self.app.nn_notified = True
......
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