Commit 32ba31be authored by Michael Hanselmann's avatar Michael Hanselmann

Stop all daemons on cluster initialization

Addresses issue 145. When daemons are still running from a previous
cluster instance, starting the daemons again will fail.
“ConfigWriter.IsCluster” only looks at the configuration file, which
could already have been deleted.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent da1dcce1
......@@ -448,6 +448,13 @@ def InitCluster(cluster_name, mac_prefix, # pylint: disable=R0913, R0914
curr_helper),
errors.ECODE_INVAL)
logging.debug("Stopping daemons (if any are running)")
result = utils.RunCmd([pathutils.DAEMON_UTIL, "stop-all"])
if result.failed:
raise errors.OpExecError("Could not stop daemons, command %s"
" had exitcode %s and error '%s'" %
(result.cmd, result.exit_code, result.output))
if constants.ENABLE_FILE_STORAGE:
file_storage_dir = _InitFileStorage(file_storage_dir)
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment