? make/defines.mk
Index: cman/daemon/cmanccs.c
===================================================================
RCS file: /cvs/cluster/cluster/cman/daemon/cmanccs.c,v
retrieving revision 1.34
diff -u -r1.34 cmanccs.c
--- cman/daemon/cmanccs.c	24 Oct 2007 03:21:45 -0000	1.34
+++ cman/daemon/cmanccs.c	24 Oct 2007 03:35:18 -0000
@@ -49,6 +49,7 @@
 #define NODE_NAME_PATH_BYNUM	"/cluster/clusternodes/clusternode[%d]/@name"
 #define NODE_VOTES_PATH		"/cluster/clusternodes/clusternode[@name=\"%s\"]/@votes"
 #define NODE_NODEID_PATH	"/cluster/clusternodes/clusternode[@name=\"%s\"]/@nodeid"
+#define NODE_SPECTATOR_PATH	"/cluster/clusternodes/clusternode[@name=\"%s\"]/spectator"
 #define NODE_ALTNAMES_PATH	"/cluster/clusternodes/clusternode[@name=\"%s\"]/altname[%d]/@name"
 #define NODE_ALTNAMES_PORT	"/cluster/clusternodes/clusternode[@name=\"%s\"]/altname[%d]/@port"
 #define NODE_ALTNAMES_MCAST	"/cluster/clusternodes/clusternode[@name=\"%s\"]/altname[%d]/@mcast"
@@ -144,8 +145,18 @@
 	if (!ccs_get(ctree, path, &str)) {
 	    votes = atoi(str);
 	    free(str);
-	} else
-	    votes = 1;
+	} else {
+	    /* Check if the node is a spectator */
+	    memset(path, 0, MAX_PATH_LEN);
+	    sprintf(path, NODE_SPECTATOR_PATH, nodename);
+	    if (!ccs_get(ctree, path, &str)) {
+		votes = 0; /* we are a spectator */
+		if (str)
+			free(str);
+	    } else {
+		votes = 1;
+	    }
+	}
 
 	memset(path, 0, MAX_PATH_LEN);
 	sprintf(path, NODE_NODEID_PATH, nodename);
@@ -514,9 +525,17 @@
 			free(name);
 
 			error = ccs_get(cd, path, &str);
-			if (error)
-				vote_sum++;
-			else {
+			if (error) {
+				/* Check if the node is a spectator */
+				memset(path, 0, MAX_PATH_LEN);
+				sprintf(path, NODE_SPECTATOR_PATH, nodename);
+				if (!ccs_get(cd, path, &str)) {
+					if (str)
+						free(str); /* we are a spectator. don't increase the vote_sum */
+				} else {
+					vote_sum++;
+				}
+			} else {
 				if (atoi(str) < 0) {
 					log_printf(LOG_ERR, "negative votes not allowed");
 					write_cman_pipe("Found negative votes for this node in CCS");
@@ -585,9 +604,16 @@
 			}
 			votes = votestmp;
 			free(str);
-		}
-		else {
-			votes = 1;
+		} else {
+			memset(path, 0, MAX_PATH_LEN);
+			sprintf(path, NODE_SPECTATOR_PATH, nodename);
+			if (!ccs_get(cd, path, &str)) {
+				votes = 0; /* we are a spectator */
+				if (str)
+					free(str);
+			} else {
+				votes = 1;
+			}
 		}
 	}
 
