commit 2d6c88823e2f2e663d4499769152cc0d21644d34 Author: Lon Hohberger <lhh@redhat.com> Date: Tue Nov 3 15:50:59 2009 -0500 cman: Make master-wins mode work Resolves: bz372901 Signed-off-by: Lon Hohberger <lhh@redhat.com> diff --git a/cman/man/qdisk.5 b/cman/man/qdisk.5 index 7d28f90..0bca22a 100644 --- a/cman/man/qdisk.5 +++ b/cman/man/qdisk.5 @@ -277,6 +277,24 @@ as a result in a change in score (see section 2.2). The default for this value is 1 (on). .in 9 +\fImaster_wins\fP\fB="\fP0\fB"\fP +.in 12 +If set to 1 (on), only the qdiskd master will advertise its votes +to CMAN. In a network partition, only the qdisk master will provide +votes to CMAN. Consequently, that node will automatically "win" in +a fence race. + +This option requires careful tuning of the CMAN timeout, the qdiskd +timeout, and CMAN's quorum_dev_poll value. As a rule of thumb, +CMAN's quorum_dev_poll value should be equal to Totem's token timeout +and qdiskd's timeout (interval*tko) should be less than half of +Totem's token timeout. + +This option only takes effect if there are no heuristics +configured. Usage of this option in configurations with more than +two cluster nodes is undefined and should not be done. + +.in 9 \fIallow_kill\fP\fB="\fP1\fB"\fP .in 12 If set to 0 (off), qdiskd will *not* instruct to kill nodes it thinks diff --git a/cman/qdisk/disk.h b/cman/qdisk/disk.h index 0b652b2..b784220 100644 --- a/cman/qdisk/disk.h +++ b/cman/qdisk/disk.h @@ -74,7 +74,8 @@ typedef enum { RF_ALLOW_KILL = 0x10, RF_UPTIME = 0x20, RF_CMAN_LABEL = 0x40, - RF_IOTIMEOUT = 0x80 + RF_IOTIMEOUT = 0x80, + RF_MASTER_WINS = 0x100 } run_flag_t; diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c index cc18a05..81c6545 100644 --- a/cman/qdisk/main.c +++ b/cman/qdisk/main.c @@ -1061,7 +1061,8 @@ quorum_loop(qd_ctx *ctx, node_info_t *ni, int max) "Halting qdisk operations\n"); return -1; } - if (!errors) + if (!errors && + (!(ctx->qc_flags & RF_MASTER_WINS))) cman_poll_quorum_device(ctx->qc_ch, 1); } } @@ -1365,6 +1366,15 @@ get_config_data(char *cluster_name, qd_ctx *ctx, struct h_data *h, int maxh, free(val); } + /* Get master-wins flag for when we transition -> offline */ + /* default = off, so, 1 to turn on */ + snprintf(query, sizeof(query), "/cluster/quorumd/@master_wins"); + if (ccs_get(ccsfd, query, &val) == 0) { + if (atoi(val)) + ctx->qc_flags |= RF_MASTER_WINS; + free(val); + } + /* Get cman_label */ snprintf(query, sizeof(query), "/cluster/quorumd/@cman_label"); if (ccs_get(ccsfd, query, &val) == 0) { @@ -1460,6 +1470,13 @@ get_config_data(char *cluster_name, qd_ctx *ctx, struct h_data *h, int maxh, *cfh = configure_heuristics(ccsfd, h, maxh); + if (*cfh) { + if (ctx->qc_flags & RF_MASTER_WINS) { + clulog(LOG_WARNING, "Master-wins mode disabled\n"); + ctx->qc_flags &= ~RF_MASTER_WINS; + } + } + clulog(LOG_DEBUG, "Quorum Daemon: %d heuristics, %d interval, %d tko, %d votes\n", *cfh, ctx->qc_interval, ctx->qc_tko, ctx->qc_votes);