From 6f076453f3c37a843b6e5b2cb83c3939ce47380b Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Tue, 7 Sep 2010 17:42:13 +0100 Subject: [PATCH] Export nodegroups list (names/uuids) via ssconf Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/config.py | 5 +++++ lib/constants.py | 1 + lib/ssconf.py | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/lib/config.py b/lib/config.py index f955b10be..5f13d7d8d 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 a0f1675ac..a9d61d45b 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 c759f8e4b..2eccc59b8 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. -- GitLab