cluster: RHEL6 - cman: Recalculate expected_votes on a config reload.

Lon Hohberger lon at fedoraproject.org
Fri Jun 25 13:14:48 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=a365c9baa8d424476c8d4967b83ad2acf6627e71
Commit:        a365c9baa8d424476c8d4967b83ad2acf6627e71
Parent:        1aa83158556acbd04e598f36ccac60a6bebf8ab7
Author:        Christine Caulfield <ccaulfie at redhat.com>
AuthorDate:    Wed Jun 23 10:28:33 2010 +0100
Committer:     Lon Hohberger <lhh at redhat.com>
CommitterDate: Fri Jun 25 09:14:20 2010 -0400

cman: Recalculate expected_votes on a config reload.

Add code to recalculate the expected_votes (and therefore quorum)
when the configuration is reloaded. This means that removing
a node now properly sets expected_votes down and the cluster
remains quorate. It will also raise expected_votes if a node is added.

rhbz#606989

Signed-off-by: Christine Caulfield <ccaulfie at redhat.com>
---
 cman/daemon/cmanconfig.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/cman/daemon/cmanconfig.c b/cman/daemon/cmanconfig.c
index 4a82525..16ef65f 100644
--- a/cman/daemon/cmanconfig.c
+++ b/cman/daemon/cmanconfig.c
@@ -45,6 +45,7 @@ int read_cman_nodes(struct corosync_api_v1 *corosync, unsigned int *config_versi
     int error;
     unsigned int expected = 0;
     unsigned int votes = 0;
+    unsigned int total_votes = 0;
     hdb_handle_t object_handle;
     hdb_handle_t nodes_handle;
     hdb_handle_t find_handle;
@@ -102,11 +103,14 @@ int read_cman_nodes(struct corosync_api_v1 *corosync, unsigned int *config_versi
 	    log_printf(LOGSYS_LEVEL_DEBUG, "memb: Got node %s from ccs (id=%d, votes=%d)\n", nodename, this_nodeid, votes);
 	    add_ccs_node(nodename, this_nodeid, votes, expected);
 	    nodes_handle = nodeslist_next(corosync, find_handle);
+	    total_votes += votes;
     } while (nodes_handle);
     corosync->object_find_destroy(find_handle);
 
-    if (expected)
-	    override_expected(expected);
+    if (!expected)
+	    expected = total_votes;
+
+    override_expected(expected);
 
     remove_unread_nodes();
     error = 0;


More information about the cluster-commits mailing list