[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Cluster-devel] [PATCH] dlm_controld.pcmk: Fix membership change judging issue



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 <jjzhang linux gmail com>
---
 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 <arpa/inet.h>
 #include <corosync/totem/totemip.h>
 
+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) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]