projects
/
ganeti-local
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add _UnlockedLookupNodeGroup()
[ganeti-local]
/
lib
/
jstore.py
diff --git
a/lib/jstore.py
b/lib/jstore.py
index
cc1bb4c
..
1570cb9
100644
(file)
--- a/
lib/jstore.py
+++ b/
lib/jstore.py
@@
-25,6
+25,7
@@
import errno
from ganeti import constants
from ganeti import errors
from ganeti import constants
from ganeti import errors
+from ganeti import runtime
from ganeti import utils
from ganeti import utils
@@
-36,17
+37,12
@@
def _ReadNumericFile(file_name):
"""
try:
"""
try:
- fd = open(file_name, "r")
- except IOError, err:
+ return int(utils.ReadFile(file_name))
+ except EnvironmentError, err:
if err.errno in (errno.ENOENT, ):
return None
raise
if err.errno in (errno.ENOENT, ):
return None
raise
- try:
- return int(fd.read(128))
- finally:
- fd.close()
-
def ReadSerial():
"""Read the serial file.
def ReadSerial():
"""Read the serial file.
@@
-78,8
+74,7
@@
def InitAndVerifyQueue(must_lock):
locking mode.
"""
locking mode.
"""
- dirs = [(d, constants.JOB_QUEUE_DIRS_MODE) for d in constants.JOB_QUEUE_DIRS]
- utils.EnsureDirs(dirs)
+ getents = runtime.GetEnts()
# Lock queue
queue_lock = utils.FileLock.Open(constants.JOB_QUEUE_LOCK_FILE)
# Lock queue
queue_lock = utils.FileLock.Open(constants.JOB_QUEUE_LOCK_FILE)
@@
-104,6
+99,7
@@
def InitAndVerifyQueue(must_lock):
if version is None:
# Write new version file
utils.WriteFile(constants.JOB_QUEUE_VERSION_FILE,
if version is None:
# Write new version file
utils.WriteFile(constants.JOB_QUEUE_VERSION_FILE,
+ uid=getents.masterd_uid, gid=getents.masterd_gid,
data="%s\n" % constants.JOB_QUEUE_VERSION)
# Read again
data="%s\n" % constants.JOB_QUEUE_VERSION)
# Read again
@@
-117,6
+113,7
@@
def InitAndVerifyQueue(must_lock):
if serial is None:
# Write new serial file
utils.WriteFile(constants.JOB_QUEUE_SERIAL_FILE,
if serial is None:
# Write new serial file
utils.WriteFile(constants.JOB_QUEUE_SERIAL_FILE,
+ uid=getents.masterd_uid, gid=getents.masterd_gid,
data="%s\n" % 0)
# Read again
data="%s\n" % 0)
# Read again