Revision 3b6b6129 lib/bootstrap.py
b/lib/bootstrap.py | ||
---|---|---|
42 | 42 |
from ganeti import bdev |
43 | 43 |
from ganeti import netutils |
44 | 44 |
from ganeti import backend |
45 |
from ganeti import luxi |
|
46 |
|
|
45 | 47 |
|
46 | 48 |
# ec_id for InitConfig's temporary reservation manager |
47 | 49 |
_INITCONF_ECID = "initconfig-ecid" |
48 | 50 |
|
51 |
#: After how many seconds daemon must be responsive |
|
52 |
_DAEMON_READY_TIMEOUT = 10.0 |
|
53 |
|
|
49 | 54 |
|
50 | 55 |
def _InitSSHSetup(): |
51 | 56 |
"""Setup the SSH configuration for the cluster. |
... | ... | |
181 | 186 |
raise utils.RetryAgain() |
182 | 187 |
|
183 | 188 |
try: |
184 |
utils.Retry(_CheckNodeDaemon, 1.0, 10.0)
|
|
189 |
utils.Retry(_CheckNodeDaemon, 1.0, _DAEMON_READY_TIMEOUT)
|
|
185 | 190 |
except utils.RetryTimeout: |
186 | 191 |
raise errors.OpExecError("Node daemon on %s didn't answer queries within" |
187 |
" 10 seconds" % node_name) |
|
192 |
" %s seconds" % (node_name, _DAEMON_READY_TIMEOUT)) |
|
193 |
|
|
194 |
|
|
195 |
def _WaitForMasterDaemon(): |
|
196 |
"""Wait for master daemon to become responsive. |
|
197 |
|
|
198 |
""" |
|
199 |
def _CheckMasterDaemon(): |
|
200 |
try: |
|
201 |
cl = luxi.Client() |
|
202 |
(cluster_name, ) = cl.QueryConfigValues(["cluster_name"]) |
|
203 |
except Exception: |
|
204 |
raise utils.RetryAgain() |
|
205 |
|
|
206 |
logging.debug("Received cluster name %s from master", cluster_name) |
|
207 |
|
|
208 |
try: |
|
209 |
utils.Retry(_CheckMasterDaemon, 1.0, _DAEMON_READY_TIMEOUT) |
|
210 |
except utils.RetryTimeout: |
|
211 |
raise errors.OpExecError("Master daemon didn't answer queries within" |
|
212 |
" %s seconds" % _DAEMON_READY_TIMEOUT) |
|
188 | 213 |
|
189 | 214 |
|
190 | 215 |
def _InitFileStorage(file_storage_dir): |
... | ... | |
418 | 443 |
" had exitcode %s and error %s" % |
419 | 444 |
(result.cmd, result.exit_code, result.output)) |
420 | 445 |
|
446 |
_WaitForMasterDaemon() |
|
447 |
|
|
421 | 448 |
|
422 | 449 |
def InitConfig(version, cluster_config, master_node_config, |
423 | 450 |
cfg_file=constants.CLUSTER_CONF_FILE): |
Also available in: Unified diff