# conflict with that. If so, we might warn or EXIT_FAILURE.
-def ExecConfd(options, _dummy1, _dummy2):
- """Main confd function, executed with PID file held
+def PrepConfd(options, _):
+ """Prep confd function, executed with PID file held
"""
# TODO: clarify how the server and reloader variables work (they are
# not used)
+
# pylint: disable-msg=W0612
mainloop = daemon.Mainloop()
# Configuration reloader
reloader = ConfdConfigurationReloader(processor, mainloop)
+ return mainloop
+
+
+def ExecConfd(options, args, prep_data): # pylint: disable-msg=W0613
+ """Main confd function, executed with PID file held
+
+ """
+ mainloop = prep_data
mainloop.Run()
version="%%prog (ganeti) %s" %
constants.RELEASE_VERSION)
- daemon.GenericMain(constants.CONFD, parser, CheckConfd, None, ExecConfd)
+ daemon.GenericMain(constants.CONFD, parser, CheckConfd, PrepConfd, ExecConfd)
if __name__ == "__main__":
utils.RunInSeparateProcess(ActivateMasterIP)
-def ExecMasterd(options, args, _): # pylint: disable-msg=W0613
- """Main master daemon function, executed with the PID file held.
+def PrepMasterd(options, _):
+ """Prep master daemon function, executed with the PID file held.
"""
# This is safe to do as the pid file guarantees against
mainloop = daemon.Mainloop()
master = MasterServer(mainloop, constants.MASTER_SOCKET,
options.uid, options.gid)
+ return (mainloop, master)
+
+
+def ExecMasterd(options, args, prep_data): # pylint: disable-msg=W0613
+ """Main master daemon function, executed with the PID file held.
+
+ """
+ (mainloop, master) = prep_data
try:
rpc.Init()
try:
parser.add_option("--yes-do-it", dest="yes_do_it",
help="Override interactive check for --no-voting",
default=False, action="store_true")
- daemon.GenericMain(constants.MASTERD, parser, CheckMasterd, None,
+ daemon.GenericMain(constants.MASTERD, parser, CheckMasterd, PrepMasterd,
ExecMasterd, multithreaded=True)
sys.exit(constants.EXIT_FAILURE)
-def ExecNoded(options, _dummy1, _dummy2):
- """Main node daemon function, executed with the PID file held.
+def PrepNoded(options, _):
+ """Preparation node daemon function, executed with the PID file held.
"""
if options.mlock:
ssl_params=ssl_params, ssl_verify_peer=True,
request_executor_class=request_executor_class)
server.Start()
+ return (mainloop, server)
+
+def ExecNoded(options, args, prep_data): # pylint: disable-msg=W0613
+ """Main node daemon function, executed with the PID file held.
+
+ """
+ (mainloop, server) = prep_data
try:
mainloop.Run()
finally:
help="Do not mlock the node memory in ram",
default=True, action="store_false")
- daemon.GenericMain(constants.NODED, parser, CheckNoded, None, ExecNoded,
+ daemon.GenericMain(constants.NODED, parser, CheckNoded, PrepNoded, ExecNoded,
default_ssl_cert=constants.NODED_CERT_FILE,
default_ssl_key=constants.NODED_CERT_FILE,
console_logging=True)
options.ssl_params = None
-def ExecRapi(options, _dummy1, _dummy2):
- """Main remote API function, executed with the PID file held.
+def PrepRapi(options, _):
+ """Prep remote API function, executed with the PID file held.
"""
# pylint: disable-msg=E1101
# it seems pylint doesn't see the second parent class there
server.Start()
+ return (mainloop, server)
+
+def ExecRapi(options, args, prep_data): # pylint: disable-msg=W0613
+ """Main remote API function, executed with the PID file held.
+
+ """
+ (mainloop, server) = prep_data
try:
mainloop.Run()
finally:
usage="%prog [-f] [-d] [-p port] [-b ADDRESS]",
version="%%prog (ganeti) %s" % constants.RELEASE_VERSION)
- daemon.GenericMain(constants.RAPI, parser, CheckRapi, None, ExecRapi,
+ daemon.GenericMain(constants.RAPI, parser, CheckRapi, PrepRapi, ExecRapi,
default_ssl_cert=constants.RAPI_CERT_FILE,
default_ssl_key=constants.RAPI_CERT_FILE)