Revision 3e8dcc8a lib/uidpool.py

b/lib/uidpool.py
38 38
from ganeti import constants
39 39
from ganeti import compat
40 40
from ganeti import utils
41
from ganeti import pathutils
41 42

  
42 43

  
43 44
def ParseUidPool(value, separator=None):
......
269 270
  """
270 271
  # Create the lock dir if it's not yet present
271 272
  try:
272
    utils.EnsureDirs([(constants.UIDPOOL_LOCKDIR, 0755)])
273
    utils.EnsureDirs([(pathutils.UIDPOOL_LOCKDIR, 0755)])
273 274
  except errors.GenericError, err:
274 275
    raise errors.LockError("Failed to create user-id pool lock dir: %s" % err)
275 276

  
276 277
  # Get list of currently used uids from the filesystem
277 278
  try:
278 279
    taken_uids = set()
279
    for taken_uid in os.listdir(constants.UIDPOOL_LOCKDIR):
280
    for taken_uid in os.listdir(pathutils.UIDPOOL_LOCKDIR):
280 281
      try:
281 282
        taken_uid = int(taken_uid)
282 283
      except ValueError, err:
......
306 307
      # Create the lock file
307 308
      # Note: we don't care if it exists. Only the fact that we can
308 309
      # (or can't) lock it later is what matters.
309
      uid_path = utils.PathJoin(constants.UIDPOOL_LOCKDIR, str(uid))
310
      uid_path = utils.PathJoin(pathutils.UIDPOOL_LOCKDIR, str(uid))
310 311
      lock = utils.FileLock.Open(uid_path)
311 312
    except OSError, err:
312 313
      raise errors.LockError("Failed to create lockfile for user-id %s: %s"
......
349 350
    uid_filename = str(uid)
350 351

  
351 352
  try:
352
    uid_path = utils.PathJoin(constants.UIDPOOL_LOCKDIR, uid_filename)
353
    uid_path = utils.PathJoin(pathutils.UIDPOOL_LOCKDIR, uid_filename)
353 354
    os.remove(uid_path)
354 355
  except OSError, err:
355 356
    raise errors.LockError("Failed to remove user-id lockfile"

Also available in: Unified diff