Skip to content
Snippets Groups Projects
Commit d367b66c authored by Manuel Franceschini's avatar Manuel Franceschini
Browse files

cluster init: Write ssconf before noded starts


This change is needed as we will need to read the primary ip version
cluster parameter before we start the node daemon. The reason is that we
need to know in advance if we bind to the IPv4 or IPv6 any address.

Signed-off-by: default avatarManuel Franceschini <livewire@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 8b312c1d
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment