Commit 5a76664a authored by Julien Muchembled's avatar Julien Muchembled

master: simplify recovery loop

parent b19bf40e
...@@ -58,35 +58,30 @@ class RecoveryManager(MasterHandler): ...@@ -58,35 +58,30 @@ class RecoveryManager(MasterHandler):
poll = app.em.poll poll = app.em.poll
while 1: while 1:
poll(1) poll(1)
allowed_node_set = set()
if pt.filled(): if pt.filled():
# A partition table exists, we are starting an existing # A partition table exists, we are starting an existing
# cluster. # cluster.
partition_node_set = pt.getReadableCellNodeSet() node_list = pt.getReadableCellNodeSet()
pending_node_set = {x for x in partition_node_set if app._startup_allowed:
if x.isPending()} node_list = [node for node in node_list if node.isPending()]
if app._startup_allowed or \ elif not all(node.isPending() for node in node_list):
partition_node_set == pending_node_set: continue
allowed_node_set = pending_node_set
node_list = pt.getConnectedNodeList
elif app._startup_allowed: elif app._startup_allowed:
# No partition table and admin allowed startup, we are # No partition table and admin allowed startup, we are
# creating a new cluster out of all pending nodes. # creating a new cluster out of all pending nodes.
allowed_node_set = set(app.nm.getStorageList( node_list = app.nm.getStorageList(only_identified=True)
only_identified=True)) else:
node_list = lambda: allowed_node_set continue
if allowed_node_set: if node_list and not any(node.getConnection().isPending()
for node in allowed_node_set: for node in node_list):
assert node.isPending(), node if pt.filled():
if node.getConnection().isPending(): node_list = pt.getConnectedNodeList()
break break
else:
node_list = node_list()
break
logging.info('startup allowed') logging.info('startup allowed')
for node in node_list: for node in node_list:
assert node.isPending(), node
node.setRunning() node.setRunning()
app.broadcastNodesInformation(node_list) app.broadcastNodesInformation(node_list)
......
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