Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=772... Commit: 77279c9976e222473c041f3896046f1134ee34fe Parent: 704fd5bb382ff452fc8403b9a2322e73b918619d Author: Lon Hohberger lhh@redhat.com AuthorDate: Fri Feb 19 12:18:58 2010 -0500 Committer: Lon Hohberger lhh@redhat.com CommitterDate: Fri Feb 19 12:18:58 2010 -0500
qdiskd: Autoconfigure votes based on node count
This makes qdiskd easier to use for most configurations and does not override existing configurations.
Signed-off-by: Lon Hohberger lhh@redhat.com --- cman/man/qdisk.5 | 5 +++-- cman/qdisk/main.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/cman/man/qdisk.5 b/cman/man/qdisk.5 index 1a74470..abd80dc 100644 --- a/cman/man/qdisk.5 +++ b/cman/man/qdisk.5 @@ -73,7 +73,7 @@ the amount of synchronous I/O contention on the shared quorum disk. * Cluster node IDs must be statically configured in cluster.conf and must be numbered from 1..16 (there can be gaps, of course).
-* Cluster node votes should be more or less equal. +* Cluster node votes should all be 1.
* CMAN must be running before the qdisk program can operate in full capacity. If CMAN is not running, qdisk will wait for it. @@ -239,7 +239,8 @@ exceed \fBtko\fP. \fIvotes\fP\fB="\fP3\fB"\fP .in 12 This is the number of votes the quorum daemon advertises to CMAN when it -has a high enough score. +has a high enough score. The default is the number of nodes in the cluster +minus 1. For example, in a 4 node cluster, the default is 3.
.in 9 \fIlog_level\fP\fB="\fP4\fB"\fP diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c index 85a0563..5d984dc 100644 --- a/cman/qdisk/main.c +++ b/cman/qdisk/main.c @@ -1469,6 +1469,40 @@ get_dynamic_config_data(qd_ctx *ctx, int ccsfd)
static int +auto_qdisk_votes(int desc) +{ + int x, ret = 0; + char buf[128]; + char *name; + + if (desc < 0) { + return 1; + } + + while (++x) { + snprintf(buf, sizeof(buf)-1, + "/cluster/clusternodes/clusternode[%d]/@name", x); + + name = NULL; + if (ccs_get(desc, buf, &name) != 0) + break; + + free(name); + ret = x; + } + + --ret; + if (ret <= 0) { + ret = 1; + } + + logt_print(LOG_DEBUG, "Setting votes to %d\n", ret); + + return (ret); +} + + +static int get_static_config_data(qd_ctx *ctx, int ccsfd) { char *val = NULL; @@ -1574,6 +1608,8 @@ get_static_config_data(qd_ctx *ctx, int ccsfd) free(val); if (ctx->qc_votes < 0) ctx->qc_votes = 0; + } else { + ctx->qc_votes = auto_qdisk_votes(ccsfd); }
/* Get device */
cluster-commits@lists.stg.fedorahosted.org