CVSROOT:        /cvs/cluster
Module name:    cluster
Changes by:     [EMAIL PROTECTED]       2007-11-01 00:25:28

Modified files:
        cman/qdisk     : main.c 

Log message:
        If votes for quorumd is _not_ specified in cluster.conf, then
        automatically set votes to number of nodes - 1.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/qdisk/main.c.diff?cvsroot=cluster&r1=1.10&r2=1.11

--- cluster/cman/qdisk/main.c   2007/03/20 19:37:24     1.10
+++ cluster/cman/qdisk/main.c   2007/11/01 00:25:28     1.11
@@ -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 */

Reply via email to