cluster/cman/qdisk main.c
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: fabbione at sourceware.org 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.
cman/qdisk/main.c +17 -1
@@ -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 */