Commit c33549ef authored by Guido Trotter's avatar Guido Trotter
Browse files

jstore: use EnsureDirs, and add more constants


Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarBalazs Lecz <leczb@google.com>
parent ace6cbe8
......@@ -619,6 +619,8 @@ JOB_QUEUE_ARCHIVE_DIR = QUEUE_DIR + "/archive"
JOB_QUEUE_DRAIN_FILE = QUEUE_DIR + "/drain"
JOB_QUEUE_SIZE_HARD_LIMIT = 5000
JOB_QUEUE_SIZE_SOFT_LIMIT = JOB_QUEUE_SIZE_HARD_LIMIT * 0.8
JOB_QUEUE_DIRS = [QUEUE_DIR, JOB_QUEUE_ARCHIVE_DIR]
JOB_QUEUE_DIRS_MODE = 0700
JOB_ID_TEMPLATE = r"\d+"
......
......@@ -21,7 +21,6 @@
"""Module implementing the job queue handling."""
import os
import errno
from ganeti import constants
......@@ -79,13 +78,8 @@ def InitAndVerifyQueue(must_lock):
locking mode.
"""
# Make sure our directories exists
for path in (constants.QUEUE_DIR, constants.JOB_QUEUE_ARCHIVE_DIR):
try:
os.mkdir(path, 0700)
except OSError, err:
if err.errno not in (errno.EEXIST, ):
raise
dirs = [(d, constants.JOB_QUEUE_DIRS_MODE) for d in constants.JOB_QUEUE_DIRS]
utils.EnsureDirs(dirs)
# Lock queue
queue_lock = utils.FileLock.Open(constants.JOB_QUEUE_LOCK_FILE)
......
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