public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: Christine Caulfield <chrissie@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: cluster: master - cman: Improve cman_tool startup error reporting
Date: Mon, 27 Jul 2009 10:44:00 -0000	[thread overview]
Message-ID: <20090727104403.82F03120376@lists.fedorahosted.org> (raw)

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++;
 	}


                 reply	other threads:[~2009-07-27 10:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090727104403.82F03120376@lists.fedorahosted.org \
    --to=chrissie@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).