From 3753b2cb7851622ae542ca86502bbeaa344fc12c Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Wed, 26 Aug 2009 16:47:01 +0200 Subject: [PATCH] ganeti-watcher: Don't run if paused Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- daemons/ganeti-watcher | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/daemons/ganeti-watcher b/daemons/ganeti-watcher index 1a3ed1c00..1e29f6497 100755 --- a/daemons/ganeti-watcher +++ b/daemons/ganeti-watcher @@ -31,6 +31,7 @@ import os import sys import time import logging +import errno from optparse import OptionParser from ganeti import utils @@ -70,6 +71,13 @@ def Indent(s, prefix='| '): return "%s%s\n" % (prefix, ('\n' + prefix).join(s.splitlines())) +def ShouldPause(): + """Check whether we should pause. + + """ + return bool(utils.ReadWatcherPauseFile(constants.WATCHER_PAUSEFILE)) + + def StartMaster(): """Try to start the master daemon. @@ -476,6 +484,10 @@ def main(): utils.SetupLogging(constants.LOG_WATCHER, debug=options.debug, stderr_logging=options.debug) + if ShouldPause(): + logging.debug("Pause has been set, exiting") + sys.exit(constants.EXIT_SUCCESS) + update_file = False try: # on master or not, try to start the node dameon -- GitLab