From 3aecd2c73d8efb6e91eaf340eb36c0587f13d750 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 29 Nov 2007 16:52:22 +0000
Subject: [PATCH] Replace hardcoded lock dir
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch replaces the hardcoded β€˜/var/lock/’ directory with one based on
LOCALSTATEDIR.

Reviewed-by: imsnah
---
 lib/constants.py | 1 +
 lib/utils.py     | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/constants.py b/lib/constants.py
index b09c2ad2d..ecc6182f8 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -34,6 +34,7 @@ EXPORT_VERSION = 0
 # file paths
 DATA_DIR = _autoconf.LOCALSTATEDIR + "/lib/ganeti"
 BDEV_CACHE_DIR = _autoconf.LOCALSTATEDIR + "/run/ganeti"
+LOCK_DIR = _autoconf.LOCALSTATEDIR + "/lock"
 CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
 SSL_CERT_FILE = DATA_DIR + "/server.pem"
 WATCHER_STATEFILE = DATA_DIR + "/watcher.data"
diff --git a/lib/utils.py b/lib/utils.py
index 68fac3e78..a85ebb048 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -39,6 +39,7 @@ import itertools
 
 from ganeti import logger
 from ganeti import errors
+from ganeti import constants
 
 
 _locksheld = []
@@ -95,7 +96,7 @@ class RunResult(object):
 
 def _GetLockFile(subsystem):
   """Compute the file name for a given lock name."""
-  return "/var/lock/ganeti_lock_%s" % subsystem
+  return "%s/ganeti_lock_%s" % (constants.LOCK_DIR, subsystem)
 
 
 def Lock(name, max_retries=None, debug=False):
-- 
GitLab