Commit 75cf411a authored by Adeodato Simo's avatar Adeodato Simo
Browse files

Introduce constant for the name of the initial node group


Signed-off-by: default avatarAdeodato Simo <dato@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 5c64fbc2
......@@ -452,7 +452,7 @@ def InitConfig(version, cluster_config, master_node_config,
}
default_nodegroup = objects.NodeGroup(
uuid=uuid_generator.Generate([], utils.NewUUID, _INITCONF_ECID),
name="default",
name=constants.INITIAL_NODE_GROUP_NAME,
members=[master_node_config.name],
)
nodegroups = {
......
......@@ -1486,7 +1486,9 @@ class ConfigWriter:
item.uuid = self._GenerateUniqueID(_UPGRADE_CONFIG_JID)
modified = True
if not self._config_data.nodegroups:
default_nodegroup = objects.NodeGroup(name="default", members=[])
default_nodegroup_name = constants.INITIAL_NODE_GROUP_NAME
default_nodegroup = objects.NodeGroup(name=default_nodegroup_name,
members=[])
self._UnlockedAddNodeGroup(default_nodegroup, _UPGRADE_CONFIG_JID, True)
modified = True
for node in self._config_data.nodes.values():
......
......@@ -1195,3 +1195,6 @@ UIDPOOL_UID_MAX = 2**32-1 # Assuming 32 bit user-ids
# Name or path of the pgrep command
PGREP = "pgrep"
# Name of the node group that gets created at cluster init or upgrade
INITIAL_NODE_GROUP_NAME = "default"
......@@ -19,6 +19,8 @@
# 02110-1301, USA.
from ganeti import constants
import qa_config
from qa_utils import AssertCommand
......@@ -27,7 +29,8 @@ def TestGroupAddRemoveRename():
"""gnt-group add/remove/rename"""
groups = qa_config.get("groups", {})
existing_group_with_nodes = groups.get("group-with-nodes", "default")
existing_group_with_nodes = groups.get("group-with-nodes",
constants.INITIAL_NODE_GROUP_NAME)
group1, group2, group3 = groups.get("inexistent-groups",
["group1", "group2", "group3"])[:3]
......
......@@ -174,8 +174,8 @@ def TestEmptyCluster():
def _VerifyGroups(data):
default_group = {
"name": "default",
"uri": "/2/groups/default",
"name": constants.INITIAL_NODE_GROUP_NAME,
"uri": "/2/groups/" + constants.INITIAL_NODE_GROUP_NAME,
}
AssertIn(default_group, data)
......
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