Revision e2b4a7ba lib/jstore.py

b/lib/jstore.py
28 28
from ganeti import errors
29 29
from ganeti import runtime
30 30
from ganeti import utils
31
from ganeti import pathutils
31 32

  
32 33

  
33 34
JOBS_PER_ARCHIVE_DIRECTORY = 10000
......
54 55
  The queue should be locked while this function is called.
55 56

  
56 57
  """
57
  return _ReadNumericFile(constants.JOB_QUEUE_SERIAL_FILE)
58
  return _ReadNumericFile(pathutils.JOB_QUEUE_SERIAL_FILE)
58 59

  
59 60

  
60 61
def ReadVersion():
......
63 64
  The queue should be locked while this function is called.
64 65

  
65 66
  """
66
  return _ReadNumericFile(constants.JOB_QUEUE_VERSION_FILE)
67
  return _ReadNumericFile(pathutils.JOB_QUEUE_VERSION_FILE)
67 68

  
68 69

  
69 70
def InitAndVerifyQueue(must_lock):
......
81 82
  getents = runtime.GetEnts()
82 83

  
83 84
  # Lock queue
84
  queue_lock = utils.FileLock.Open(constants.JOB_QUEUE_LOCK_FILE)
85
  queue_lock = utils.FileLock.Open(pathutils.JOB_QUEUE_LOCK_FILE)
85 86
  try:
86 87
    # The queue needs to be locked in exclusive mode to write to the serial and
87 88
    # version files.
......
102 103
      version = ReadVersion()
103 104
      if version is None:
104 105
        # Write new version file
105
        utils.WriteFile(constants.JOB_QUEUE_VERSION_FILE,
106
        utils.WriteFile(pathutils.JOB_QUEUE_VERSION_FILE,
106 107
                        uid=getents.masterd_uid, gid=getents.masterd_gid,
107 108
                        data="%s\n" % constants.JOB_QUEUE_VERSION)
108 109

  
......
116 117
      serial = ReadSerial()
117 118
      if serial is None:
118 119
        # Write new serial file
119
        utils.WriteFile(constants.JOB_QUEUE_SERIAL_FILE,
120
        utils.WriteFile(pathutils.JOB_QUEUE_SERIAL_FILE,
120 121
                        uid=getents.masterd_uid, gid=getents.masterd_gid,
121 122
                        data="%s\n" % 0)
122 123

  
......
150 151
  @return: True if the job queue is marked drained
151 152

  
152 153
  """
153
  return os.path.exists(constants.JOB_QUEUE_DRAIN_FILE)
154
  return os.path.exists(pathutils.JOB_QUEUE_DRAIN_FILE)
154 155

  
155 156

  
156 157
def SetDrainFlag(drain_flag):
......
165 166
  getents = runtime.GetEnts()
166 167

  
167 168
  if drain_flag:
168
    utils.WriteFile(constants.JOB_QUEUE_DRAIN_FILE, data="",
169
    utils.WriteFile(pathutils.JOB_QUEUE_DRAIN_FILE, data="",
169 170
                    uid=getents.masterd_uid, gid=getents.masterd_gid)
170 171
  else:
171
    utils.RemoveFile(constants.JOB_QUEUE_DRAIN_FILE)
172
    utils.RemoveFile(pathutils.JOB_QUEUE_DRAIN_FILE)
172 173

  
173 174
  assert (not drain_flag) ^ CheckDrainFlag()
174 175

  

Also available in: Unified diff