Revision e623dbe3

b/lib/cmdlib.py
680 680
               ", ".join(node.name for node in mod_list))
681 681
    for name in mod_list:
682 682
      lu.context.ReaddNode(name)
683
  mc_now, mc_max = lu.cfg.GetMasterCandidateStats()
683
  mc_now, mc_max, _ = lu.cfg.GetMasterCandidateStats()
684 684
  if mc_now > mc_max:
685 685
    lu.LogInfo("Note: more nodes are candidates (%d) than desired (%d)" %
686 686
               (mc_now, mc_max))
......
2799 2799
      exceptions = [node]
2800 2800
    else:
2801 2801
      exceptions = []
2802
    mc_now, mc_max = self.cfg.GetMasterCandidateStats(exceptions)
2802
    mc_now, mc_max, _ = self.cfg.GetMasterCandidateStats(exceptions)
2803 2803
    # the new node will increase mc_max with one, so:
2804 2804
    mc_max = min(mc_max + 1, cp_size)
2805 2805
    self.master_candidate = mc_now < mc_max
......
2973 2973
    if ((self.op.master_candidate == False or self.op.offline == True or
2974 2974
         self.op.drained == True) and node.master_candidate):
2975 2975
      cp_size = self.cfg.GetClusterInfo().candidate_pool_size
2976
      num_candidates, _ = self.cfg.GetMasterCandidateStats()
2976
      num_candidates, _, _ = self.cfg.GetMasterCandidateStats()
2977 2977
      if num_candidates <= cp_size:
2978 2978
        msg = ("Not enough master candidates (desired"
2979 2979
               " %d, new value will be %d)" % (cp_size, num_candidates-1))
b/lib/config.py
378 378
      result.append("Master node is not a master candidate")
379 379

  
380 380
    # master candidate checks
381
    mc_now, mc_max = self._UnlockedGetMasterCandidateStats()
381
    mc_now, mc_max, _ = self._UnlockedGetMasterCandidateStats()
382 382
    if mc_now < mc_max:
383 383
      result.append("Not enough master candidates: actual %d, target %d" %
384 384
                    (mc_now, mc_max))
......
1015 1015
    @type exceptions: list
1016 1016
    @param exceptions: if passed, list of nodes that should be ignored
1017 1017
    @rtype: tuple
1018
    @return: tuple of (current, desired and possible)
1018
    @return: tuple of (current, desired and possible, possible)
1019 1019

  
1020 1020
    """
1021
    mc_now = mc_max = 0
1021
    mc_now = mc_should = mc_max = 0
1022 1022
    for node in self._config_data.nodes.values():
1023 1023
      if exceptions and node.name in exceptions:
1024 1024
        continue
......
1026 1026
        mc_max += 1
1027 1027
      if node.master_candidate:
1028 1028
        mc_now += 1
1029
    mc_max = min(mc_max, self._config_data.cluster.candidate_pool_size)
1030
    return (mc_now, mc_max)
1029
    mc_should = min(mc_max, self._config_data.cluster.candidate_pool_size)
1030
    return (mc_now, mc_should, mc_max)
1031 1031

  
1032 1032
  @locking.ssynchronized(_config_lock, shared=1)
1033 1033
  def GetMasterCandidateStats(self, exceptions=None):
......
1051 1051
    @return: list with the adjusted nodes (L{objects.Node} instances)
1052 1052

  
1053 1053
    """
1054
    mc_now, mc_max = self._UnlockedGetMasterCandidateStats()
1054
    mc_now, mc_max, _ = self._UnlockedGetMasterCandidateStats()
1055 1055
    mod_list = []
1056 1056
    if mc_now < mc_max:
1057 1057
      node_list = self._config_data.nodes.keys()

Also available in: Unified diff