Commit ace16501 authored by Guido Trotter's avatar Guido Trotter
Browse files

Check for duplicate nodegroup names



Since the nodegroups dict is indexed by uuid duplicate names might
happen as a result of bugs. Add a check to prevent them.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent c60abd62
......@@ -462,11 +462,16 @@ class ConfigWriter:
node.offline))
# nodegroups checks
nodegroups_names = set()
for nodegroup_uuid in data.nodegroups:
nodegroup = data.nodegroups[nodegroup_uuid]
if nodegroup.uuid != nodegroup_uuid:
result.append("nodegroup '%s' (uuid: '%s') indexed by wrong uuid '%s'"
% (nodegroup.name, nodegroup.uuid, nodegroup_uuid))
if nodegroup.name in nodegroups_names:
result.append("duplicate nodegroup name '%s'" % nodegroup.name)
else:
nodegroups_names.add(nodegroup.name)
# drbd minors check
_, duplicates = self._UnlockedComputeDRBDMap()
......
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