diff --git a/daemons/ganeti-masterd b/daemons/ganeti-masterd index dd59d83669cc2ec2b33e4b3e1518441d1ee6921c..0775d05c01a5a0b9579211067db3175d598e1722 100755 --- a/daemons/ganeti-masterd +++ b/daemons/ganeti-masterd @@ -514,7 +514,7 @@ def main(): if options.fork: utils.Daemonize(logfile=constants.DAEMONS_LOGFILES[daemon_name]) - utils.WritePidFile(constants.MASTERD_PID) + utils.WritePidFile(daemon_name) try: utils.SetupLogging(constants.DAEMONS_LOGFILES[daemon_name], debug=options.debug, @@ -539,7 +539,7 @@ def main(): finally: rpc.Shutdown() finally: - utils.RemovePidFile(constants.MASTERD_PID) + utils.RemovePidFile(daemon_name) utils.RemoveFile(constants.MASTER_SOCKET) diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded index edbc35c1540e765a0412c3e0f36fd74ccf77f115..90b72f0a262c6be134ed708c14f46d7b64781adb 100755 --- a/daemons/ganeti-noded +++ b/daemons/ganeti-noded @@ -785,7 +785,7 @@ def main(): if options.fork: utils.Daemonize(logfile=constants.DAEMONS_LOGFILES[daemon_name]) - utils.WritePidFile(constants.NODED_PID) + utils.WritePidFile(daemon_name) try: utils.SetupLogging(logfile=constants.DAEMONS_LOGFILES[daemon_name], debug=options.debug, @@ -808,7 +808,7 @@ def main(): finally: server.Stop() finally: - utils.RemovePidFile(constants.NODED_PID) + utils.RemovePidFile(daemon_name) if __name__ == '__main__': diff --git a/daemons/ganeti-rapi b/daemons/ganeti-rapi index 16ddb9ddbaffda017c3882be12f3402a3b21f2aa..4564ef30140ff08a639b104cf7e4d505c1279389 100755 --- a/daemons/ganeti-rapi +++ b/daemons/ganeti-rapi @@ -250,7 +250,7 @@ def main(): utils.SetupLogging(constants.DAEMONS_LOGFILES[daemon_name], debug=options.debug, stderr_logging=not options.fork) - utils.WritePidFile(constants.RAPI_PID) + utils.WritePidFile(daemon_name) try: mainloop = daemon.Mainloop() server = RemoteApiHttpServer(mainloop, options.bind_address, port, @@ -263,7 +263,7 @@ def main(): finally: server.Stop() finally: - utils.RemovePidFile(constants.RAPI_PID) + utils.RemovePidFile(daemon_name) if __name__ == '__main__': diff --git a/daemons/ganeti-watcher b/daemons/ganeti-watcher index 2749de63f77a0a2ae6c99ed0e3b13642a0e9ba5d..1a3ed1c00d191c97ecee6bb13efb4b1cc0bdd03f 100755 --- a/daemons/ganeti-watcher +++ b/daemons/ganeti-watcher @@ -478,9 +478,8 @@ def main(): update_file = False try: - # on master or not, try to start the node dameon (use _PID but is - # the same as daemon name) - EnsureDaemon(constants.NODED_PID) + # on master or not, try to start the node dameon + EnsureDaemon(constants.NODED) notepad = WatcherState() try: @@ -500,8 +499,8 @@ def main(): # else retry the connection client = cli.GetClient() - # we are on master now (use _PID but is the same as daemon name) - EnsureDaemon(constants.RAPI_PID) + # we are on master now + EnsureDaemon(constants.RAPI) try: watcher = Watcher(options, notepad) diff --git a/lib/backend.py b/lib/backend.py index 15f6ed442b050a9e6482195a5b7aa4c54aa2fdc2..966f601a7f9254f4c2d760d229d254c8f38ac46d 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -298,7 +298,7 @@ def StopMaster(stop_daemons): if stop_daemons: # stop/kill the rapi and the master daemon - for daemon in constants.RAPI_PID, constants.MASTERD_PID: + for daemon in constants.RAPI, constants.MASTERD: utils.KillProcess(utils.ReadPidFile(utils.DaemonPidFileName(daemon))) @@ -2280,7 +2280,7 @@ def DemoteFromMC(): master, myself = ssconf.GetMasterAndMyself() if master == myself: _Fail("ssconf status shows I'm the master node, will not demote") - pid_file = utils.DaemonPidFileName(constants.MASTERD_PID) + pid_file = utils.DaemonPidFileName(constants.MASTERD) if utils.IsProcessAlive(utils.ReadPidFile(pid_file)): _Fail("The master daemon is running, will not demote") try: diff --git a/lib/constants.py b/lib/constants.py index 90aa0e955ab990b8139e5c37a66fc24358b1829d..028265c1202359107645d5a2cc9c701c6f9996c5 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -109,11 +109,6 @@ SYSCONFDIR = _autoconf.SYSCONFDIR MASTER_SOCKET = SOCKET_DIR + "/ganeti-master" -# PID files -MASTERD_PID = "ganeti-masterd" -NODED_PID = "ganeti-noded" -RAPI_PID = "ganeti-rapi" - NODE_INITD_SCRIPT = _autoconf.SYSCONFDIR + "/init.d/ganeti" NODED = "ganeti-noded"