diff --git a/lib/bootstrap.py b/lib/bootstrap.py index f3319df45dd384f5716a5da721fe77c32b1b7caa..39d4b2227185f46c3c08812e11686235d8bd7e7b 100644 --- a/lib/bootstrap.py +++ b/lib/bootstrap.py @@ -41,6 +41,7 @@ from ganeti import serializer from ganeti import hypervisor from ganeti import bdev from ganeti import netutils +from ganeti import backend def _InitSSHSetup(): @@ -325,9 +326,6 @@ def InitCluster(cluster_name, mac_prefix, hv_class = hypervisor.GetHypervisor(hv_name) hv_class.CheckParameterSyntax(hv_params) - # set up the inter-node password and certificate, start noded - _InitGanetiServerSetup(hostname.name) - # set up ssh config and /etc/hosts sshline = utils.ReadFile(constants.SSH_HOST_RSA_PUB) sshkey = sshline.split(" ")[1] @@ -385,9 +383,14 @@ def InitCluster(cluster_name, mac_prefix, offline=False, drained=False, ) InitConfig(constants.CONFIG_VERSION, cluster_config, master_node_config) - cfg = config.ConfigWriter() + cfg = config.ConfigWriter(offline=True) ssh.WriteKnownHostsFile(cfg, constants.SSH_KNOWN_HOSTS_FILE) cfg.Update(cfg.GetClusterInfo(), logging.error) + backend.WriteSsconfFiles(cfg.GetSsconfValues()) + + + # set up the inter-node password and certificate + _InitGanetiServerSetup(hostname.name) # start the master ip # TODO: Review rpc call from bootstrap diff --git a/lib/config.py b/lib/config.py index 16acc107f3f26829c63d3a85f6accebd98da91e2..eec99f6b97369ac373fc21eed8217b0048d5f86a 100644 --- a/lib/config.py +++ b/lib/config.py @@ -31,6 +31,9 @@ much memory. """ +# pylint: disable-msg=R0904 +# R0904: Too many public methods + import os import random import logging @@ -1411,6 +1414,13 @@ class ConfigWriter: constants.SS_UID_POOL: uid_pool, } + @locking.ssynchronized(_config_lock, shared=1) + def GetSsconfValues(self): + """Wrapper using lock around _UnlockedGetSsconf(). + + """ + return self._UnlockedGetSsconfValues() + @locking.ssynchronized(_config_lock, shared=1) def GetVGName(self): """Return the volume group name.