Revision f56618e0
b/lib/config.py | ||
---|---|---|
859 | 859 |
os.rename(name, destination) |
860 | 860 |
self.write_count += 1 |
861 | 861 |
|
862 |
# and redistribute the config file |
|
862 |
# and redistribute the config file to master candidates
|
|
863 | 863 |
self._DistributeConfig() |
864 | 864 |
|
865 | 865 |
# Write ssconf files on all nodes (including locally) |
... | ... | |
877 | 877 |
associated value |
878 | 878 |
|
879 | 879 |
""" |
880 |
node_list = "\n".join(utils.NiceSort(self._UnlockedGetNodeList())) |
|
880 |
node_list = utils.NiceSort(self._UnlockedGetNodeList()) |
|
881 |
mc_list = [self._UnlockedGetNodeInfo(name) for name in node_list] |
|
882 |
mc_list = [node.name for node in mc_list if node.master_candidate] |
|
883 |
node_list = "\n".join(node_list) |
|
884 |
mc_list = "\n".join(mc_list) |
|
885 |
|
|
881 | 886 |
cluster = self._config_data.cluster |
882 | 887 |
return { |
883 | 888 |
constants.SS_CLUSTER_NAME: cluster.cluster_name, |
884 | 889 |
constants.SS_FILE_STORAGE_DIR: cluster.file_storage_dir, |
890 |
constants.SS_MASTER_CANDIDATES: mc_list, |
|
885 | 891 |
constants.SS_MASTER_IP: cluster.master_ip, |
886 | 892 |
constants.SS_MASTER_NETDEV: cluster.master_netdev, |
887 | 893 |
constants.SS_MASTER_NODE: cluster.master_node, |
b/lib/constants.py | ||
---|---|---|
382 | 382 |
# SSCONF keys |
383 | 383 |
SS_CLUSTER_NAME = "cluster_name" |
384 | 384 |
SS_FILE_STORAGE_DIR = "file_storage_dir" |
385 |
SS_MASTER_CANDIDATES = "master_candidates" |
|
385 | 386 |
SS_MASTER_IP = "master_ip" |
386 | 387 |
SS_MASTER_NETDEV = "master_netdev" |
387 | 388 |
SS_MASTER_NODE = "master_node" |
b/lib/ssconf.py | ||
---|---|---|
127 | 127 |
_VALID_KEYS = ( |
128 | 128 |
constants.SS_CLUSTER_NAME, |
129 | 129 |
constants.SS_FILE_STORAGE_DIR, |
130 |
constants.SS_MASTER_CANDIDATES, |
|
130 | 131 |
constants.SS_MASTER_IP, |
131 | 132 |
constants.SS_MASTER_NETDEV, |
132 | 133 |
constants.SS_MASTER_NODE, |
... | ... | |
210 | 211 |
""" |
211 | 212 |
return self._ReadFile(constants.SS_FILE_STORAGE_DIR) |
212 | 213 |
|
214 |
def GetMasterCandidates(self): |
|
215 |
"""Return the list of master candidates. |
|
216 |
|
|
217 |
""" |
|
218 |
data = self._ReadFile(constants.SS_MASTER_CANDIDATES) |
|
219 |
nl = data.splitlines(False) |
|
220 |
return nl |
|
221 |
|
|
213 | 222 |
def GetMasterIP(self): |
214 | 223 |
"""Get the IP of the master node for this cluster. |
215 | 224 |
|
Also available in: Unified diff