Commit 24fc781f authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Don't always remove queue lock when queue is purged

The lock should only be removed if ganeti-noded is going to quit.
Otherwise it needs to be kept to prevent another process from creating
it again while we're still holding the (removed) lock. This is due to
POSIX filesystem semantics.

Reviewed-by: iustinp
parent 76ab5558
......@@ -69,6 +69,19 @@ def _CleanDirectory(path, exclude=[]):
def _JobQueuePurge(keep_lock):
"""Removes job queue files and archived jobs
if keep_lock:
exclude = [constants.JOB_QUEUE_LOCK_FILE]
exclude = []
_CleanDirectory(constants.QUEUE_DIR, exclude=exclude)
def _GetMasterInfo():
"""Return the master ip and netdev.
......@@ -192,7 +205,8 @@ def LeaveCluster():
# The lock can be removed because we're going to quit anyway.
priv_key, pub_key, auth_keys = ssh.GetUserFiles(constants.GANETI_RUNAS)
......@@ -1698,8 +1712,9 @@ def JobQueuePurge():
"""Removes job queue files and archived jobs
# The lock must not be removed, otherwise another process could create
# it again.
return _JobQueuePurge(keep_lock=True)
def JobQueueRename(old, new):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment