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
+_DAEMON_READY_TIMEOUT = 10.0
+
def _InitSSHSetup():
"""Setup the SSH configuration for the cluster.
raise utils.RetryAgain()
try:
- 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():
+ try:
+ cl = luxi.Client()
+ (cluster_name, ) = cl.QueryConfigValues(["cluster_name"])
+ except Exception:
+ raise utils.RetryAgain()
+
+ logging.debug("Received cluster name %s from master", cluster_name)
+
+ try:
+ 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):
" had exitcode %s and error %s" %
(result.cmd, result.exit_code, result.output))
+ _WaitForMasterDaemon()
+
def InitConfig(version, cluster_config, master_node_config,
cfg_file=constants.CLUSTER_CONF_FILE):