Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=52d... Commit: 52d28f1887ddb642b316251e22f4359c7ab79302 Parent: 9ba679c621535abc7fbf626fdff50377a072404d Author: Lon Hohberger lhh@redhat.com AuthorDate: Fri Feb 19 09:45:17 2010 -0500 Committer: Lon Hohberger lhh@redhat.com CommitterDate: Fri Feb 19 09:45:17 2010 -0500
qdisk: Autoconfigure default timings
Signed-off-by: Lon Hohberger lhh@redhat.com --- cman/man/qdisk.5 | 1 + cman/qdisk/disk.h | 2 +- cman/qdisk/main.c | 35 +++++++++++++++++++++++++++++++++-- 3 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/cman/man/qdisk.5 b/cman/man/qdisk.5 index f578e92..4d7e8e8 100644 --- a/cman/man/qdisk.5 +++ b/cman/man/qdisk.5 @@ -211,6 +211,7 @@ This is the frequency of read/write cycles, in seconds. \fItko\fP\fB="\fP10\fB"\fP .in 12 This is the number of cycles a node must miss in order to be declared dead. +The default for this number is dependent on the configured token timeout.
.in 9 \fItko_up\fP\fB="\fPX\fB"\fP diff --git a/cman/qdisk/disk.h b/cman/qdisk/disk.h index c5b3d18..8678ca7 100644 --- a/cman/qdisk/disk.h +++ b/cman/qdisk/disk.h @@ -246,7 +246,7 @@ typedef struct { int qc_max_error_cycles; int qc_master; /* Master?! */ int qc_config; - int qc_pad; + int qc_token_timeout; 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 eb3ab3c..b0fa501 100644 --- a/cman/qdisk/main.c +++ b/cman/qdisk/main.c @@ -24,6 +24,7 @@ #include <ccs.h> #include <liblogthread.h> #include "score.h" +#include "../daemon/cman.h" #include <sys/syslog.h>
#define LOG_DAEMON_NAME "qdiskd" @@ -1486,14 +1487,36 @@ get_static_config_data(qd_ctx *ctx, int ccsfd) if (ctx->qc_interval < 1) ctx->qc_interval = 1; } + + snprintf(query, sizeof(query), "/cluster/totem/@token"); + if (ccs_get(ccsfd, query, &val) == 0) { + ctx->qc_token_timeout = atoi(val); + free(val); + if (ctx->qc_token_timeout < 10000) { + logt_print(LOG_DEBUG, "Token timeout %d is too fast " + "to use with qdiskd!\n", + ctx->qc_token_timeout); + } + } else { + ctx->qc_token_timeout = DEFAULT_TOKEN_TIMEOUT; + } /* Get tko */ snprintf(query, sizeof(query), "/cluster/quorumd/@tko"); if (ccs_get(ccsfd, query, &val) == 0) { ctx->qc_tko = atoi(val); free(val); - if (ctx->qc_tko < 3) - ctx->qc_tko = 3; + } else { + ctx->qc_tko = ((ctx->qc_token_timeout / 1000) - + ctx->qc_interval) / 2; + logt_print(LOG_DEBUG, "Auto-configured TKO as %d based on " + "token=%d interval=%d\n", ctx->qc_tko, + ctx->qc_token_timeout, ctx->qc_interval); + } + + if (ctx->qc_tko < 4) { + logt_print(LOG_ERR, "Quorum disk TKO (%d) is too low!\n", + ctx->qc_tko); }
/* Get up-tko (transition off->online) */ @@ -1527,6 +1550,14 @@ get_static_config_data(qd_ctx *ctx, int ccsfd) } if (ctx->qc_master_wait <= ctx->qc_tko_up) ctx->qc_master_wait = ctx->qc_tko_up + 1; + + if ((ctx->qc_interval * (ctx->qc_master_wait + + ctx->qc_upgrade_wait + + ctx->qc_tko) * 1000) >= + ctx->qc_token_timeout) { + logt_print(LOG_WARNING, "Master failover too slow for " + "configured token timeout!\n"); + } /* Get votes */ snprintf(query, sizeof(query), "/cluster/quorumd/@votes");
cluster-commits@lists.fedorahosted.org