cluster: STABLE3 - cman: Make master-wins mode work

Lon Hohberger lon at fedoraproject.org
Thu Nov 12 18:12:26 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=1355137a28acef6dc60df915bdf92f6083488513
Commit:        1355137a28acef6dc60df915bdf92f6083488513
Parent:        3a04a1555c43973f215142f537c917ea12e6c080
Author:        Lon Hohberger <lhh at redhat.com>
AuthorDate:    Tue Nov 3 15:50:59 2009 -0500
Committer:     Lon Hohberger <lhh at redhat.com>
CommitterDate: Thu Nov 12 13:07:07 2009 -0500

cman: Make master-wins mode work

Resolves: bz372901

Signed-off-by: Lon Hohberger <lhh at redhat.com>
---
 cman/man/qdisk.5  |   18 ++++++++++++++++++
 cman/qdisk/disk.h |    3 ++-
 cman/qdisk/main.c |   19 ++++++++++++++++++-
 3 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/cman/man/qdisk.5 b/cman/man/qdisk.5
index 7a00a25..f578e92 100644
--- a/cman/man/qdisk.5
+++ b/cman/man/qdisk.5
@@ -278,6 +278,24 @@ this value is 1 (on).  This option can be changed while qdiskd is
 running.
 
 .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 b00c580..c5b3d18 100644
--- a/cman/qdisk/disk.h
+++ b/cman/qdisk/disk.h
@@ -54,7 +54,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 87934c9..eb3ab3c 100644
--- a/cman/qdisk/main.c
+++ b/cman/qdisk/main.c
@@ -1106,7 +1106,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_cman_admin, 1);
 			}
 		}
@@ -1557,6 +1558,15 @@ get_static_config_data(qd_ctx *ctx, int ccsfd)
 			ctx->qc_scoremin = 0;
 	}
 
+	/* 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) {
@@ -1626,6 +1636,13 @@ get_config_data(qd_ctx *ctx, struct h_data *h, int maxh, int *cfh)
 
 	*cfh = configure_heuristics(ccsfd, h, maxh);
 
+	if (*cfh) {
+		if (ctx->qc_flags & RF_MASTER_WINS) {
+			logt_print(LOG_WARNING, "Master-wins mode disabled\n");
+			ctx->qc_flags &= ~RF_MASTER_WINS;
+		}
+	}
+
 	logt_print(LOG_DEBUG, "Quorum Daemon: %d heuristics, "
 		   "%d interval, %d tko, %d votes\n",
 		   *cfh, ctx->qc_interval, ctx->qc_tko, ctx->qc_votes);


More information about the cluster-commits mailing list