From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiaju Zhang Date: Fri, 14 May 2010 13:33:15 +0800 Subject: [Cluster-devel] [PATCH] dlm_controld.pcmk: Fix membership change judging issue In-Reply-To: References: <20100513084926.GA30727@linux-jjzhang> <20100513095117.GM20952@suse.de> Message-ID: <20100514053314.GA17468@linux-jjzhang> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Fri, May 14, 2010 at 12:08:25PM +0800, Jiaju Zhang wrote: > Both update_cluster and process_cluster can't be removed. Yes, moving > the place of ais_dispatch should have nothing to do with this issue. > Oh, this is because I added it in the debugging stage and forgot to > remove it in the final version, just sending the working version to > the list, sorry, I'll posted an updated patch soon ;-) > This is the updated version of this patch, thanks a lot for your review and comments ;-) Thanks, Jiaju Signed-off-by: Jiaju Zhang --- group/dlm_controld/pacemaker.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/group/dlm_controld/pacemaker.c b/group/dlm_controld/pacemaker.c index 3150a1f..0c30c5a 100644 --- a/group/dlm_controld/pacemaker.c +++ b/group/dlm_controld/pacemaker.c @@ -102,6 +102,14 @@ void close_cluster(void) { #include #include +static gboolean is_member(const crm_node_t *node) +{ + if(node && safe_str_eq(node->state, CRM_NODE_MEMBER)) + return TRUE; + + return FALSE; +} + void dlm_process_node(gpointer key, gpointer value, gpointer user_data) { int rc = 0; @@ -119,7 +127,7 @@ void dlm_process_node(gpointer key, gpointer value, gpointer user_data) snprintf(path, PATH_MAX, "%s/%d", COMMS_DIR, node->id); rc = stat(path, &tmp); - is_active = crm_is_member_active(node); + is_active = is_member(node); if(rc == 0 && is_active) { /* nothing to do? @@ -212,7 +220,7 @@ void dlm_process_node(gpointer key, gpointer value, gpointer user_data) } log_debug("%s %sctive node %u '%s': born-on=%llu, last-seen=%llu, this-event=%llu, last-event=%llu", - action, crm_is_member_active(value)?"a":"ina", + action, is_member(value)?"a":"ina", node->id, node->uname, node->born, node->last_seen, crm_peer_seq, (unsigned long long)*last); } @@ -220,7 +228,7 @@ void dlm_process_node(gpointer key, gpointer value, gpointer user_data) int is_cluster_member(uint32_t nodeid) { crm_node_t *node = crm_get_peer(nodeid, NULL); - return crm_is_member_active(node); + return is_member(node); } char *nodeid2name(int nodeid) {