From: Fabio M. Di Nitto <fdinitto@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] qdiskd: restrict master_wins to 2 node cluster
Date: Mon, 9 Jul 2012 08:37:04 +0200 [thread overview]
Message-ID: <1341815824-4482-1-git-send-email-fdinitto@redhat.com> (raw)
From: "Fabio M. Di Nitto" <fdinitto@redhat.com>
given enough mingling of cluster.conf it was possible to
break quorum rule #1: there is only one quorum in a cluster at
any given time.
this change restricts master_wins to 2 node cluster only
and provides extra feedback to the user (via logging) on why
the mode is disabled.
Resolves: rhbz#838047
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
cman/man/qdisk.5 | 5 +++--
cman/qdisk/disk.h | 1 +
cman/qdisk/main.c | 22 +++++++++++++++-------
3 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/cman/man/qdisk.5 b/cman/man/qdisk.5
index ca974fa..938ed69 100644
--- a/cman/man/qdisk.5
+++ b/cman/man/qdisk.5
@@ -297,8 +297,9 @@ and qdiskd's timeout (interval*tko) should be less than half of
Totem's token timeout. See section 3.3.1 for more information.
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.
+configured and it is valid only for 2 node cluster.
+This option is automatically disabled if heuristics are
+defined or cluster has more than 2 nodes configured.
In a two-node cluster with no heuristics and no defined vote
count (see above), this mode is turned by default. If enabled in
diff --git a/cman/qdisk/disk.h b/cman/qdisk/disk.h
index fd80fa6..1792377 100644
--- a/cman/qdisk/disk.h
+++ b/cman/qdisk/disk.h
@@ -249,6 +249,7 @@ typedef struct {
int qc_master; /* Master?! */
int qc_config;
int qc_token_timeout;
+ int qc_auto_votes;
disk_node_state_t qc_disk_status;
disk_node_state_t qc_status;
run_flag_t qc_flags;
diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c
index 32677a2..e14d534 100644
--- a/cman/qdisk/main.c
+++ b/cman/qdisk/main.c
@@ -1444,7 +1444,7 @@ auto_qdisk_votes(int desc)
logt_print(LOG_ERR, "Unable to determine qdiskd votes "
"automatically\n");
else
- logt_print(LOG_DEBUG, "Setting votes to %d\n", ret);
+ logt_print(LOG_DEBUG, "Setting autocalculated votes to %d\n", ret);
return (ret);
}
@@ -1606,6 +1606,8 @@ get_dynamic_config_data(qd_ctx *ctx, int ccsfd)
ctx->qc_flags &= ~RF_AUTO_VOTES;
}
+ ctx->qc_auto_votes = auto_qdisk_votes(ccsfd);
+
snprintf(query, sizeof(query), "/cluster/quorumd/@votes");
if (ccs_get(ccsfd, query, &val) == 0) {
ctx->qc_votes = atoi(val);
@@ -1613,7 +1615,7 @@ get_dynamic_config_data(qd_ctx *ctx, int ccsfd)
if (ctx->qc_votes < 0)
ctx->qc_votes = 0;
} else {
- ctx->qc_votes = auto_qdisk_votes(ccsfd);
+ ctx->qc_votes = ctx->qc_auto_votes;
if (ctx->qc_votes < 0) {
if (ctx->qc_config) {
logt_print(LOG_WARNING, "Unable to determine "
@@ -1879,15 +1881,21 @@ get_config_data(qd_ctx *ctx, struct h_data *h, int maxh, int *cfh)
*cfh = configure_heuristics(ccsfd, h, maxh,
ctx->qc_interval * (ctx->qc_tko - 1));
- if (*cfh) {
- if (ctx->qc_flags & RF_MASTER_WINS) {
- logt_print(LOG_WARNING, "Master-wins mode disabled\n");
+ if (ctx->qc_flags & RF_MASTER_WINS) {
+ if (*cfh) {
+ logt_print(LOG_WARNING, "Master-wins mode disabled "
+ "(not compatible with heuristics)\n");
+ ctx->qc_flags &= ~RF_MASTER_WINS;
+ }
+ if (ctx->qc_auto_votes != 1) {
+ logt_print(LOG_WARNING, "Master-wins mode disabled "
+ "(not compatible with more than 2 nodes)\n");
ctx->qc_flags &= ~RF_MASTER_WINS;
}
} else {
if (ctx->qc_flags & RF_AUTO_VOTES &&
- !(ctx->qc_flags & RF_MASTER_WINS) &&
- ctx->qc_votes == 1) {
+ !*cfh &&
+ ctx->qc_auto_votes == 1) {
/* Two node cluster, no heuristics, 1 vote for
* quorum disk daemon. Safe to enable master-wins.
* In fact, qdiskd without master-wins in this config
--
1.7.7.6
reply other threads:[~2012-07-09 6:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1341815824-4482-1-git-send-email-fdinitto@redhat.com \
--to=fdinitto@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).