On 13 May 2013 15:09, "Michele Tartara" <[email protected]> wrote:
>
> Add the monitoring daemon to the command starting the node daemon, given
that
> they both have to be started on all nodes.
>
> Note that daemon-util only supports starting one daemon at the time, so
the
> actual command has to be composed as a sequence of two different
daemon-util
> invocations.
>
> Also, the monitoring daemon invocation is conditional, depending on
whether it
> was enabled at configure time.
>
> Signed-off-by: Michele Tartara <[email protected]>
> ---
> lib/tools/node_daemon_setup.py | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/lib/tools/node_daemon_setup.py
b/lib/tools/node_daemon_setup.py
> index 28bcba0..5991f47 100644
> --- a/lib/tools/node_daemon_setup.py
> +++ b/lib/tools/node_daemon_setup.py
> @@ -216,12 +216,17 @@ def Main():
> not opts.dry_run):
> logging.info("Restarting node daemon ...")
>
> - cmd = ("%s stop-all; %s start %s" %
> - (pathutils.DAEMON_UTIL, pathutils.DAEMON_UTIL,
constants.NODED))
> + mond_cmd = ""
> + if constants.ENABLE_MOND:
> + mond_cmd = "; %s start %s" % (pathutils.DAEMON_UTIL,
constants.MOND)
> +
> + cmd = ("%s stop-all; %s start %s%s" %
> + (pathutils.DAEMON_UTIL, pathutils.DAEMON_UTIL,
constants.NODED,
> + mond_cmd))
>
This is a bit ugly. Could you extract all commands out? (eg stop_cmd
noded_cmq and mond_cmd) Or change daemon utils to be able to handle more
than one daemon?
Thanks,
Guido
> result = utils.RunCmd(cmd, interactive=True)
> if result.failed:
> - raise SetupError("Could not start the node daemon, command '%s'"
> + raise SetupError("Could not start the node daemons, command '%s'"
> " failed: %s" % (result.cmd,
result.fail_reason))
>
> logging.info("Node daemon successfully configured")
> --
> 1.7.10.4
>