public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: STABLE3 - cman: make cman_tool show node names if possible
@ 2009-01-29 10:49 Christine Caulfield
0 siblings, 0 replies; only message in thread
From: Christine Caulfield @ 2009-01-29 10:49 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=8b6b7898c8a759dfe7390a6c276e41be5811cbfd
Commit: 8b6b7898c8a759dfe7390a6c276e41be5811cbfd
Parent: c8fdad1dca1d65cb3a96ce48006142bfa0dc8fa3
Author: Christine Caulfield <ccaulfie@redhat.com>
AuthorDate: Thu Jan 29 10:48:23 2009 +0000
Committer: Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Thu Jan 29 10:48:23 2009 +0000
cman: make cman_tool show node names if possible
...even if cman itself doesn't know them (eg cman_tool join -X)
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
cman/cman_tool/main.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/cman/cman_tool/main.c b/cman/cman_tool/main.c
index 21b7d72..b6e366d 100644
--- a/cman/cman_tool/main.c
+++ b/cman/cman_tool/main.c
@@ -344,8 +344,11 @@ static void print_node(commandline_t *comline, cman_handle_t h, int *format, str
char member_type;
struct tm *ftime;
struct tm *jtime;
+ int numaddrs;
+ struct cman_node_address addrs[MAX_INTERFACES];
char jstring[1024];
int i,j,k;
+ int tmpid;
cman_node_extra_t enode;
if (comline->num_nodenames > 0) {
@@ -369,6 +372,15 @@ static void print_node(commandline_t *comline, cman_handle_t h, int *format, str
break;
}
+ /* Make the name more friendly if cman can't find it in cluster.conf
+ * (we really don't want corosync to look up names in DNS so it invents them)
+ */
+ if (sscanf(node->cn_name, "Node%d", &tmpid) == 1 && tmpid == node->cn_nodeid) {
+ if (!cman_get_node_addrs(h, node->cn_nodeid, MAX_INTERFACES, &numaddrs, addrs)) {
+ getnameinfo((struct sockaddr *)addrs[0].cna_address, addrs[0].cna_addrlen, node->cn_name, sizeof(node->cn_name), NULL, 0, NI_NAMEREQD);
+ }
+ }
+
jtime = localtime(&node->cn_jointime.tv_sec);
if (node->cn_jointime.tv_sec && node->cn_member)
strftime(jstring, sizeof(jstring), "%F %H:%M:%S", jtime);
@@ -399,9 +411,6 @@ static void print_node(commandline_t *comline, cman_handle_t h, int *format, str
}
}
- int numaddrs;
- struct cman_node_address addrs[MAX_INTERFACES];
-
if (comline->addresses_opt || comline->format_opts) {
if (!cman_get_node_addrs(h, node->cn_nodeid, MAX_INTERFACES, &numaddrs, addrs) &&
numaddrs)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-01-29 10:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-29 10:49 cluster: STABLE3 - cman: make cman_tool show node names if possible 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).