Send Linux-ha-cvs mailing list submissions to linux-ha-cvs@lists.linux-ha.org
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: resources by davidlee from (linux-ha-cvs@lists.linux-ha.org) 2. Linux-HA CVS: heartbeat by davidlee from (linux-ha-cvs@lists.linux-ha.org) 3. Linux-HA CVS: membership by zhenh from (linux-ha-cvs@lists.linux-ha.org) ---------------------------------------------------------------------- Message: 1 Date: Wed, 16 Aug 2006 03:20:16 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: resources by davidlee from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : davidlee Host : Project : linux-ha Module : resources Dir : linux-ha/resources/OCF Modified Files: Filesystem.in ocf-shellfuncs.in Log Message: Ensure 'tr' usage portable across different implementations. =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/Filesystem.in,v retrieving revision 1.31 retrieving revision 1.32 diff -u -3 -r1.31 -r1.32 --- Filesystem.in 22 Jun 2006 18:13:53 -0000 1.31 +++ Filesystem.in 16 Aug 2006 09:20:16 -0000 1.32 @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: Filesystem.in,v 1.31 2006/06/22 18:13:53 lars Exp $ +# $Id: Filesystem.in,v 1.32 2006/08/16 09:20:16 davidlee Exp $ # # Support: [EMAIL PROTECTED] # License: GNU General Public License (GPL) @@ -95,7 +95,7 @@ usage() { cat <<-EOT usage: $0 {start|stop|status|monitor|validate-all|meta-data} - $Id: Filesystem.in,v 1.31 2006/06/22 18:13:53 lars Exp $ + $Id: Filesystem.in,v 1.32 2006/08/16 09:20:16 davidlee Exp $ EOT } @@ -269,14 +269,14 @@ exit $OCF_ERR_GENERIC fi - OCFS2_UUID=$(mounted.ocfs2 -d $DEVICE|tail -1|awk '{print $3}'|tr -d -- -|tr a-z A-Z) + OCFS2_UUID=$(mounted.ocfs2 -d $DEVICE|tail -1|awk '{print $3}'|tr -d -- -|tr '[a-z]' '[A-Z]') if [ -z "$OCFS2_UUID" -o "$OCFS2_UUID" = "UUID" ]; then ocf_log err "$DEVICE: Could not determine ocfs2 UUID." exit $OCF_ERR_GENERIC fi if [ -n "$OCF_RESKEY_ocfs2_cluster" ]; then - OCFS2_CLUSTER=$(echo $OCF_RESKEY_ocfs2_cluster | tr a-z A-Z) + OCFS2_CLUSTER=$(echo $OCF_RESKEY_ocfs2_cluster | tr '[a-z]' '[A-Z]') else OCFS2_CLUSTER=$(find "$OCFS2_CONFIGFS" -maxdepth 1 -mindepth 1 -type d -printf %f 2>/dev/null) set -- $OCFS2_CLUSTER @@ -478,7 +478,7 @@ ocf_log info "$OCFS2_UUID: post-processed active: $n_active" - local n_myself=${HA_CURHOST:-$(uname -n | tr A-Z a-z)} + local n_myself=${HA_CURHOST:-$(uname -n | tr '[A-Z]' '[a-z]')} ocf_log info "$OCFS2_UUID: I am node $n_myself." case " $n_active " in =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/ocf-shellfuncs.in,v retrieving revision 1.32 retrieving revision 1.33 diff -u -3 -r1.32 -r1.33 --- ocf-shellfuncs.in 14 Aug 2006 09:39:06 -0000 1.32 +++ ocf-shellfuncs.in 16 Aug 2006 09:20:16 -0000 1.33 @@ -1,5 +1,5 @@ # -# $Id: ocf-shellfuncs.in,v 1.32 2006/08/14 09:39:06 andrew Exp $ +# $Id: ocf-shellfuncs.in,v 1.33 2006/08/16 09:20:16 davidlee Exp $ # # Common helper functions for the OCF Resource Agents supplied by # heartbeat. @@ -208,7 +208,7 @@ warn) __OCF_PRIO="WARNING";; info) __OCF_PRIO="INFO";; debug)__OCF_PRIO="DEBUG";; - *) __OCF_PRIO=`echo ${__OCF_PRIO}| tr 'a-z' 'A-Z'`;; + *) __OCF_PRIO=`echo ${__OCF_PRIO}| tr '[a-z]' '[A-Z]'`;; esac ha_log "${__OCF_PRIO}: $__OCF_MSG" ------------------------------ Message: 2 Date: Wed, 16 Aug 2006 03:20:16 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: heartbeat by davidlee from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : davidlee Host : Project : linux-ha Module : heartbeat Dir : linux-ha/heartbeat/lib Modified Files: mach_down.in Log Message: Ensure 'tr' usage portable across different implementations. =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/heartbeat/lib/mach_down.in,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- mach_down.in 27 Jul 2005 02:44:49 -0000 1.10 +++ mach_down.in 16 Aug 2006 09:20:16 -0000 1.11 @@ -13,7 +13,7 @@ : Now running $0: $* -mdown=`echo $1 | tr A-Z a-z`; # The name of the downed machine... +mdown=`echo $1 | tr '[A-Z]' '[a-z]'`; # The name of the downed machine... #ha_log "info: DEBUG: $0 -- taking resources for $mdown" ------------------------------ Message: 3 Date: Wed, 16 Aug 2006 03:59:34 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org 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 ccmmsg.c Log Message: only the leader of ccm calculates the quorum and broadcasts to other nodes. =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/membership/ccm/ccm.c,v retrieving revision 1.114 retrieving revision 1.115 diff -u -3 -r1.114 -r1.115 --- ccm.c 7 Jun 2006 08:29:52 -0000 1.114 +++ ccm.c 16 Aug 2006 09:59:34 -0000 1.115 @@ -19,10 +19,16 @@ #include "ccm.h" #include "ccmmsg.h" #include "ccmmisc.h" +#include <clplumbing/cl_plugin.h> +#include <clplumbing/cl_quorum.h> +#include <clplumbing/cl_tiebreaker.h> +#include <clplumbing/cl_misc.h> + extern state_msg_handler_t state_msg_handler[]; struct ha_msg * ccm_readmsg(ccm_info_t *info, ll_cluster_t *hb); +static GList* quorum_list = NULL; static struct ha_msg* ccm_handle_hbapiclstat(ccm_info_t *info, @@ -242,3 +248,78 @@ return TRUE; } +#define QUORUM_S "HA_quorum" +#define TIEBREAKER_S "HA_tiebreaker" +gboolean +ccm_calculate_quorum(ccm_info_t* info) +{ + struct hb_quorum_fns* funcs = NULL; + const char* quorum_env = NULL; + char* quorum_str = NULL; + char* end = NULL; + char* begin = NULL; + GList* cur = NULL; + int rc; + + + if (quorum_list == NULL){ + quorum_env = cl_get_env(QUORUM_S); + if (quorum_env == NULL){ + ccm_debug(LOG_DEBUG, "No quorum selected," + "using default quorum plugin(majority:twonodes)"); + quorum_str = cl_strdup("majority:twonodes"); + } + else { + quorum_str = cl_strdup(quorum_env); + } + + begin = quorum_str; + while (begin != NULL) { + end = strchr(begin, ':'); + if (end != NULL) { + *end = 0; + } + funcs = cl_load_plugin("quorum", begin); + if (funcs == NULL){ + ccm_log(LOG_ERR, "%s: loading plugin %s failed", + __FUNCTION__, begin); + } + else { + quorum_list = g_list_append(quorum_list, funcs); + } + begin = (end == NULL)? NULL:end+1; + } + cl_free(quorum_str); + } + + 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->cluster, info->memcount, mem_weight + , info->llm.nodecount, total_weight); + + if (rc == QUORUM_YES){ + return TRUE; + } + else if (rc == QUORUM_NO){ + return FALSE; + } + cur = g_list_next(cur); + } + ccm_debug(LOG_ERR, "all quorum plugins can't make a decision! " + "assume lost quorum"); + + return FALSE; + +} =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/membership/ccm/ccm.h,v retrieving revision 1.50 retrieving revision 1.51 diff -u -3 -r1.50 -r1.51 --- ccm.h 7 Jun 2006 08:29:52 -0000 1.50 +++ ccm.h 16 Aug 2006 09:59:34 -0000 1.51 @@ -1,4 +1,4 @@ -/* $Id: ccm.h,v 1.50 2006/06/07 08:29:52 zhenh Exp $ */ +/* $Id: ccm.h,v 1.51 2006/08/16 09:59:34 zhenh Exp $ */ /* * ccm.h: definitions Consensus Cluster Manager internal header * file @@ -71,7 +71,8 @@ #define CCM_COOKIE "ccmcookie" /* communication context */ #define CCM_NEWCOOKIE "ccmnewcookie" /* new communication context */ #define CCM_CLSIZE "ccmclsize" /* new cluster size */ -#define CCM_UPTIMELIST "ccmuptimelist" /*uptime list*/ +#define CCM_UPTIMELIST "ccmuptimelist" /*uptime list*/ +#define CCM_QUORUM "ccmquorum" /*do we have quorum?*/ /* ccm_types for easier processing. */ @@ -463,7 +464,7 @@ enum change_event_type change_type; char change_node_id[NODEIDSIZE]; char cluster[PATH_MAX]; - + int has_quorum; /* -1, not set, 0, no quorum, 1, has quorum */ } ccm_info_t; /* @@ -484,6 +485,8 @@ int jump_to_joining_state(ll_cluster_t* hb, ccm_info_t* info, struct ha_msg* msg); +gboolean ccm_calculate_quorum(ccm_info_t* info); + typedef void (*state_msg_handler_t)(enum ccm_type ccm_msg_type, struct ha_msg *reply, ll_cluster_t *hb, =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/membership/ccm/ccm_statemachine.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -3 -r1.21 -r1.22 --- ccm_statemachine.c 18 Jul 2006 12:25:05 -0000 1.21 +++ ccm_statemachine.c 16 Aug 2006 09:59:34 -0000 1.22 @@ -1,4 +1,4 @@ -/* $Id: ccm_statemachine.c,v 1.21 2006/07/18 12:25:05 zhenh Exp $ */ +/* $Id: ccm_statemachine.c,v 1.22 2006/08/16 09:59:34 zhenh Exp $ */ /* * ccm.c: Consensus Cluster Service Program * @@ -120,10 +120,12 @@ if (istate == CCM_STATE_JOINED){ gl_membership_converged =TRUE; } - + if (llm_get_myindex(CCM_GET_LLM(info)) == info->ccm_cluster_leader + && CCM_STATE_JOINED == istate) { + info->has_quorum = ccm_calculate_quorum(info); + } ccm_debug(LOG_DEBUG,"node state %s -> %s" , state2string(oldstate),state2string(istate)); - } @@ -332,6 +334,7 @@ CCM_SET_CL(info,-1); CCM_SET_JOINED_TRANSITION(info, 0); ccm_set_state(info, CCM_STATE_NONE, NULL); + info->has_quorum = -1; update_reset(CCM_GET_UPDATETABLE(info)); ccm_reset_all_join_request(info); version_reset(CCM_GET_VERSION(info)); @@ -812,6 +815,9 @@ cookie = ccm_generate_random_cookie(); repeat = 0; + ccm_mem_bitmapfill(info, bitmap); + bitmap_delete(bitmap); + while (ccm_send_final_memlist(hb, info, cookie, string, maxtrans+1) != HA_OK) { if(repeat < REPEAT_TIMES){ @@ -827,8 +833,6 @@ } /* fill my new memlist and update the new cookie if any */ - ccm_mem_bitmapfill(info, bitmap); - bitmap_delete(bitmap); /* increment the major transition number and reset the * minor transition number @@ -1663,6 +1667,7 @@ ccm_all_restart(hb, info, reply); break; case CCM_TYPE_MEM_LIST:{ + int quorum; const char* memlist; if (strncmp(orig, llm_get_mynodename((&info->llm) ), NODEIDSIZE) == 0){ /*this message is from myself, ignore it*/ @@ -1674,6 +1679,13 @@ break; } + if (ha_msg_value_int (reply, CCM_QUORUM, &quorum)==HA_OK){ + info->has_quorum = quorum; + } + else { + info->has_quorum = -1; + } + if (node_is_leader(info, orig) && !am_i_member_in_memlist(info, memlist)){ ccm_set_state(info, CCM_STATE_NONE, reply); @@ -2245,6 +2257,7 @@ uint curr_major, curr_minor; int indx; int repeat; + int quorum; if ((orig = ha_msg_value(reply, F_ORIG)) == NULL) { @@ -2534,6 +2547,13 @@ return; } trans_maxval = atoi(trans); + + if (ha_msg_value_int (reply, CCM_QUORUM, &quorum)==HA_OK){ + info->has_quorum = quorum; + } + else { + info->has_quorum = -1; + } if (!am_i_member_in_memlist(info, memlist)) { ccm_reset(info); @@ -3291,6 +3311,7 @@ uint trans_majorval=0,trans_minorval=0, uptime_val; uint curr_major, curr_minor; int repeat; + int quorum; if ((orig = ha_msg_value(reply, F_ORIG)) == NULL) { ccm_debug(LOG_WARNING, "ccm_state_wait_for_mem_list: received message " @@ -3375,6 +3396,13 @@ "geting uptie_list failed"); return; } + + if (ha_msg_value_int (reply, CCM_QUORUM, &quorum)==HA_OK){ + info->has_quorum = quorum; + } + else { + info->has_quorum = -1; + } ccm_mem_strfill(info, (const char *)memlist); CCM_SET_MAJORTRANS(info, curr_major+1); @@ -3566,6 +3594,7 @@ uint curr_major, curr_minor; int repeat; int ret; + int quorum; if ((orig = ha_msg_value(reply, F_ORIG)) == NULL) { ccm_debug(LOG_WARNING, "ccm_state_new_node_wait_for_mem_list: " @@ -3662,6 +3691,13 @@ return; } + if (ha_msg_value_int (reply, CCM_QUORUM, &quorum)==HA_OK){ + info->has_quorum = quorum; + } + else { + info->has_quorum = -1; + } + if (i_am_member(info) == FALSE){ version_reset(CCM_GET_VERSION(info)); ccm_set_state(info, CCM_STATE_NONE, reply); @@ -3864,12 +3900,14 @@ if(bornon[i].bornon==0) bornon[i].bornon=CCM_GET_MAJORTRANS(info); } + ccm_debug(LOG_DEBUG,"dump current membership"); leader = info->ccm_cluster_leader; ccm_debug(LOG_DEBUG,"\tleader=%s" , leader < 0 ?"none": info->llm.nodes[leader].nodename); ccm_debug(LOG_DEBUG,"\ttransition=%d", CCM_GET_MAJORTRANS(info)); ccm_debug(LOG_DEBUG,"\tstatus=%s",state2string(info->state)); + ccm_debug(LOG_DEBUG,"\thas_quorum=%d",info->has_quorum); for (i=0 ; i < ccm_get_memcount(info); i++) { nodename = llm_get_nodename(CCM_GET_LLM(info), @@ -3877,6 +3915,6 @@ ccm_debug(LOG_DEBUG,"\tnodename=%s bornon=%d", nodename, bornon[i].bornon); } - + return; } =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/membership/ccm/ccmclient.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -3 -r1.44 -r1.45 --- ccmclient.c 26 Jul 2006 07:55:49 -0000 1.44 +++ ccmclient.c 16 Aug 2006 09:59:34 -0000 1.45 @@ -1,4 +1,4 @@ -/* $Id: ccmclient.c,v 1.44 2006/07/26 07:55:49 zhenh Exp $ */ +/* $Id: ccmclient.c,v 1.45 2006/08/16 09:59:34 zhenh Exp $ */ /* * client.c: Consensus Cluster Client tracker * @@ -23,10 +23,6 @@ */ #include <ccm.h> #include <ccmlib.h> -#include <clplumbing/cl_plugin.h> -#include <clplumbing/cl_quorum.h> -#include <clplumbing/cl_tiebreaker.h> -#include <clplumbing/cl_misc.h> typedef struct ccm_client_s { int ccm_clid; @@ -54,7 +50,6 @@ static gboolean membership_ready = FALSE; static void refresh_llm_msg(llm_info_t *llm); -static GList* quorum_list = NULL; /* * the fully initialized clients. @@ -294,80 +289,13 @@ } -#define QUORUM_S "HA_quorum" -#define TIEBREAKER_S "HA_tiebreaker" - static gboolean get_quorum(ccm_info_t* info) { - struct hb_quorum_fns* funcs = NULL; - const char* quorum_env = NULL; - char* quorum_str = NULL; - char* end = NULL; - char* begin = NULL; - GList* cur = NULL; - int rc; - - if (quorum_list == NULL){ - quorum_env = cl_get_env(QUORUM_S); - if (quorum_env == NULL){ - ccm_debug(LOG_DEBUG, "No quorum selected," - "using default quorum plugin(majority:twonodes)"); - quorum_str = cl_strdup("majority:twonodes"); - } - else { - quorum_str = cl_strdup(quorum_env); - } - - begin = quorum_str; - while (begin != NULL) { - end = strchr(begin, ':'); - if (end != NULL) { - *end = 0; - } - funcs = cl_load_plugin("quorum", begin); - if (funcs == NULL){ - ccm_log(LOG_ERR, "%s: loading plugin %s failed", - __FUNCTION__, begin); - } - else { - quorum_list = g_list_append(quorum_list, funcs); - } - begin = (end == NULL)? NULL:end+1; - } - cl_free(quorum_str); + if (info->has_quorum != -1) { + return info->has_quorum; } - - 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->cluster, info->memcount, mem_weight - , info->llm.nodecount, total_weight); - - if (rc == QUORUM_YES){ - return TRUE; - } - else if (rc == QUORUM_NO){ - return FALSE; - } - cur = g_list_next(cur); - } - ccm_debug(LOG_ERR, "all quorum plugins can't make a decision! " - "assume lost quorum"); - - return FALSE; - + return ccm_calculate_quorum(info); } static void =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/membership/ccm/ccmmsg.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- ccmmsg.c 17 Feb 2006 05:48:24 -0000 1.10 +++ ccmmsg.c 16 Aug 2006 09:59:34 -0000 1.11 @@ -19,6 +19,10 @@ #include "ccmmisc.h" #include <config.h> #include <ha_config.h> +#include <clplumbing/cl_plugin.h> +#include <clplumbing/cl_quorum.h> +#include <clplumbing/cl_tiebreaker.h> + #include <clplumbing/cl_signal.h> #include <clplumbing/coredumps.h> int ccm_send_cluster_msg(ll_cluster_t* hb, struct ha_msg* msg); @@ -314,13 +318,15 @@ ha_msg_del(m); return(rc); } + + int ccm_send_final_memlist(ll_cluster_t *hb, ccm_info_t *info, char *newcookie, char *finallist, uint32_t max_tran) -{ +{ struct ha_msg *m = ccm_create_msg(info, CCM_TYPE_FINAL_MEMLIST); char activeproto[3]; char maxtrans[15]; @@ -336,11 +342,12 @@ info->ccm_active_proto); snprintf(maxtrans, sizeof(maxtrans), "%d", max_tran); assert(finallist); - + info->has_quorum = ccm_calculate_quorum(info); if (ha_msg_add(m, CCM_MAXTRANS, maxtrans) == HA_FAIL || ha_msg_add(m, CCM_MEMLIST, finallist) == HA_FAIL - ||(!newcookie? FALSE: (ha_msg_add(m, CCM_NEWCOOKIE, newcookie) - ==HA_FAIL))) { + || ha_msg_add_int(m, CCM_QUORUM, info->has_quorum) == HA_FAIL + ||(!newcookie?FALSE:(ha_msg_add(m,CCM_NEWCOOKIE,newcookie) + ==HA_FAIL))) { ccm_log(LOG_ERR, "ccm_send_final_memlist: Cannot create " "FINAL_MEMLIST message"); rc = HA_FAIL; @@ -539,8 +546,10 @@ snprintf(activeproto, sizeof(activeproto), "%d", info->ccm_active_proto); + info->has_quorum = ccm_calculate_quorum(info); if ( ha_msg_add(m, CCM_MEMLIST, memlist) == HA_FAIL - || cl_msg_add_list_int(m, CCM_UPTIMELIST, uptime_list, uptime_size) + || ha_msg_add_int(m, CCM_QUORUM, info->has_quorum) == HA_FAIL + || cl_msg_add_list_int(m, CCM_UPTIMELIST, uptime_list, uptime_size) == HA_FAIL || !newcookie? FALSE: (ha_msg_add(m, CCM_NEWCOOKIE, newcookie) ==HA_FAIL)) { ------------------------------ _______________________________________________ Linux-ha-cvs mailing list Linux-ha-cvs@lists.linux-ha.org http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs End of Linux-ha-cvs Digest, Vol 33, Issue 70 ********************************************