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: STABLE3 - cman: make cman_tool show node names if possible Date: Thu, 29 Jan 2009 10:49:00 -0000 [thread overview] Message-ID: <20090129104929.E2DDB120569@lists.fedorahosted.org> (raw) 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)
reply other threads:[~2009-01-29 10:49 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=20090129104929.E2DDB120569@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: linkBe 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).