[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga/ricci/modules/cluster/clumon/src/common ...



CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL4
Changes by:	rmccabe sourceware org	2007-10-10 18:19:30

Modified files:
	ricci/modules/cluster/clumon/src/common: Cluster.cpp 

Log message:
	Rest of fix for 326571

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/common/Cluster.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.6.4.1&r2=1.6.4.2

--- conga/ricci/modules/cluster/clumon/src/common/Cluster.cpp	2007/10/10 18:10:37	1.6.4.1
+++ conga/ricci/modules/cluster/clumon/src/common/Cluster.cpp	2007/10/10 18:19:30	1.6.4.2
@@ -69,36 +69,20 @@
 unsigned int
 Cluster::votes()
 {
-	cman_handle_t ch = cman_init(NULL);
-	if (ch != NULL) {
-		cman_node_t this_node;
-		int ret;
+	FILE *fp;
 
-		ret = cman_get_node(ch, CMAN_NODEID_US, &this_node);
-		cman_finish(ch);
-		if (ret == 0) {
-			FILE *fp = fopen("/proc/cluster/nodes", "r");
-			if (fp != NULL) {
-				char buf[4096];
-				while (fgets(buf, sizeof(buf), fp) != NULL) {
-					int nodeid = -1;
-					int votes = -1;
-				
-					if (!strncmp("Node", buf, 4)) {
-						/* header */
-						continue;
-					}
-					ret = sscanf(buf, "%d %d %*d %*c %*s\n", &nodeid, &votes);
-					if (ret != 2)
-						continue;
-					if (nodeid == this_node.cn_nodeid) {
-						fclose(fp);
-						return (votes);
-					}
-				}
+	fp = fopen("/proc/cluster/status", "r");
+	if (fp != NULL) {
+		char buf[4096];
+		int votes = -1;
+
+		while (fgets(buf, sizeof(buf), fp) != NULL) {
+			if (sscanf(buf, "Total_votes: %d\n", &votes) == 1) {
 				fclose(fp);
+				return (votes);
 			}
 		}
+		fclose(fp);
 	}
 
 	unsigned int votes = 0;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]