Revision 852bbc95 lib/uidpool.py

b/lib/uidpool.py
31 31

  
32 32
from ganeti import errors
33 33
from ganeti import constants
34
from ganeti import utils
34 35

  
35 36

  
36 37
def ParseUidPool(value, separator=None):
......
108 109
    uid_pool.remove(uid_range)
109 110

  
110 111

  
112
def _FormatUidRange(lower, higher):
113
  """Convert a user-id range definition into a string.
114

  
115
  """
116
  if lower == higher:
117
    return str(lower)
118
  return "%s-%s" % (lower, higher)
119

  
120

  
121
def FormatUidPool(uid_pool):
122
  """Convert the internal representation of the user-id pool into a string.
123

  
124
  The output format is also accepted by ParseUidPool()
125

  
126
  @param uid_pool: a list of integer pairs representing UID ranges
127
  @return: a string with the formatted results
128

  
129
  """
130
  return utils.CommaJoin([_FormatUidRange(lower, higher)
131
                          for lower, higher in uid_pool])
132

  
133

  
111 134
def CheckUidPool(uid_pool):
112 135
  """Sanity check user-id pool range definition values.
113 136

  

Also available in: Unified diff