summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
Diffstat (limited to 'nova')
-rw-r--r--nova/flags.py2
-rw-r--r--nova/utils.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/nova/flags.py b/nova/flags.py
index 8cf199b2f..213d4d4e1 100644
--- a/nova/flags.py
+++ b/nova/flags.py
@@ -321,6 +321,8 @@ DEFINE_integer('auth_token_ttl', 3600, 'Seconds for auth tokens to linger')
DEFINE_string('state_path', os.path.join(os.path.dirname(__file__), '../'),
"Top-level directory for maintaining nova's state")
+DEFINE_string('lock_path', os.path.join(os.path.dirname(__file__), '../'),
+ "Directory for lock files")
DEFINE_string('logdir', None, 'output to a per-service log file in named '
'directory')
diff --git a/nova/utils.py b/nova/utils.py
index cb1ea5a7d..48f12350f 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -44,11 +44,13 @@ from eventlet.green import subprocess
from nova import exception
from nova.exception import ProcessExecutionError
+from nova import flags
from nova import log as logging
LOG = logging.getLogger("nova.utils")
TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
+FLAGS = flags.FLAGS
def import_class(import_str):
@@ -495,7 +497,8 @@ def loads(s):
def synchronized(name):
def wrap(f):
def inner(*args, **kwargs):
- lock = lockfile.FileLock('nova-%s.lock' % name)
+ lock = lockfile.FileLock(os.path.join(FLAGS.lock_path,
+ 'nova-%s.lock' % name))
with lock:
return f(*args, **kwargs)
return inner