Send Linux-ha-cvs mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."


Today's Topics:

   1. Linux-HA CVS: include by zhenh from 
      ([email protected])
   2. Linux-HA CVS: lib by zhenh from  ([email protected])
   3. Linux-HA CVS: membership by zhenh from 
      ([email protected])


----------------------------------------------------------------------

Message: 1
Date: Wed,  7 Jun 2006 02:29:52 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: include by zhenh from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : zhenh
Host    : 
Project : linux-ha
Module  : include

Dir     : linux-ha/include/clplumbing


Modified Files:
        cl_quorum.h 


Log Message:
Add the site and weight support in ccm layer
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/include/clplumbing/cl_quorum.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- cl_quorum.h 9 Dec 2005 20:15:31 -0000       1.1
+++ cl_quorum.h 7 Jun 2006 08:29:52 -0000       1.2
@@ -31,7 +31,9 @@
  *     List of functions provided by implementations of the quorum interface.
  */
 struct hb_quorum_fns {
-       int (*getquorum) (int, int);
+       int (*getquorum) (const char* cluster
+       ,               int member_count, int member_quorum_votes
+       ,               int total_node_count, int total_quorum_votes);
 };
 
 




------------------------------

Message: 2
Date: Wed,  7 Jun 2006 02:29:53 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by zhenh from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : zhenh
Host    : 
Project : linux-ha
Module  : lib

Dir     : linux-ha/lib/plugins/quorum


Modified Files:
        majority.c twonodes.c 


Log Message:
Add the site and weight support in ccm layer
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/plugins/quorum/majority.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- majority.c  29 May 2006 13:38:07 -0000      1.2
+++ majority.c  7 Jun 2006 08:29:52 -0000       1.3
@@ -84,15 +84,19 @@
 }
 
 static int
-majority_getquorum(int member_count, int total_count)
+majority_getquorum(const char* cluster
+,              int member_count, int member_quorum_votes
+,              int total_node_count, int total_quorum_votes)
 {
-       
-       cl_log(LOG_INFO, "n_member=%d, nodecount=%d", 
-              member_count, total_count);  
+       cl_log(LOG_DEBUG, "quorum plugin: majority");
+       cl_log(LOG_DEBUG, "cluster:%s, member_count=%d, 
member_quorum_votes=%d", 
+              cluster, member_count, member_quorum_votes);  
+       cl_log(LOG_DEBUG, "total_node_count=%d, total_quorum_votes=%d", 
+              total_node_count, total_quorum_votes);  
                
-       if(member_count >=  total_count/2 + 1){ 
+       if(member_count >=  total_node_count/2 + 1){ 
                return QUORUM_YES; 
-       } else if ( total_count % 2 == 0 && member_count == total_count/2){
+       } else if ( total_node_count % 2 == 0 && member_count == 
total_node_count/2){
                return QUORUM_TIE;
        }
        
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/plugins/quorum/twonodes.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- twonodes.c  29 May 2006 13:38:07 -0000      1.2
+++ twonodes.c  7 Jun 2006 08:29:52 -0000       1.3
@@ -76,13 +76,17 @@
 }
 
 static int
-twonodes_break_tie(int member_count, int total_count)
+twonodes_break_tie(const char* cluster
+,              int member_count, int member_quorum_votes
+,              int total_node_count, int total_quorum_votes)
 {
        cl_log(LOG_DEBUG, "quorum plugin: twonodes");
-       cl_log(LOG_INFO, "n_member=%d, nodecount=%d", 
-              member_count, total_count);  
+       cl_log(LOG_DEBUG, "cluster:%s, member_count=%d, 
member_quorum_votes=%d", 
+              cluster, member_count, member_quorum_votes);  
+       cl_log(LOG_DEBUG, "total_node_count=%d, total_quorum_votes=%d", 
+              total_node_count, total_quorum_votes);  
               
-       if (total_count == 2) { 
+       if (total_node_count == 2) { 
                cl_log(LOG_INFO, "Break tie for 2 nodes cluster");
                return QUORUM_YES; 
        } 




------------------------------

Message: 3
Date: Wed,  7 Jun 2006 02:29:54 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: membership by zhenh from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : zhenh
Host    : 
Project : linux-ha
Module  : membership

Dir     : linux-ha/membership/ccm


Modified Files:
        ccm.c ccm.h ccm_statemachine.c ccmclient.c ccmllm.c 


Log Message:
Add the site and weight support in ccm layer
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/membership/ccm/ccm.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -3 -r1.113 -r1.114
--- ccm.c       26 Apr 2006 17:07:11 -0000      1.113
+++ ccm.c       7 Jun 2006 08:29:52 -0000       1.114
@@ -145,7 +145,8 @@
                        msg = newmsg;
                } else if(strcasecmp(type, T_STATUS) == 0){
                        const char* nodetype;
-
+                       const char* site;
+                       int     weight;
                        if (llm_is_valid_node(&info->llm, orig)){
 
                                if (nodelist_update(hb, info,orig, status) != 
HA_OK){
@@ -169,8 +170,10 @@
                        if (STRNCMP_CONST(nodetype, NORMALNODE) !=0 ){
                                return TRUE;
                        }
-                       
-                       if (llm_add(llm, orig, status, mynode) != HA_OK){
+                       nodetype = hb->llc_ops->node_type(hb, orig);
+                       site = hb->llc_ops->node_site(hb, orig);
+                       weight = hb->llc_ops->node_weight(hb, orig);
+                       if (llm_add(llm, orig, status, mynode, site, weight) != 
HA_OK){
                                ccm_log(LOG_ERR, "%s: adding node(%s) to llm 
failed",
                                       __FUNCTION__,orig);
                                return FALSE;
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/membership/ccm/ccm.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -3 -r1.49 -r1.50
--- ccm.h       17 Feb 2006 05:48:24 -0000      1.49
+++ ccm.h       7 Jun 2006 08:29:52 -0000       1.50
@@ -1,4 +1,4 @@
-/* $Id: ccm.h,v 1.49 2006/02/17 05:48:24 zhenh Exp $ */
+/* $Id: ccm.h,v 1.50 2006/06/07 08:29:52 zhenh Exp $ */
 /*
  * ccm.h: definitions Consensus Cluster Manager internal header
  *                             file
@@ -133,6 +133,8 @@
        int     uptime;
        gboolean join_request;
        gboolean receive_change_msg;
+       char    site[PATH_MAX];
+       int     weight;
 }llm_node_t;
 
 typedef struct llm_info_s { 
@@ -149,7 +151,8 @@
 void           llm_display(llm_info_t *llm);
 int            llm_init(llm_info_t *);
 int            llm_is_valid_node(llm_info_t *, const char *);
-int            llm_add(llm_info_t *, const char *, const char *, const char *);
+int            llm_add(llm_info_t *, const char *, const char *, const char *
+,                      const char *,int);
 int            llm_del(llm_info_t* llm,const char* node);
 int            llm_get_index(llm_info_t *, const char *);
 int            llm_get_myindex(llm_info_t *);
@@ -459,6 +462,7 @@
        uint32_t change_event_remaining_count;          
        enum change_event_type change_type;
        char change_node_id[NODEIDSIZE];
+       char            cluster[PATH_MAX];
 
 } ccm_info_t;
 
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/membership/ccm/ccm_statemachine.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- ccm_statemachine.c  12 Apr 2006 07:08:15 -0000      1.19
+++ ccm_statemachine.c  7 Jun 2006 08:29:52 -0000       1.20
@@ -1,4 +1,4 @@
-/* $Id: ccm_statemachine.c,v 1.19 2006/04/12 07:08:15 zhenh Exp $ */
+/* $Id: ccm_statemachine.c,v 1.20 2006/06/07 08:29:52 zhenh Exp $ */
 /* 
  * ccm.c: Consensus Cluster Service Program 
  *
@@ -3078,7 +3078,9 @@
        const char*     status;
        const char*     node;
        const char*     mynode = ops->get_mynodeid(llc);
-
+       const char*     cluster;
+       const char*     site;
+       int             weight;
        
        if (mynode == NULL){
                ccm_log(LOG_ERR, "set_llm_from_heartbeat:mynode is NULL");
@@ -3095,17 +3097,25 @@
        
        llm = CCM_GET_LLM(info);
        llm_init(llm);
+       memset(info->cluster, 0, sizeof(info->cluster));
+       cluster = llc->llc_ops->get_parameter(llc, KEY_CLUSTER);
+       if (cluster != NULL) {
+               strncpy(info->cluster, cluster, PATH_MAX);
+       }
+       
+
        while((node = ops->nextnode(llc)) != NULL) {            
                if (strcmp(ops->node_type(llc, node), PINGNODE)==0){
                        continue;
                }
                
                status = ops->node_status(llc, node);
-               
+               site = ops->node_site(llc, node);
+               weight = ops->node_weight(llc, node);
                ccm_debug2(LOG_DEBUG, "Cluster node: %s: status: %s", node,
                               status);
                
-               if (llm_add(llm, node, status, mynode)!= HA_OK){
+               if (llm_add(llm, node, status, mynode, site, weight)!= HA_OK){
                        ccm_log(LOG_ERR, "%s: adding node %s to llm failed",
                               __FUNCTION__, node);
                        return HA_FAIL;
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/membership/ccm/ccmclient.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -3 -r1.41 -r1.42
--- ccmclient.c 29 May 2006 08:55:24 -0000      1.41
+++ ccmclient.c 7 Jun 2006 08:29:52 -0000       1.42
@@ -1,4 +1,4 @@
-/* $Id: ccmclient.c,v 1.41 2006/05/29 08:55:24 zhenh Exp $ */
+/* $Id: ccmclient.c,v 1.42 2006/06/07 08:29:52 zhenh Exp $ */
 /* 
  * client.c: Consensus Cluster Client tracker
  *
@@ -349,8 +349,21 @@
                
        cur = g_list_first(quorum_list);
        while (cur != NULL) {
+               int mem_weight = 0;
+               int total_weight = 0;
+               int i, node;
+               
+               for (i=0; i<info->memcount; i++) {
+                       node = info->ccm_member[i];
+                       mem_weight+=info->llm.nodes[node].weight;
+               }
+               for (i=0; i<info->llm.nodecount; i++) {
+                       total_weight+=info->llm.nodes[i].weight;
+               }
                funcs = (struct hb_quorum_fns*)cur->data;
-               rc = funcs->getquorum(info->memcount, info->llm.nodecount);
+               rc = funcs->getquorum(info->cluster, info->memcount, mem_weight
+               ,               info->llm.nodecount, total_weight);
+               
                if (rc == QUORUM_YES){
                        return TRUE;
                }
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/membership/ccm/ccmllm.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- ccmllm.c    27 Feb 2006 14:05:12 -0000      1.30
+++ ccmllm.c    7 Jun 2006 08:29:52 -0000       1.31
@@ -1,4 +1,4 @@
-/* $Id: ccmllm.c,v 1.30 2006/02/27 14:05:12 alan Exp $ */
+/* $Id: ccmllm.c,v 1.31 2006/06/07 08:29:52 zhenh Exp $ */
 /* 
  * ccmllm.c: Low Level membership routines.
  *
@@ -273,7 +273,9 @@
 llm_add(llm_info_t *llm, 
        const char *node,
        const char *status, 
-       const char *mynode)
+       const char *mynode,
+       const char *site,
+       int weight)
 {
        int     nodecount;
        int     i, j;
@@ -307,6 +309,8 @@
        llm->nodes[i].join_request = FALSE;
        strncpy(llm->nodes[i].nodename, node,NODEIDSIZE);
        strncpy(llm->nodes[i].status, status, STATUSSIZE);
+       strncpy(llm->nodes[i].site, site, PATH_MAX);
+       llm->nodes[i].weight = weight;
        llm->nodecount++;
        
        if (llm->myindex >= i) {                




------------------------------

_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs


End of Linux-ha-cvs Digest, Vol 31, Issue 17
********************************************

Reply via email to