cluster: STABLE3 - resource-agents: Clear vm.sh default
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 5155e0a2fd30e9a3ee3b0b9d27b7418b9cdb71d4
Parent: b0836467149ce13739f5f96e21fdd3568c665a4a
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Mar 1 16:17:17 2010 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Mon Mar 1 16:17:17 2010 -0500
resource-agents: Clear vm.sh default
The default behavior of vm.sh is to use_virsh whenever
possible. The problem with specifying a default in the
RA metadata is that it causes rgmanager to provide a
value to the RA when it is called. In this case, rgmanager
was providing "1" as the default, meaning that the logic
which carefully determines whether to use 'xm' or 'virsh'
is disabled.
This is not seen when testing the resource agent by
hand; it is only seen when called in the context of
rgmanager or rg_test.
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/vm.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/rgmanager/src/resources/vm.sh b/rgmanager/src/resources/vm.sh
index 0b5f4b1..35de1d8 100644
--- a/rgmanager/src/resources/vm.sh
+++ b/rgmanager/src/resources/vm.sh
@@ -128,7 +128,7 @@ meta_data()
virtual machines instead of xm. This is required when
using non-Xen virtual machines (e.g. qemu / KVM).
</shortdesc>
- <content type="integer" default="1"/>
+ <content type="integer" default=""/>
</parameter>
<parameter name="xmlfile">
14 years, 2 months
cluster: STABLE3 - qdiskd: Reject invalid vote counts
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: b0836467149ce13739f5f96e21fdd3568c665a4a
Parent: 24932ca16c5501bc54d8a8fe8daa61006bea9a66
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Fri Feb 26 18:28:06 2010 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Mon Mar 1 08:59:34 2010 -0500
qdiskd: Reject invalid vote counts
Qdiskd can not determine proper vote counts if
people use weighted voting. Refuse to start
if someone does this.
Original patch from Fabio M. Di Nitto; I tweaked
the error messages slightly.
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
cman/qdisk/main.c | 59 ++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 43 insertions(+), 16 deletions(-)
diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c
index bf5b459..81218d0 100644
--- a/cman/qdisk/main.c
+++ b/cman/qdisk/main.c
@@ -1338,37 +1338,61 @@ get_log_config_data(int ccsfd)
}
+/*
+ * return number of nodes - 1 on success
+ * -1 on generic error
+ * -2 if one of the node votes is != 1
+ */
static int
auto_qdisk_votes(int desc)
{
- int x = 0, ret = 0;
- char buf[128];
+ int ret = 1;
+ char buf[PATH_MAX];
char *name;
- if (desc < 0) {
- return 1;
- }
+ while (1) {
+ int votes=0;
- while (++x) {
snprintf(buf, sizeof(buf)-1,
- "/cluster/clusternodes/clusternode[%d]/@name", x);
+ "/cluster/clusternodes/clusternode[%d]/@votes", ret);
name = NULL;
if (ccs_get(desc, buf, &name) != 0)
break;
- free(name);
- ret = x;
- }
+ votes=atoi(name);
+ if (votes != 1) {
+ free(name);
- --ret;
- if (ret <= 0) {
- ret = 1;
- }
+ snprintf(buf, sizeof(buf)-1,
+ "/cluster/clusternodes/clusternode[%d]/@name",
+ ret);
- logt_print(LOG_DEBUG, "Setting votes to %d\n", ret);
+ if (ccs_get(desc, buf, &name) == 0) {
+ logt_print(LOG_ERR, "%s's vote count is %d\n",
+ name, votes);
+ free(name);
+ }
- return (ret);
+ logt_print(LOG_ERR, "Set all node vote counts to 1 "
+ "or specify qdiskd's votes\n");
+ return -2;
+ }
+
+ free(name);
+ ret++;
+ }
+
+ // adjust count (one from init and one from the node count)
+ ret = ret - 2;
+
+ if (ret <= 0)
+ logt_print(LOG_ERR, "Unable to determine qdiskd votes "
+ "automatically\n");
+ else
+ logt_print(LOG_DEBUG, "Setting votes to %d\n", ret);
+
+ return (ret);
}
@@ -1518,6 +1542,9 @@ get_dynamic_config_data(qd_ctx *ctx, int ccsfd)
"new vote value; retaining old "
"value of %d\n", old_votes);
ctx->qc_votes = old_votes;
+ } else {
+ /* During startup, this is fatal */
+ return -1;
}
}
}
14 years, 2 months
cluster: STABLE3 - qdisk: Make configuration errors fatal during startup
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 24932ca16c5501bc54d8a8fe8daa61006bea9a66
Parent: 68fb61d29d4653442d064499bdb41721371a7754
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Feb 22 17:06:45 2010 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Fri Feb 26 18:12:07 2010 -0500
qdisk: Make configuration errors fatal during startup
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
cman/qdisk/main.c | 42 +++++++++++++++++++++++++++---------------
1 files changed, 27 insertions(+), 15 deletions(-)
diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c
index 59cb967..bf5b459 100644
--- a/cman/qdisk/main.c
+++ b/cman/qdisk/main.c
@@ -1574,6 +1574,7 @@ get_static_config_data(qd_ctx *ctx, int ccsfd)
logt_print(LOG_DEBUG, "Token timeout %d is too fast "
"to use with qdiskd!\n",
ctx->qc_token_timeout);
+ return -1;
}
} else {
ctx->qc_token_timeout = DEFAULT_TOKEN_TIMEOUT;
@@ -1593,7 +1594,7 @@ get_static_config_data(qd_ctx *ctx, int ccsfd)
}
if (ctx->qc_tko < 4) {
- logt_print(LOG_ERR, "Quorum disk TKO (%d) is too low!\n",
+ logt_print(LOG_WARNING, "Quorum disk TKO (%d) is too low!\n",
ctx->qc_tko);
}
@@ -1629,19 +1630,26 @@ 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;
+ logt_print(LOG_DEBUG, "Timings: %d tko, %d interval\n",
+ ctx->qc_tko, ctx->qc_interval);
+ logt_print(LOG_DEBUG, "Timings: %d tko_up, %d master_wait, "
+ "%d upgrade_wait\n",
+ ctx->qc_tko_up, ctx->qc_master_wait, ctx->qc_upgrade_wait);
+
qdisk_fo = ctx->qc_interval * (ctx->qc_master_wait +
ctx->qc_upgrade_wait +
ctx->qc_tko) * 1000;
if (qdisk_fo >= ctx->qc_token_timeout) {
- logt_print(LOG_WARNING, "Quorum disk timings are too slow for "
+ logt_print(LOG_ERR, "Quorum disk timings are too slow for "
"configured token timeout\n");
- logt_print(LOG_WARNING, " * Totem Token timeout: %dms\n",
+ logt_print(LOG_ERR, " * Totem Token timeout: %dms\n",
ctx->qc_token_timeout);
- logt_print(LOG_WARNING, " * Min. Master recovery time: %dms\n",
+ logt_print(LOG_ERR, " * Min. Master recovery time: %dms\n",
qdisk_fo);
- logt_print(LOG_WARNING,
+ logt_print(LOG_ERR,
"Please set token timeout to at least %dms\n",
qdisk_fo + (ctx->qc_interval * 1000));
+ return -1;
}
/* Get device */
@@ -1708,7 +1716,7 @@ get_static_config_data(qd_ctx *ctx, int ccsfd)
static int
get_config_data(qd_ctx *ctx, struct h_data *h, int maxh, int *cfh)
{
- int ccsfd = -1;
+ int ccsfd = -1, ret = -1;
ccsfd = ccs_connect();
if (ccsfd < 0) {
@@ -1732,14 +1740,20 @@ get_config_data(qd_ctx *ctx, struct h_data *h, int maxh, int *cfh)
ctx->qc_max_error_cycles = 0;
}
- if (ctx->qc_config ||
- get_dynamic_config_data(ctx, ccsfd) < 0)
+ if (get_dynamic_config_data(ctx, ccsfd) < 0) {
goto out;
+ }
+
+ if (ctx->qc_config) {
+ ret = 0;
+ goto out;
+ }
ctx->qc_config = 1;
- if (get_static_config_data(ctx, ccsfd) < 0)
+ if (get_static_config_data(ctx, ccsfd) < 0) {
goto out;
+ }
*cfh = configure_heuristics(ccsfd, h, maxh);
@@ -1750,18 +1764,16 @@ get_config_data(qd_ctx *ctx, struct h_data *h, int maxh, int *cfh)
}
}
+ ret = 0;
+
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);
- logt_print(LOG_DEBUG, "%d tko_up, %d master_wait, "
- "%d upgrade_wait\n",
- ctx->qc_tko_up, ctx->qc_master_wait, ctx->qc_upgrade_wait);
-out:
logt_print(LOG_DEBUG, "Run Flags: %08x\n", ctx->qc_flags);
-
+out:
ccs_disconnect(ccsfd);
- return 0;
+ return ret;
}
14 years, 2 months
cluster: STABLE3 - qdiskd: Dynamic votes
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 68fb61d29d4653442d064499bdb41721371a7754
Parent: 0247047ad88bb1a16d72f5237053ce1fd014b85f
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Feb 22 11:56:07 2010 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Fri Feb 26 18:12:07 2010 -0500
qdiskd: Dynamic votes
This patch allows qdiskd to reregister with CMAN
when the cluster node count or the administrator-supplied
votes parameter changes.
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
cman/man/qdisk.5 | 4 +-
cman/qdisk/main.c | 112 ++++++++++++++++++++++++++++++++++-------------------
2 files changed, 75 insertions(+), 41 deletions(-)
diff --git a/cman/man/qdisk.5 b/cman/man/qdisk.5
index abd80dc..7004f01 100644
--- a/cman/man/qdisk.5
+++ b/cman/man/qdisk.5
@@ -240,7 +240,9 @@ exceed \fBtko\fP.
.in 12
This is the number of votes the quorum daemon advertises to CMAN when it
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.
+minus 1. For example, in a 4 node cluster, the default is 3. This value
+may change during normal operation, for example when adding or removing
+a node from the cluster.
.in 9
\fIlog_level\fP\fB="\fP4\fB"\fP
diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c
index d1f29c5..59cb967 100644
--- a/cman/qdisk/main.c
+++ b/cman/qdisk/main.c
@@ -1339,10 +1339,45 @@ get_log_config_data(int ccsfd)
static int
+auto_qdisk_votes(int desc)
+{
+ int x = 0, 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_dynamic_config_data(qd_ctx *ctx, int ccsfd)
{
char *val = NULL;
char query[256];
+ int old_votes = 0;
if (ccsfd < 0)
return -1;
@@ -1464,41 +1499,49 @@ get_dynamic_config_data(qd_ctx *ctx, int ccsfd)
free(val);
}
- return 0;
-}
-
-
-static int
-auto_qdisk_votes(int desc)
-{
- int x = 0, ret = 0;
- char buf[128];
- char *name;
-
- if (desc < 0) {
- return 1;
+ /* Get votes */
+ if (ctx->qc_config) {
+ old_votes = ctx->qc_votes;
}
- 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;
+ snprintf(query, sizeof(query), "/cluster/quorumd/@votes");
+ if (ccs_get(ccsfd, query, &val) == 0) {
+ ctx->qc_votes = atoi(val);
+ free(val);
+ if (ctx->qc_votes < 0)
+ ctx->qc_votes = 0;
+ } else {
+ ctx->qc_votes = auto_qdisk_votes(ccsfd);
+ if (ctx->qc_votes < 0) {
+ if (ctx->qc_config) {
+ logt_print(LOG_WARNING, "Unable to determine "
+ "new vote value; retaining old "
+ "value of %d\n", old_votes);
+ ctx->qc_votes = old_votes;
+ }
+ }
}
- --ret;
- if (ret <= 0) {
- ret = 1;
- }
+ if (ctx->qc_config && old_votes != ctx->qc_votes) {
+ logt_print(LOG_DEBUG, "Changing vote count from %d to %d\n",
+ old_votes, ctx->qc_votes);
- logt_print(LOG_DEBUG, "Setting votes to %d\n", ret);
+ /*
+ * This is done in main() normally. Here, we are
+ * reconfiguring _only_ the votes at this point. The
+ * label / cman runflags do not change during reconfiguration
+ *
+ * This only works after we have already gotten static
+ * configuration data during initial startup.
+ */
+ cman_register_quorum_device(ctx->qc_cman_admin,
+ (ctx->qc_flags&RF_CMAN_LABEL)?
+ ctx->qc_cman_label:
+ ctx->qc_device,
+ ctx->qc_votes);
+ }
- return (ret);
+ return 0;
}
@@ -1601,17 +1644,6 @@ get_static_config_data(qd_ctx *ctx, int ccsfd)
qdisk_fo + (ctx->qc_interval * 1000));
}
- /* Get votes */
- snprintf(query, sizeof(query), "/cluster/quorumd/@votes");
- if (ccs_get(ccsfd, query, &val) == 0) {
- ctx->qc_votes = atoi(val);
- free(val);
- if (ctx->qc_votes < 0)
- ctx->qc_votes = 0;
- } else {
- ctx->qc_votes = auto_qdisk_votes(ccsfd);
- }
-
/* Get device */
snprintf(query, sizeof(query), "/cluster/quorumd/@device");
if (ccs_get(ccsfd, query, &val) == 0) {
14 years, 2 months