From a3316e4a596d3cf83f6280f037c34521e5a505dc Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Fri, 5 Dec 2008 10:12:45 +0000 Subject: [PATCH] Add the offline node list to ssconf The patch also changes the various node list generation to be more consistent. Reviewed-by: imsnah --- lib/config.py | 17 ++++++++++------- lib/constants.py | 1 + lib/ssconf.py | 1 + 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/config.py b/lib/config.py index 67c5e06..0d02f94 100644 --- a/lib/config.py +++ b/lib/config.py @@ -889,21 +889,24 @@ class ConfigWriter: associated value """ - node_list = utils.NiceSort(self._UnlockedGetNodeList()) - mc_list = [self._UnlockedGetNodeInfo(name) for name in node_list] - mc_list = [node.name for node in mc_list if node.master_candidate] - node_list = "\n".join(node_list) - mc_list = "\n".join(mc_list) + fn = "\n".join + node_names = utils.NiceSort(self._UnlockedGetNodeList()) + node_info = [self._UnlockedGetNodeInfo(name) for name in node_names] + + off_data = fn(node.name for node in node_info if node.offline) + mc_data = fn(node.name for node in node_info if node.master_candidate) + node_data = fn(node_names) cluster = self._config_data.cluster return { constants.SS_CLUSTER_NAME: cluster.cluster_name, constants.SS_FILE_STORAGE_DIR: cluster.file_storage_dir, - constants.SS_MASTER_CANDIDATES: mc_list, + constants.SS_MASTER_CANDIDATES: mc_data, constants.SS_MASTER_IP: cluster.master_ip, constants.SS_MASTER_NETDEV: cluster.master_netdev, constants.SS_MASTER_NODE: cluster.master_node, - constants.SS_NODE_LIST: node_list, + constants.SS_NODE_LIST: node_data, + constants.SS_OFFLINE_NODES: off_data, } @locking.ssynchronized(_config_lock) diff --git a/lib/constants.py b/lib/constants.py index 05bc01a..f9e4838 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -404,6 +404,7 @@ SS_MASTER_IP = "master_ip" SS_MASTER_NETDEV = "master_netdev" SS_MASTER_NODE = "master_node" SS_NODE_LIST = "node_list" +SS_OFFLINE_NODES = "offline_nodes" # cluster wide default parameters DEFAULT_ENABLED_HYPERVISOR = HT_XEN_PVM diff --git a/lib/ssconf.py b/lib/ssconf.py index c36aa65..225f38c 100644 --- a/lib/ssconf.py +++ b/lib/ssconf.py @@ -132,6 +132,7 @@ class SimpleStore(object): constants.SS_MASTER_NETDEV, constants.SS_MASTER_NODE, constants.SS_NODE_LIST, + constants.SS_OFFLINE_NODES, ) _MAX_SIZE = 131072 -- 1.7.10.4