Commit ee513a66 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix _AdjustCandidatePool

Currently the ConfigWriter.MaintainCandidatePool returns node names, and
_AdjustCandidatePool uses them as such, but then it passes these to
context.ReaddNode which in turn passes them to jqueue.JobQueue.AddNode which
uses them as objects.Node instances.

Since this is currently the only usage, we change return type from
ConfigWriter.MaintainCandidatePool to be objects and adjust the logging of
their names, so that the auto-adjusement works.

Reviewed-by: ultrotter
parent 3a5ba66a
...@@ -533,7 +533,7 @@ def _AdjustCandidatePool(lu): ...@@ -533,7 +533,7 @@ def _AdjustCandidatePool(lu):
mod_list = lu.cfg.MaintainCandidatePool() mod_list = lu.cfg.MaintainCandidatePool()
if mod_list: if mod_list:
lu.LogInfo("Promoted nodes to master candidate role: %s", lu.LogInfo("Promoted nodes to master candidate role: %s",
", ".join(mod_list)) ", ".join(node.name for node in mod_list))
for name in mod_list: for name in mod_list:
lu.context.ReaddNode(name) lu.context.ReaddNode(name)
mc_now, mc_max = lu.cfg.GetMasterCandidateStats() mc_now, mc_max = lu.cfg.GetMasterCandidateStats()
......
...@@ -809,7 +809,7 @@ class ConfigWriter: ...@@ -809,7 +809,7 @@ class ConfigWriter:
"""Try to grow the candidate pool to the desired size. """Try to grow the candidate pool to the desired size.
@rtype: list @rtype: list
@return: list with the adjusted node names @return: list with the adjusted nodes (L{objects.Node} instances)
""" """
mc_now, mc_max = self._UnlockedGetMasterCandidateStats() mc_now, mc_max = self._UnlockedGetMasterCandidateStats()
...@@ -823,7 +823,7 @@ class ConfigWriter: ...@@ -823,7 +823,7 @@ class ConfigWriter:
node = self._config_data.nodes[name] node = self._config_data.nodes[name]
if node.master_candidate or node.offline: if node.master_candidate or node.offline:
continue continue
mod_list.append(node.name) mod_list.append(node)
node.master_candidate = True node.master_candidate = True
node.serial_no += 1 node.serial_no += 1
mc_now += 1 mc_now += 1
......
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