Revision 23f06b2b lib/config.py

b/lib/config.py
945 945
                    for node in self._UnlockedGetNodeList()])
946 946
    return my_dict
947 947

  
948
  def _UnlockedGetMasterCandidateStats(self):
948
  def _UnlockedGetMasterCandidateStats(self, exceptions=None):
949 949
    """Get the number of current and maximum desired and possible candidates.
950 950

  
951
    @type exceptions: list
952
    @param exceptions: if passed, list of nodes that should be ignored
951 953
    @rtype: tuple
952 954
    @return: tuple of (current, desired and possible)
953 955

  
954 956
    """
955 957
    mc_now = mc_max = 0
956
    for node in self._config_data.nodes.itervalues():
958
    for node in self._config_data.nodes.values():
959
      if exceptions and node.name in exceptions:
960
        continue
957 961
      if not (node.offline or node.drained):
958 962
        mc_max += 1
959 963
      if node.master_candidate:
......
962 966
    return (mc_now, mc_max)
963 967

  
964 968
  @locking.ssynchronized(_config_lock, shared=1)
965
  def GetMasterCandidateStats(self):
969
  def GetMasterCandidateStats(self, exceptions=None):
966 970
    """Get the number of current and maximum possible candidates.
967 971

  
968 972
    This is just a wrapper over L{_UnlockedGetMasterCandidateStats}.
969 973

  
974
    @type exceptions: list
975
    @param exceptions: if passed, list of nodes that should be ignored
970 976
    @rtype: tuple
971 977
    @return: tuple of (current, max)
972 978

  
973 979
    """
974
    return self._UnlockedGetMasterCandidateStats()
980
    return self._UnlockedGetMasterCandidateStats(exceptions)
975 981

  
976 982
  @locking.ssynchronized(_config_lock)
977 983
  def MaintainCandidatePool(self):

Also available in: Unified diff