This is the mail archive of the
cluster-cvs@sourceware.org
mailing list for the cluster.
master - cman: fix two_node startup if -e is specified
- From: Christine Caulfield <chrissie at fedoraproject dot org>
- To: cluster-cvs-relay at redhat dot com
- Date: Wed, 22 Oct 2008 13:18:55 +0000 (UTC)
- Subject: master - cman: fix two_node startup if -e is specified
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=82a83ab1e9253d3784333da9279713bec25f0a8b
Commit: 82a83ab1e9253d3784333da9279713bec25f0a8b
Parent: a07d8d56e945a265f3da2857ad1316f49c4ae157
Author: Christine Caulfield <ccaulfie@redhat.com>
AuthorDate: Wed Oct 22 14:12:02 2008 +0100
Committer: Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Wed Oct 22 14:18:42 2008 +0100
cman: fix two_node startup if -e is specified
two_node startup could fail because the vote_sum variable isn't calulated
if expected_votes is specified on the command-line.
Now we always iterate the nodes list to get the vote_sum.
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
cman/daemon/cmanconfig.c | 44 ++++++++++++++++++++++----------------------
1 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/cman/daemon/cmanconfig.c b/cman/daemon/cmanconfig.c
index ae94f37..2ccaf96 100644
--- a/cman/daemon/cmanconfig.c
+++ b/cman/daemon/cmanconfig.c
@@ -136,6 +136,8 @@ static int get_cman_join_info(struct corosync_api_v1 *corosync)
int votes=0;
unsigned int object_handle;
unsigned int node_object;
+ unsigned int nodes_handle;
+ unsigned int find_handle;
/* Cluster name */
if (objdb_get_string(corosync, cluster_parent_handle, "name", &cname)) {
@@ -159,29 +161,27 @@ static int get_cman_join_info(struct corosync_api_v1 *corosync)
}
}
- /* Sum node votes for expected */
- if (expected_votes == 0) {
- unsigned int nodes_handle;
- unsigned int find_handle;
-
- nodes_handle = nodeslist_init(corosync, cluster_parent_handle, &find_handle);
- do {
- int votes;
-
- node_count++;
-
- objdb_get_int(corosync, nodes_handle, "votes", (unsigned int *)&votes, 1);
- if (votes < 0) {
- log_printf(LOG_ERR, "negative votes not allowed");
- write_cman_pipe("Found negative votes for this node in CCS");
- error = -EINVAL;
- goto out;
- }
- vote_sum += votes;
- nodes_handle = nodeslist_next(corosync, find_handle);
- } while (nodes_handle);
- corosync->object_find_destroy(find_handle);
+ /* Sum node votes for expected. Even if we already know expected_votes, we need vote_sum
+ later */
+ nodes_handle = nodeslist_init(corosync, cluster_parent_handle, &find_handle);
+ do {
+ int votes;
+
+ node_count++;
+
+ objdb_get_int(corosync, nodes_handle, "votes", (unsigned int *)&votes, 1);
+ if (votes < 0) {
+ log_printf(LOG_ERR, "negative votes not allowed");
+ write_cman_pipe("Found negative votes for this node in CCS");
+ error = -EINVAL;
+ goto out;
+ }
+ vote_sum += votes;
+ nodes_handle = nodeslist_next(corosync, find_handle);
+ } while (nodes_handle);
+ corosync->object_find_destroy(find_handle);
+ if (expected_votes == 0) {
corosync->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
if (corosync->object_find_next(find_handle, &object_handle) == 0)
{