From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3262 invoked by alias); 22 Jul 2009 15:07:12 -0000 Received: (qmail 3256 invoked by alias); 22 Jul 2009 15:07:11 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion2.fedora.phx.redhat.com Subject: cluster: STABLE3 - cman: Improve cman_tool startup error reporting To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/STABLE3 X-Git-Reftype: branch X-Git-Oldrev: 43371def0f66c4d026342b2beac015bb4cd2f5c4 X-Git-Newrev: 09aa3a3c4979b514379c56066d416d01a1e6ac3d From: Christine Caulfield Message-Id: <20090722150651.274071201FC@lists.fedorahosted.org> Date: Wed, 22 Jul 2009 15:07:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q3/txt/msg00067.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=09aa3a3c4979b514379c56066d416d01a1e6ac3d Commit: 09aa3a3c4979b514379c56066d416d01a1e6ac3d Parent: 43371def0f66c4d026342b2beac015bb4cd2f5c4 Author: Christine Caulfield AuthorDate: Wed Jul 22 16:04:48 2009 +0100 Committer: Christine Caulfield CommitterDate: Wed Jul 22 16:04:48 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 --- cman/cman_tool/join.c | 6 +++++- cman/daemon/cman-preconfig.c | 16 +++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/cman/cman_tool/join.c b/cman/cman_tool/join.c index eaea597..2a0e017 100644 --- a/cman/cman_tool/join.c +++ b/cman/cman_tool/join.c @@ -272,7 +272,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++; @@ -286,6 +286,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/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c index 1dc7a26..8c490df 100644 --- a/cman/daemon/cman-preconfig.c +++ b/cman/daemon/cman-preconfig.c @@ -543,22 +543,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"); + 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("Can't determine local node name"); + 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; + } } @@ -622,8 +624,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; @@ -643,8 +647,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++; }