Commit dac81741 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

config: Add method to get members of nodes' groups



This will be used for locking during node evacuation.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 876f6a5e
......@@ -1071,6 +1071,17 @@ class ConfigWriter:
"""
return self._config_data.nodegroups.keys()
@locking.ssynchronized(_config_lock, shared=1)
def GetNodeGroupMembersByNodes(self, nodes):
"""Get nodes which are member in the same nodegroups as the given nodes.
"""
ngfn = lambda node_name: self._UnlockedGetNodeInfo(node_name).group
return frozenset(member_name
for node_name in nodes
for member_name in
self._UnlockedGetNodeGroup(ngfn(node_name)).members)
@locking.ssynchronized(_config_lock)
def AddInstance(self, instance, ec_id):
"""Add an instance to the config.
......
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