Revision 24fc781f

b/lib/backend.py
69 69
      utils.RemoveFile(full_name)
70 70

  
71 71

  
72
def _JobQueuePurge(keep_lock):
73
  """Removes job queue files and archived jobs
74

  
75
  """
76
  if keep_lock:
77
    exclude = [constants.JOB_QUEUE_LOCK_FILE]
78
  else:
79
    exclude = []
80

  
81
  _CleanDirectory(constants.QUEUE_DIR, exclude=exclude)
82
  _CleanDirectory(constants.JOB_QUEUE_ARCHIVE_DIR)
83

  
84

  
72 85
def _GetMasterInfo():
73 86
  """Return the master ip and netdev.
74 87

  
......
192 205
  """
193 206
  _CleanDirectory(constants.DATA_DIR)
194 207

  
195
  JobQueuePurge()
208
  # The lock can be removed because we're going to quit anyway.
209
  _JobQueuePurge(keep_lock=False)
196 210

  
197 211
  try:
198 212
    priv_key, pub_key, auth_keys = ssh.GetUserFiles(constants.GANETI_RUNAS)
......
1698 1712
  """Removes job queue files and archived jobs
1699 1713

  
1700 1714
  """
1701
  _CleanDirectory(constants.QUEUE_DIR)
1702
  _CleanDirectory(constants.JOB_QUEUE_ARCHIVE_DIR)
1715
  # The lock must not be removed, otherwise another process could create
1716
  # it again.
1717
  return _JobQueuePurge(keep_lock=True)
1703 1718

  
1704 1719

  
1705 1720
def JobQueueRename(old, new):

Also available in: Unified diff