Commit 63c7d627 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Allow start a test cluster without leave the recovery state.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2088 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 1d2dca89
...@@ -258,26 +258,32 @@ class NEOCluster(object): ...@@ -258,26 +258,32 @@ class NEOCluster(object):
sql_connection.commit() sql_connection.commit()
sql_connection.close() sql_connection.close()
def start(self, except_storages=()): def run(self, except_storages=()):
neoctl = self.neoctl """ Start cluster processes except some storage nodes """
assert len(self.process_dict) assert len(self.process_dict)
for process_list in self.process_dict.itervalues(): for process_list in self.process_dict.itervalues():
for process in process_list: for process in process_list:
if process not in except_storages: if process not in except_storages:
process.start() process.start()
# Try to put cluster in running state. This will succeed as soon as # wait for the admin node availability
# admin node could connect to the primary master node.
end_time = time.time() + MAX_START_TIME end_time = time.time() + MAX_START_TIME
while True: while True:
if time.time() > end_time: if time.time() > end_time:
raise AssertionError, 'Timeout when starting cluster' raise AssertionError, 'Timeout when starting cluster'
try: try:
neoctl.startCluster() self.neoctl.getClusterState()
except NotReadyException: except NotReadyException:
time.sleep(0.5) time.sleep(0.5)
else: else:
break break
def start(self, except_storages=()):
""" Do a complete start of a cluster """
self.run(except_storages=except_storages)
neoctl = self.neoctl
neoctl.startCluster()
target_count = len(self.db_list) - len(except_storages) target_count = len(self.db_list) - len(except_storages)
end_time = time.time() + MAX_START_TIME
while True: while True:
if time.time() > end_time: if time.time() > end_time:
raise AssertionError, 'Timeout when starting cluster' raise AssertionError, 'Timeout when starting cluster'
......
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