Commit 622444e5 authored by Iustin Pop's avatar Iustin Pop
Browse files

Export node group data in iallocator

Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent acd34ea7
......@@ -171,6 +171,14 @@ request
the names of the nodes to be evacuated
a dictionary with the data for the cluster's node groups; it is keyed
on the group UUID, and the values are a dictionary with the following
the node group name
a dictionary with the data for the current existing instance on the
cluster, indexed by instance name; the contents are similar to the
......@@ -10200,12 +10200,24 @@ class IAllocator(object):
data["nodegroups"] = self._ComputeNodeGroupData(cfg)
data["nodes"] = self._ComputeNodeData(cfg, node_data, node_iinfo, i_list)
data["instances"] = self._ComputeInstanceData(cluster_info, i_list)
self.in_data = data
def _ComputeNodeGroupData(cfg):
"""Compute node groups data.
ng = {}
for guuid, gdata in cfg.GetAllNodeGroupsInfo().items():
ng[guuid] = { "name": }
return ng
def _ComputeNodeData(cfg, node_data, node_iinfo, i_list):
"""Compute global node data.
......@@ -876,6 +876,13 @@ class ConfigWriter:
return nodegroup.uuid
raise errors.OpPrereqError("Nodegroup '%s' not found", target)
@locking.ssynchronized(_config_lock, shared=1)
def GetAllNodeGroupsInfo(self):
"""Get the configuration of all node groups.
return dict(self._config_data.nodegroups)
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