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

[Cluster-devel] [PATCH] qdisk: set default votes



Hi Lon,

the patch in attachment is very simple. If votes for quorumd is _not_
specified in cluster.conf, then automatically set votes to number of nodes - 1.

Thanks
Fabio

-- 
I'm going to make him an offer he can't refuse.
? make/defines.mk
Index: cman/qdisk/main.c
===================================================================
RCS file: /cvs/cluster/cluster/cman/qdisk/main.c,v
retrieving revision 1.10
diff -u -r1.10 main.c
--- cman/qdisk/main.c	20 Mar 2007 19:37:24 -0000	1.10
+++ cman/qdisk/main.c	30 Oct 2007 04:39:26 -0000
@@ -1209,14 +1209,30 @@
 	}
 	if (ctx->qc_master_wait <= ctx->qc_tko_up)
 		ctx->qc_master_wait = ctx->qc_tko_up + 1;
-		
+
 	/* Get votes */
+
+	/* check if votes is set in cluster.conf */
 	snprintf(query, sizeof(query), "/cluster/quorumd/@votes");
 	if (ccs_get(ccsfd, query, &val) == 0) {
 		ctx->qc_votes = atoi(val);
 		free(val);
 		if (ctx->qc_votes < 0)
 			ctx->qc_votes = 0;
+	} else { /* if votes is not set, default to node_num - 1 */
+		int nodes = 0, error;
+		for (;;) {
+			error = ccs_get_list(ccsfd, "/cluster/clusternodes/child::*", &val);
+			if (error || !val)
+				break;
+
+			nodes++;
+		}
+		nodes--;
+		if (nodes < 0)
+			nodes = 0;
+
+		ctx->qc_votes = nodes;
 	}
 
 	/* Get device */

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