Revision 2826b361 daemons/ganeti-watcher
b/daemons/ganeti-watcher | ||
---|---|---|
71 | 71 |
return bool(utils.ReadWatcherPauseFile(constants.WATCHER_PAUSEFILE)) |
72 | 72 |
|
73 | 73 |
|
74 |
def EnsureDaemon(name): |
|
75 |
"""Check for and start daemon if not alive. |
|
76 |
|
|
77 |
""" |
|
78 |
result = utils.RunCmd([constants.DAEMON_UTIL, "check-and-start", name]) |
|
79 |
if result.failed: |
|
80 |
logging.error("Can't start daemon '%s', failure %s, output: %s", |
|
81 |
name, result.fail_reason, result.output) |
|
82 |
return False |
|
83 |
|
|
84 |
return True |
|
85 |
|
|
86 |
|
|
87 | 74 |
def StartNodeDaemons(): |
88 | 75 |
"""Start all the daemons that should be running on all nodes. |
89 | 76 |
|
90 | 77 |
""" |
91 | 78 |
# on master or not, try to start the node dameon |
92 |
EnsureDaemon(constants.NODED) |
|
79 |
utils.EnsureDaemon(constants.NODED)
|
|
93 | 80 |
# start confd as well. On non candidates it will be in disabled mode. |
94 |
EnsureDaemon(constants.CONFD) |
|
81 |
utils.EnsureDaemon(constants.CONFD)
|
|
95 | 82 |
|
96 | 83 |
|
97 | 84 |
def RunWatcherHooks(): |
... | ... | |
527 | 514 |
except luxi.NoMasterError, err: |
528 | 515 |
logging.warning("Master seems to be down (%s), trying to restart", |
529 | 516 |
str(err)) |
530 |
if not EnsureDaemon(constants.MASTERD): |
|
517 |
if not utils.EnsureDaemon(constants.MASTERD):
|
|
531 | 518 |
logging.critical("Can't start the master, exiting") |
532 | 519 |
sys.exit(constants.EXIT_FAILURE) |
533 | 520 |
# else retry the connection |
534 | 521 |
client = cli.GetClient() |
535 | 522 |
|
536 | 523 |
# we are on master now |
537 |
EnsureDaemon(constants.RAPI) |
|
524 |
utils.EnsureDaemon(constants.RAPI)
|
|
538 | 525 |
|
539 | 526 |
try: |
540 | 527 |
watcher = Watcher(options, notepad) |
Also available in: Unified diff