summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2015-07-20 16:37:58 +1000
committerStefan Metzmacher <metze@samba.org>2015-08-18 07:49:23 +0200
commit37e126daf941fd577290e34ac580b5ae0cc4a674 (patch)
tree666bbe1f2bb5f0e5f729e18d354aa3b5b91a7538
parent88c53b84aeb492f95d4913600eab2fc22eceb515 (diff)
downloadsamba-37e126daf941fd577290e34ac580b5ae0cc4a674.tar.gz
ctdb-tool: Correctly print timed out event scripts output
The timed out error is ignored for certain events (start_recovery, recoverd, takeip, releaseip). If these events time out, then the debug hung script outputs the following: 3 scripts were executed last releaseip cycle 00.ctdb Status:OK Duration:4.381 Thu Jul 16 23:45:24 2015 01.reclock Status:OK Duration:13.422 Thu Jul 16 23:45:28 2015 10.external Status:DISABLED 10.interface Status:OK Duration:-1437083142.208 Thu Jul 16 23:45:42 2015 The endtime for timed out scripts is not set. Since the status is not returned as -ETIME for some events, ctdb scriptstatus prints -ve duration. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11431 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> (cherry picked from commit 71b89b2b7a9768de437347e6678370b2682da892)
-rw-r--r--ctdb/tools/ctdb.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index 4734b26caff..c6da6216020 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -1424,6 +1424,14 @@ static int control_one_scriptstatus(struct ctdb_context *ctdb,
for (i=0; i<script_status->num_scripts; i++) {
const char *status = NULL;
+ /* The ETIME status is ignored for certain events.
+ * In that case the status is 0, but endtime is not set.
+ */
+ if (script_status->scripts[i].status == 0 &&
+ timeval_is_zero(&script_status->scripts[i].finished)) {
+ script_status->scripts[i].status = -ETIME;
+ }
+
switch (script_status->scripts[i].status) {
case -ETIME:
status = "TIMEDOUT";