Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > d236c5da97a239a1b6991cfba2865b66 > files > 124

cman-2.0.115-68.el5_6.1.src.rpm

diff --git a/cman/daemon/ais.c b/cman/daemon/ais.c
index a88cbcd..efb2b44 100644
--- a/cman/daemon/ais.c
+++ b/cman/daemon/ais.c
@@ -52,6 +52,7 @@ extern char *key_filename;
 extern unsigned int quorumdev_poll;
 extern unsigned int ccsd_poll_interval;
 extern unsigned int shutdown_timeout;
+extern int two_node;
 extern int init_config(struct objdb_iface_ver0 *objdb);
 
 struct totem_ip_address mcast_addr[MAX_INTERFACES];
@@ -515,7 +516,7 @@ static int comms_init_ais(struct objdb_iface_ver0 *objdb)
 							"20", strlen("20")+1);
 		}
 
-		/* Extend consensus & join timeouts per bz#214290 */
+		/* Extend join timeout per bz#214290 */
 		if (objdb_get_string(objdb, object_handle, "join", &value)) {
 			global_objdb->object_key_create(object_handle, "join", strlen("join"),
 							"60", strlen("60")+1);
@@ -525,16 +526,26 @@ static int comms_init_ais(struct objdb_iface_ver0 *objdb)
 			global_objdb->object_key_create(object_handle, "fail_recv_const", strlen("fail_to_recv_const"),
 							"2500", strlen("2500")+1);
 		}
-		/* consensus should be 2*token, see bz#544482*/
-		if (objdb_get_string(objdb, object_handle, "consensus", &value)) {
-		        unsigned int token=0;
-			char calc_consensus[32];
-
-			objdb_get_int(objdb, object_handle, "token", &token);
-			sprintf(calc_consensus, "%d", token*2);
-			objdb->object_key_create(object_handle, "consensus", strlen("consensus"),
-						 calc_consensus, strlen(calc_consensus)+1);
-		}
+
+		/* bz#611391
+		 * consensus should be 1.2*token or for 0.2*token for two_node clusters
+		 */
+ 		if (objdb_get_string(objdb, object_handle, "consensus", &value)) {
+ 		        unsigned int token=0;
+			unsigned int consensus;
+ 			char calc_consensus[32];
+
+ 			objdb_get_int(objdb, object_handle, "token", &token);
+
+			if (two_node)
+				consensus = (float)token*0.2;
+			else
+				consensus = (float)token*1.2;
+
+			snprintf(calc_consensus, sizeof(calc_consensus), "%d", consensus);
+ 			objdb->object_key_create(object_handle, "consensus", strlen("consensus"),
+ 						 calc_consensus, strlen(calc_consensus)+1);
+ 		}
 
 		/* Set RRP mode appropriately */
 		if (num_interfaces > 1) {