This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cluster: master - cman: Add more info to cman_tool status


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=9a80857680f1ffd944ac3a1d9f6bd8e11d22939d
Commit:        9a80857680f1ffd944ac3a1d9f6bd8e11d22939d
Parent:        1cdfc26caaedbd2dbd4a2d2998a8e5cf1115639b
Author:        Christine Caulfield <ccaulfie@redhat.com>
AuthorDate:    Fri Jan 9 11:57:50 2009 +0000
Committer:     Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Fri Jan 9 11:57:50 2009 +0000

cman: Add more info to cman_tool status

Some information is available via 'ccs' now, so we can use that

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
 cman/cman_tool/main.c            |   22 +++-------------------
 cman/services/cman/lib/libcman.c |   27 ++++++++++++++-------------
 2 files changed, 17 insertions(+), 32 deletions(-)

diff --git a/cman/cman_tool/main.c b/cman/cman_tool/main.c
index 2dcf014..376d095 100644
--- a/cman/cman_tool/main.c
+++ b/cman/cman_tool/main.c
@@ -242,6 +242,9 @@ static void show_status(void)
 		printf("Node name: %s\n", node.cn_name);
 		printf("Node ID: %d\n", node.cn_nodeid);
 	}
+	if (einfo->ei_num_addresses > 0) {
+		printf("Multicast addresses: %s\n", einfo->ei_addresses);
+	}
 
 	if (einfo->ei_flags & CMAN_EXTRA_FLAG_DISALLOWED) {
 		int count;
@@ -342,25 +345,6 @@ static void print_node(commandline_t *comline, cman_handle_t h, int *format, str
 		       node->cn_incarnation, jstring, node->cn_name);
 	}
 #if 0
-	if (comline->fence_opt && !comline->format_opts) {
-		char agent[255];
-		uint64_t fence_time;
-		int fenced;
-
-		if (!cman_get_fenceinfo(h, node->cn_nodeid, &fence_time, &fenced, agent)) {
-			if (fence_time) {
-				time_t fence_time_t = (time_t)fence_time;
-				ftime = localtime(&fence_time_t);
-				strftime(jstring, sizeof(jstring), "%F %H:%M:%S", ftime);
-				printf("       Last fenced:   %-15s by %s\n", jstring, agent);
-			}
-			if (!node->cn_member && node->cn_incarnation && !fenced) {
-				printf("       Node has not been fenced since it went down\n");
-			}
-		}
-	}
-#endif
-#if 0
 	int numaddrs;
 	struct cman_node_address addrs[MAX_INTERFACES];
 
diff --git a/cman/services/cman/lib/libcman.c b/cman/services/cman/lib/libcman.c
index dfbdb99..4031a1c 100644
--- a/cman/services/cman/lib/libcman.c
+++ b/cman/services/cman/lib/libcman.c
@@ -75,18 +75,6 @@ static CorosyncCfgCallbacksT cfg_callbacks =
 
 static struct cman_inst *admin_inst;
 
-static uint16_t generate_cluster_id(char *name)
-{
-	int i;
-	int value = 0;
-
-	for (i=0; i<strlen(name); i++) {
-		value <<= 1;
-		value += name[i];
-	}
-	return value & 0xFFFF;
-}
-
 static void cfg_shutdown_callback(
 	corosync_cfg_handle_t handle,
 	CorosyncCfgShutdownFlagsT flags)
@@ -886,7 +874,7 @@ int cman_get_cluster(cman_handle_t handle, cman_cluster_t *clinfo)
 		free(value);
 	}
 	else {
-		clinfo->ci_number = generate_cluster_id(clinfo->ci_name);
+		clinfo->ci_number = 0;
 	}
 	clinfo->ci_generation = 0; // CC: TODO ???
 
@@ -1082,6 +1070,8 @@ int cman_stop_notification(cman_handle_t handle)
 int cman_get_extra_info(cman_handle_t handle, cman_extra_info_t *info, int maxlen)
 {
 	struct cman_inst *cman_inst;
+	unsigned int ccs_handle;
+	char *value;
 	struct cmanquorum_info qinfo;
 
 	cman_inst = (struct cman_inst *)handle;
@@ -1101,6 +1091,17 @@ int cman_get_extra_info(cman_handle_t handle, cman_extra_info_t *info, int maxle
 	info->ei_quorum = qinfo.quorum;
 	info->ei_members = cman_inst->node_count;
 	info->ei_node_state = 2;
+	info->ei_num_addresses = 1;
+
+	ccs_handle = ccs_connect();
+	if (!ccs_get(ccs_handle, "/totem/interface/@mcastaddr", &value)) {
+	  fprintf(stderr, "CC: got mcast %s\n", value);
+		strcpy(info->ei_addresses, value);
+		free(value);
+	}
+
+	ccs_disconnect(ccs_handle);
+
 	return 0;
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]