Commit 8113a52e authored by Luca Bigliardi's avatar Luca Bigliardi Committed by Guido Trotter
Browse files

Add master candidates IPs informations to ssconf



This will be used when querying confd, in order not to rely on DNS being
available.
Signed-off-by: default avatarLuca Bigliardi <shammash@google.com>
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 476ce612
......@@ -1155,6 +1155,8 @@ class ConfigWriter:
off_data = fn(node.name for node in node_info if node.offline)
on_data = fn(node.name for node in node_info if not node.offline)
mc_data = fn(node.name for node in node_info if node.master_candidate)
mc_ips_data = fn(node.primary_ip for node in node_info
if node.master_candidate)
node_data = fn(node_names)
node_pri_ips_data = fn(node_pri_ips)
node_snd_ips_data = fn(node_snd_ips)
......@@ -1166,6 +1168,7 @@ class ConfigWriter:
constants.SS_CLUSTER_TAGS: cluster_tags,
constants.SS_FILE_STORAGE_DIR: cluster.file_storage_dir,
constants.SS_MASTER_CANDIDATES: mc_data,
constants.SS_MASTER_CANDIDATES_IPS: mc_ips_data,
constants.SS_MASTER_IP: cluster.master_ip,
constants.SS_MASTER_NETDEV: cluster.master_netdev,
constants.SS_MASTER_NODE: cluster.master_node,
......
......@@ -541,6 +541,7 @@ SS_CLUSTER_NAME = "cluster_name"
SS_CLUSTER_TAGS = "cluster_tags"
SS_FILE_STORAGE_DIR = "file_storage_dir"
SS_MASTER_CANDIDATES = "master_candidates"
SS_MASTER_CANDIDATES_IPS = "master_candidates_ips"
SS_MASTER_IP = "master_ip"
SS_MASTER_NETDEV = "master_netdev"
SS_MASTER_NODE = "master_node"
......
......@@ -97,6 +97,7 @@ class SimpleStore(object):
constants.SS_CLUSTER_TAGS,
constants.SS_FILE_STORAGE_DIR,
constants.SS_MASTER_CANDIDATES,
constants.SS_MASTER_CANDIDATES_IPS,
constants.SS_MASTER_IP,
constants.SS_MASTER_NETDEV,
constants.SS_MASTER_NODE,
......@@ -190,6 +191,14 @@ class SimpleStore(object):
nl = data.splitlines(False)
return nl
def GetMasterCandidatesIPList(self):
"""Return the list of master candidates' primary IP.
"""
data = self._ReadFile(constants.SS_MASTER_CANDIDATES_IPS)
nl = data.splitlines(False)
return nl
def GetMasterIP(self):
"""Get the IP of the master node for this cluster.
......
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