diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 98147a0e8eb8d73f1794f570f649b70cb525fed4..3f36b0a0443c1d3324ebed8eed33a55b1cf8b123 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -680,7 +680,7 @@ def _AdjustCandidatePool(lu): ", ".join(node.name for node in mod_list)) for name in mod_list: lu.context.ReaddNode(name) - mc_now, mc_max = lu.cfg.GetMasterCandidateStats() + mc_now, mc_max, _ = lu.cfg.GetMasterCandidateStats() if mc_now > mc_max: lu.LogInfo("Note: more nodes are candidates (%d) than desired (%d)" % (mc_now, mc_max)) @@ -2799,7 +2799,7 @@ class LUAddNode(LogicalUnit): exceptions = [node] else: exceptions = [] - mc_now, mc_max = self.cfg.GetMasterCandidateStats(exceptions) + mc_now, mc_max, _ = self.cfg.GetMasterCandidateStats(exceptions) # the new node will increase mc_max with one, so: mc_max = min(mc_max + 1, cp_size) self.master_candidate = mc_now < mc_max @@ -2973,7 +2973,7 @@ class LUSetNodeParams(LogicalUnit): if ((self.op.master_candidate == False or self.op.offline == True or self.op.drained == True) and node.master_candidate): cp_size = self.cfg.GetClusterInfo().candidate_pool_size - num_candidates, _ = self.cfg.GetMasterCandidateStats() + num_candidates, _, _ = self.cfg.GetMasterCandidateStats() if num_candidates <= cp_size: msg = ("Not enough master candidates (desired" " %d, new value will be %d)" % (cp_size, num_candidates-1)) diff --git a/lib/config.py b/lib/config.py index 1761f73ccdead0751d8696640b584604d5c244f3..41fcf094db04a6e913900667e209aba42456ff9d 100644 --- a/lib/config.py +++ b/lib/config.py @@ -378,7 +378,7 @@ class ConfigWriter: result.append("Master node is not a master candidate") # master candidate checks - mc_now, mc_max = self._UnlockedGetMasterCandidateStats() + mc_now, mc_max, _ = self._UnlockedGetMasterCandidateStats() if mc_now < mc_max: result.append("Not enough master candidates: actual %d, target %d" % (mc_now, mc_max)) @@ -1015,10 +1015,10 @@ class ConfigWriter: @type exceptions: list @param exceptions: if passed, list of nodes that should be ignored @rtype: tuple - @return: tuple of (current, desired and possible) + @return: tuple of (current, desired and possible, possible) """ - mc_now = mc_max = 0 + mc_now = mc_should = mc_max = 0 for node in self._config_data.nodes.values(): if exceptions and node.name in exceptions: continue @@ -1026,8 +1026,8 @@ class ConfigWriter: mc_max += 1 if node.master_candidate: mc_now += 1 - mc_max = min(mc_max, self._config_data.cluster.candidate_pool_size) - return (mc_now, mc_max) + mc_should = min(mc_max, self._config_data.cluster.candidate_pool_size) + return (mc_now, mc_should, mc_max) @locking.ssynchronized(_config_lock, shared=1) def GetMasterCandidateStats(self, exceptions=None): @@ -1051,7 +1051,7 @@ class ConfigWriter: @return: list with the adjusted nodes (L{objects.Node} instances) """ - mc_now, mc_max = self._UnlockedGetMasterCandidateStats() + mc_now, mc_max, _ = self._UnlockedGetMasterCandidateStats() mod_list = [] if mc_now < mc_max: node_list = self._config_data.nodes.keys()