Commit e267ed79 authored by Ivan Tyagov's avatar Ivan Tyagov

SR may fail for number of reasons (incl. network failures)

so be tolerant and run it a few times before giving up.
parent 2bebae7a
...@@ -31,6 +31,7 @@ import time ...@@ -31,6 +31,7 @@ import time
import xml_marshaller import xml_marshaller
MAX_PARTIONS = 10 MAX_PARTIONS = 10
MAX_SR_RETRIES = 3
class SlapOSControler(object): class SlapOSControler(object):
...@@ -95,11 +96,15 @@ class SlapOSControler(object): ...@@ -95,11 +96,15 @@ class SlapOSControler(object):
command = [config['slapgrid_software_binary'], '-v', '-c', command = [config['slapgrid_software_binary'], '-v', '-c',
#'--buildout-parameter',"'-U -N' -o", #'--buildout-parameter',"'-U -N' -o",
config['slapos_config']] config['slapos_config']]
slapgrid = subprocess.Popen(command, # a SR may fail for number of reasons (incl. network failures)
stdout=stdout, stderr=stderr, # so be tolerant and run it a few times before giving up
close_fds=True, preexec_fn=os.setsid) for runs in range(0, MAX_SR_RETRIES):
process_group_pid_set.add(slapgrid.pid) slapgrid = subprocess.Popen(command,
slapgrid.wait() stdout=stdout, stderr=stderr,
close_fds=True, preexec_fn=os.setsid)
process_group_pid_set.add(slapgrid.pid)
slapgrid.wait()
stdout.seek(0) stdout.seek(0)
stderr.seek(0) stderr.seek(0)
process_group_pid_set.remove(slapgrid.pid) process_group_pid_set.remove(slapgrid.pid)
......
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