diff --git a/lib/config.py b/lib/config.py index f955b10bebd3b3688b7cab141ed33b6b39cf00c2..5f13d7d8d933433521468a1b454352f1afccedb4 100644 --- a/lib/config.py +++ b/lib/config.py @@ -1485,6 +1485,10 @@ class ConfigWriter: uid_pool = uidpool.FormatUidPool(cluster.uid_pool, separator="\n") + nodegroups = ["%s %s" % (nodegroup.uuid, nodegroup.name) for nodegroup in + self._config_data.nodegroups.values()] + nodegroups_data = fn(utils.NiceSort(nodegroups)) + return { constants.SS_CLUSTER_NAME: cluster.cluster_name, constants.SS_CLUSTER_TAGS: cluster_tags, @@ -1505,6 +1509,7 @@ class ConfigWriter: constants.SS_HYPERVISOR_LIST: hypervisor_list, constants.SS_MAINTAIN_NODE_HEALTH: str(cluster.maintain_node_health), constants.SS_UID_POOL: uid_pool, + constants.SS_NODEGROUPS: nodegroups_data, } @locking.ssynchronized(_config_lock, shared=1) diff --git a/lib/constants.py b/lib/constants.py index a0f1675ac16d042689b07b2fb00f7adcc86f7d06..a9d61d45bc3f9a6db2f1b6bf16f74517a854d7bf 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -904,6 +904,7 @@ SS_RELEASE_VERSION = "release_version" SS_HYPERVISOR_LIST = "hypervisor_list" SS_MAINTAIN_NODE_HEALTH = "maintain_node_health" SS_UID_POOL = "uid_pool" +SS_NODEGROUPS = "nodegroups" # cluster wide default parameters DEFAULT_ENABLED_HYPERVISOR = HT_XEN_PVM diff --git a/lib/ssconf.py b/lib/ssconf.py index c759f8e4b82dd03009c69c41eb35c50340da3112..2eccc59b89187e9b20daa87c219f6b727aa2c2ef 100644 --- a/lib/ssconf.py +++ b/lib/ssconf.py @@ -288,6 +288,7 @@ class SimpleStore(object): constants.SS_HYPERVISOR_LIST, constants.SS_MAINTAIN_NODE_HEALTH, constants.SS_UID_POOL, + constants.SS_NODEGROUPS, ) _MAX_SIZE = 131072 @@ -426,6 +427,14 @@ class SimpleStore(object): nl = data.splitlines(False) return nl + def GetNodegroupList(self): + """Return the list of nodegroups. + + """ + data = self._ReadFile(constants.SS_NODEGROUPS) + nl = data.splitlines(False) + return nl + def GetClusterTags(self): """Return the cluster tags.