Commit 3b6b6129 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Wait for master to become available on initialization

This is analogue to the existing check for a responsive node daemon.
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarIustin Pop <>
parent 952d7515
......@@ -42,10 +42,15 @@ from ganeti import hypervisor
from ganeti import bdev
from ganeti import netutils
from ganeti import backend
from ganeti import luxi
# ec_id for InitConfig's temporary reservation manager
_INITCONF_ECID = "initconfig-ecid"
#: After how many seconds daemon must be responsive
def _InitSSHSetup():
"""Setup the SSH configuration for the cluster.
......@@ -181,10 +186,30 @@ def _WaitForNodeDaemon(node_name):
raise utils.RetryAgain()
utils.Retry(_CheckNodeDaemon, 1.0, 10.0)
utils.Retry(_CheckNodeDaemon, 1.0, _DAEMON_READY_TIMEOUT)
except utils.RetryTimeout:
raise errors.OpExecError("Node daemon on %s didn't answer queries within"
" 10 seconds" % node_name)
" %s seconds" % (node_name, _DAEMON_READY_TIMEOUT))
def _WaitForMasterDaemon():
"""Wait for master daemon to become responsive.
def _CheckMasterDaemon():
cl = luxi.Client()
(cluster_name, ) = cl.QueryConfigValues(["cluster_name"])
except Exception:
raise utils.RetryAgain()
logging.debug("Received cluster name %s from master", cluster_name)
utils.Retry(_CheckMasterDaemon, 1.0, _DAEMON_READY_TIMEOUT)
except utils.RetryTimeout:
raise errors.OpExecError("Master daemon didn't answer queries within"
" %s seconds" % _DAEMON_READY_TIMEOUT)
def _InitFileStorage(file_storage_dir):
......@@ -418,6 +443,8 @@ def InitCluster(cluster_name, mac_prefix, # pylint: disable-msg=R0913
" had exitcode %s and error %s" %
(result.cmd, result.exit_code, result.output))
def InitConfig(version, cluster_config, master_node_config,
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