public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: master - cman: Improve cman_tool startup error reporting
@ 2009-07-27 10:44 Christine Caulfield
  0 siblings, 0 replies; only message in thread
From: Christine Caulfield @ 2009-07-27 10:44 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=9309c9289a63c0cd583438faa2212401f860a316
Commit:        9309c9289a63c0cd583438faa2212401f860a316
Parent:        6d04c956635a0af1ac96d23ecc93806c1e4acd79
Author:        Christine Caulfield <ccaulfie@redhat.com>
AuthorDate:    Mon Jul 27 11:43:02 2009 +0100
Committer:     Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Mon Jul 27 11:43:02 2009 +0100

cman: Improve cman_tool startup error reporting

Several errors that can be generated by cman-preconfig get discarded and
replaced with a rather cursory and unhelpful
"corosync died: Could not read cluster configuration"

Now we print the messages passed back before examining the corosync
exit status.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
 cman/cman_tool/join.c        |    6 +++++-
 cman/config/cman-preconfig.c |   14 +++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/cman/cman_tool/join.c b/cman/cman_tool/join.c
index 2245eb3..630e31a 100644
--- a/cman/cman_tool/join.c
+++ b/cman/cman_tool/join.c
@@ -274,7 +274,7 @@ int join(commandline_t *comline, char *main_envp[])
 						fprintf(stderr, "forked process ID is %d\n", corosync_pid);
 					status = 1;
 
-					/* There might be a SUCCESS message in the pipe too. */
+					/* There might be a SUCCESS or error message in the pipe too. */
 					messageptr = strchr(messageptr, '\n');
 					if (messageptr)
 						messageptr++;
@@ -288,6 +288,10 @@ int join(commandline_t *comline, char *main_envp[])
 					status = 0;
 					break;
 				}
+				else if (messageptr) {
+						fprintf(stderr, "%s\n", messageptr);
+						break;
+					}
 			}
 			else if (len < 0 && errno == EINTR) {
 				continue;
diff --git a/cman/config/cman-preconfig.c b/cman/config/cman-preconfig.c
index b164080..1ba48ae 100644
--- a/cman/config/cman-preconfig.c
+++ b/cman/config/cman-preconfig.c
@@ -565,20 +565,24 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
 			error = uname(&utsname);
 			if (error) {
 				sprintf(error_reason, "cannot get node name, uname failed");
+				write_cman_pipe("Can't determine local node name, uname failed");
 				error = -1;
 				goto out;
 			}
 
 			if (strlen(utsname.nodename) >= sizeof(nodename)) {
 				sprintf(error_reason, "node name from uname is too long");
+				write_cman_pipe("local node name is too long");
 				error = -1;
 				goto out;
 			}
 
 			strcpy(nodename, utsname.nodename);
 		}
-		if (verify_nodename(objdb, nodename))
+		if (verify_nodename(objdb, nodename)) {
+			write_cman_pipe("Cannot find node name in cluster.conf");
 			return -1;
+		}
 
 	}
 
@@ -641,8 +645,10 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
 		free(str);
 	}
 
-	if (add_ifaddr(objdb, mcast_name, nodename, portnum, broadcast))
+	if (add_ifaddr(objdb, mcast_name, nodename, portnum, broadcast)) {
+		write_cman_pipe(error_reason);
 		return -1;
+	}
 
 	/* Get all alternative node names */
 	num_nodenames = 1;
@@ -662,8 +668,10 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
 			mcast = mcast_name;
 		}
 
-		if (add_ifaddr(objdb, mcast, node, portnum, broadcast))
+		if (add_ifaddr(objdb, mcast, node, portnum, broadcast)) {
+			write_cman_pipe(error_reason);
 			return -1;
+		}
 
 		num_nodenames++;
 	}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-07-27 10:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-27 10:44 cluster: master - cman: Improve cman_tool startup error reporting Christine Caulfield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).