MCPcopy Create free account
hub / github.com/apache/cloudstack / set_lock

Method set_lock

systemvm/debian/opt/cloud/bin/cs/CsRedundant.py:213–229  ·  view source on GitHub ↗

Make sure that primary state changes happen sequentially

(self)

Source from the content-addressed store, hash-verified

211 pass
212
213 def set_lock(self):
214 """
215 Make sure that primary state changes happen sequentially
216 """
217 iterations = 10
218 time_between = 1
219
220 for iter in range(0, iterations):
221 try:
222 s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
223 s.bind('/tmp/primary_lock')
224 return s
225 except socket.error as e:
226 error_code = e.args[0]
227 error_string = e.args[1]
228 logging.info("Primary is already running, waiting")
229 sleep(time_between)
230
231 def set_fault(self):
232 """ Set fault mode on this router """

Callers 3

set_faultMethod · 0.95
set_backupMethod · 0.95
set_primaryMethod · 0.95

Calls 1

infoMethod · 0.45

Tested by

no test coverage detected