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

IAllocator: fill i_list in a more proper way

- reuse the previously called cluster_info, rather than calling it again
- get all the instances from the config atomically, to prevent race conditions
- use a list comprehension, for simplicity

Reviewed-by: iustinp
parent 90a7547a
......@@ -5363,12 +5363,8 @@ class IAllocator(object):
"enable_hypervisors": list(cluster_info.enabled_hypervisors),
# we don't have job IDs
i_list = []
cluster = self.cfg.GetClusterInfo()
for iname in cfg.GetInstanceList():
i_obj = cfg.GetInstanceInfo(iname)
i_list.append((i_obj, cluster.FillBE(i_obj)))
iinfo = cfg.GetAllInstancesInfo().values()
i_list = [(inst, cluster_info.FillBE(inst)) for inst in iinfo]
# node data
node_results = {}
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