diff --git a/daemons/ganeti-watcher b/daemons/ganeti-watcher index 1a3ed1c00d191c97ecee6bb13efb4b1cc0bdd03f..1e29f649760257d70bb3c8c3c83e8f0f1817ebb7 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