From 9d7b1e537d38ed7da2e8c55cf5aa1629482cee72 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Fri, 29 Jul 2011 15:13:58 +0200
Subject: [PATCH] Add new watcher constants

WATCHER_STATEFILE will be removed at the end of this
patch series.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/constants.py | 11 ++++++++++-
 qa/qa_daemon.py  |  4 ++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/lib/constants.py b/lib/constants.py
index c99562192..a58f797d6 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -137,7 +137,6 @@ RAPI_CERT_FILE = DATA_DIR + "/rapi.pem"
 CONFD_HMAC_KEY = DATA_DIR + "/hmac.key"
 CLUSTER_DOMAIN_SECRET_FILE = DATA_DIR + "/cluster-domain-secret"
 WATCHER_STATEFILE = DATA_DIR + "/watcher.data"
-WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
 INSTANCE_STATUS_FILE = RUN_GANETI_DIR + "/instance-status"
 SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
 RAPI_USERS_FILE = DATA_DIR + "/rapi/users"
@@ -156,6 +155,16 @@ SYSCONFDIR = _autoconf.SYSCONFDIR
 TOOLSDIR = _autoconf.TOOLSDIR
 CONF_DIR = SYSCONFDIR + "/ganeti"
 
+#: Lock file for watcher, locked in shared mode by watcher; lock in exclusive
+# mode to block watcher (see L{cli._RunWhileClusterStoppedHelper.Call}
+WATCHER_LOCK_FILE = LOCK_DIR + "/ganeti-watcher.lock"
+
+#: Status file for per-group watcher, locked in exclusive mode by watcher
+WATCHER_GROUP_STATE_FILE = DATA_DIR + "/watcher.%s.data"
+
+#: File containing Unix timestamp until which watcher should be paused
+WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
+
 ALL_CERT_FILES = frozenset([NODED_CERT_FILE, RAPI_CERT_FILE])
 
 MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
diff --git a/qa/qa_daemon.py b/qa/qa_daemon.py
index e50fe79fa..85d0a0fe2 100644
--- a/qa/qa_daemon.py
+++ b/qa/qa_daemon.py
@@ -66,6 +66,10 @@ def _ResetWatcherDaemon():
 
   """
   AssertCommand(["rm", "-f", constants.WATCHER_STATEFILE])
+  AssertCommand([
+    "bash", "-c",
+    "rm -vf %s" % (constants.WATCHER_GROUP_STATE_FILE % "*-*-*-*")
+    ])
 
 
 def _RunWatcherDaemon():
-- 
GitLab