summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Straz <nstraz@redhat.com>2014-02-25 09:38:58 -0500
committerNathan Straz <nstraz@redhat.com>2014-02-25 10:07:17 -0500
commit10a03d9299757a14525e1177ef34f68b316be1f0 (patch)
tree9442fa474010ab28d77eff1885c6bd701d17fa71
parentb195059bc8c9c7ff59538d908e81022d94515400 (diff)
downloadqarsh-10a03d9299757a14525e1177ef34f68b316be1f0.zip
qarsh-10a03d9299757a14525e1177ef34f68b316be1f0.tar.gz
qarsh-10a03d9299757a14525e1177ef34f68b316be1f0.tar.xz
Include host name in reboot and host down messages
After a long running command or when multiple qarsh processes are running in parallel, it's hard to know which host is having trouble when a "Remote host rebooted" message shows up. Include the host name in these message to make them more informative.
-rw-r--r--hbeat.c2
-rw-r--r--qarsh.c10
2 files changed, 5 insertions, 7 deletions
diff --git a/hbeat.c b/hbeat.c
index c62aeba..7b5b663 100644
--- a/hbeat.c
+++ b/hbeat.c
@@ -142,8 +142,6 @@ hbeat(hbeat_t hbh)
hbeatp->last_rhost_btime = hbeat;
retval = 1;
} else if (abs(hbeat - hbeatp->last_rhost_btime) > 5) {
- fprintf(stderr, "Host rebooted (%d, %d)\n",
- hbeat, hbeatp->last_rhost_btime);
hbeatp->rhost_state = HOST_REBOOT;
retval = 0;
} else {
diff --git a/qarsh.c b/qarsh.c
index b7814df..7a6adef 100644
--- a/qarsh.c
+++ b/qarsh.c
@@ -57,6 +57,7 @@ int signal_to_send = 0;
int sigs_to_propogate[] = { SIGINT, SIGTERM, SIGHUP, SIGUSR1, SIGUSR2 };
sigset_t pselect_sigmask;
int connection_timeout = 0;
+char *host = NULL;
void
@@ -423,15 +424,15 @@ run_remote_cmd(char *cmdline)
}
}
if (hbeat_getstate(qarsh_hb) == HOST_TIMEOUT) {
- fprintf(stderr, "Didn't receive heartbeat for %d seconds\n",
- hbeat_getmaxtimeout(qarsh_hb));
+ fprintf(stderr, "Didn't receive heartbeat from %s for %d seconds\n",
+ host, hbeat_getmaxtimeout(qarsh_hb));
return W_EXITCODE(127, 0);
} else if (hbeat_getstate(qarsh_hb) == HOST_REBOOT) {
- fprintf(stderr, "Remote host rebooted\n");
+ fprintf(stderr, "Remote host %s rebooted\n", host);
return W_EXITCODE(127, 0);
}
if (!cmd_finished) {
- fprintf(stderr, "Remote command exited with unknown state\n");
+ fprintf(stderr, "Remote command on %s exited with unknown state\n", host);
return W_EXITCODE(127, 0);
}
return rc;
@@ -442,7 +443,6 @@ main(int argc, char *argv[])
{
int c;
int port = 5016;
- char *host = NULL;
char *remuser = NULL;
char *remgroup = NULL;
char *args;