Revision fd346851
b/daemons/ganeti-confd | ||
---|---|---|
293 | 293 |
version="%%prog (ganeti) %s" % |
294 | 294 |
constants.RELEASE_VERSION) |
295 | 295 |
|
296 |
dirs = [(val, constants.RUN_DIRS_MODE) for val in constants.SUB_RUN_DIRS] |
|
297 |
dirs.append((constants.LOCK_DIR, 1777)) |
|
298 |
daemon.GenericMain(constants.CONFD, parser, dirs, CheckConfd, ExecConfd) |
|
296 |
daemon.GenericMain(constants.CONFD, parser, CheckConfd, ExecConfd) |
|
299 | 297 |
|
300 | 298 |
|
301 | 299 |
if __name__ == "__main__": |
b/daemons/ganeti-masterd | ||
---|---|---|
565 | 565 |
parser.add_option("--yes-do-it", dest="yes_do_it", |
566 | 566 |
help="Override interactive check for --no-voting", |
567 | 567 |
default=False, action="store_true") |
568 |
dirs = [(constants.RUN_GANETI_DIR, constants.RUN_DIRS_MODE), |
|
569 |
(constants.SOCKET_DIR, constants.SOCKET_DIR_MODE), |
|
570 |
] |
|
571 |
daemon.GenericMain(constants.MASTERD, parser, dirs, |
|
572 |
CheckMasterd, ExecMasterd, |
|
568 |
daemon.GenericMain(constants.MASTERD, parser, CheckMasterd, ExecMasterd, |
|
573 | 569 |
multithreaded=True) |
574 | 570 |
|
575 | 571 |
|
b/daemons/ganeti-noded | ||
---|---|---|
965 | 965 |
help="Do not mlock the node memory in ram", |
966 | 966 |
default=True, action="store_false") |
967 | 967 |
|
968 |
dirs = [(val, constants.RUN_DIRS_MODE) for val in constants.SUB_RUN_DIRS] |
|
969 |
dirs.append((constants.LOG_OS_DIR, 0750)) |
|
970 |
dirs.append((constants.LOCK_DIR, 1777)) |
|
971 |
dirs.append((constants.CRYPTO_KEYS_DIR, constants.CRYPTO_KEYS_DIR_MODE)) |
|
972 |
dirs.append((constants.IMPORT_EXPORT_DIR, constants.IMPORT_EXPORT_DIR_MODE)) |
|
973 |
daemon.GenericMain(constants.NODED, parser, dirs, CheckNoded, ExecNoded, |
|
968 |
daemon.GenericMain(constants.NODED, parser, CheckNoded, ExecNoded, |
|
974 | 969 |
default_ssl_cert=constants.NODED_CERT_FILE, |
975 | 970 |
default_ssl_key=constants.NODED_CERT_FILE, |
976 | 971 |
console_logging=True) |
b/daemons/ganeti-rapi | ||
---|---|---|
249 | 249 |
usage="%prog [-f] [-d] [-p port] [-b ADDRESS]", |
250 | 250 |
version="%%prog (ganeti) %s" % constants.RELEASE_VERSION) |
251 | 251 |
|
252 |
dirs = [(val, constants.RUN_DIRS_MODE) for val in constants.SUB_RUN_DIRS] |
|
253 |
dirs.append((constants.LOG_OS_DIR, 0750)) |
|
254 |
daemon.GenericMain(constants.RAPI, parser, dirs, CheckRapi, ExecRapi, |
|
252 |
daemon.GenericMain(constants.RAPI, parser, CheckRapi, ExecRapi, |
|
255 | 253 |
default_ssl_cert=constants.RAPI_CERT_FILE, |
256 | 254 |
default_ssl_key=constants.RAPI_CERT_FILE) |
257 | 255 |
|
b/lib/daemon.py | ||
---|---|---|
487 | 487 |
self._signal_wait.append(owner) |
488 | 488 |
|
489 | 489 |
|
490 |
def GenericMain(daemon_name, optionparser, dirs, check_fn, exec_fn,
|
|
490 |
def GenericMain(daemon_name, optionparser, check_fn, exec_fn, |
|
491 | 491 |
multithreaded=False, console_logging=False, |
492 | 492 |
default_ssl_cert=None, default_ssl_key=None): |
493 | 493 |
"""Shared main function for daemons. |
... | ... | |
497 | 497 |
@type optionparser: optparse.OptionParser |
498 | 498 |
@param optionparser: initialized optionparser with daemon-specific options |
499 | 499 |
(common -f -d options will be handled by this module) |
500 |
@type dirs: list of (string, integer) |
|
501 |
@param dirs: list of directories that must be created if they don't exist, |
|
502 |
and the permissions to be used to create them |
|
503 | 500 |
@type check_fn: function which accepts (options, args) |
504 | 501 |
@param check_fn: function that checks start conditions and exits if they're |
505 | 502 |
not met |
... | ... | |
588 | 585 |
if check_fn is not None: |
589 | 586 |
check_fn(options, args) |
590 | 587 |
|
591 |
utils.EnsureDirs(dirs) |
|
592 |
|
|
593 | 588 |
if options.fork: |
594 | 589 |
utils.CloseFDs() |
595 | 590 |
utils.Daemonize(logfile=constants.DAEMONS_LOGFILES[daemon_name]) |
Also available in: Unified diff