dlm: master - dlm_controld: fix stonith calls

David Teigland teigland at fedoraproject.org
Wed Feb 22 20:39:34 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=eeb80cd73160856a16f73fc45d1ab48904aa55f0
Commit:        eeb80cd73160856a16f73fc45d1ab48904aa55f0
Parent:        2ad89c869cbd6338361ccf25f7c84c719d88e5a9
Author:        David Teigland <teigland at redhat.com>
AuthorDate:    Wed Feb 22 14:37:52 2012 -0600
Committer:     David Teigland <teigland at redhat.com>
CommitterDate: Wed Feb 22 14:38:56 2012 -0600

dlm_controld: fix stonith calls

and handle errors

Signed-off-by: David Teigland <teigland at redhat.com>
---
 dlm_controld/cpg.c        |   21 +++++++++++++++------
 dlm_controld/dlm_daemon.h |    2 +-
 dlm_controld/fence.c      |   20 +++++++++-----------
 3 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/dlm_controld/cpg.c b/dlm_controld/cpg.c
index ced912f..1360493 100644
--- a/dlm_controld/cpg.c
+++ b/dlm_controld/cpg.c
@@ -618,8 +618,10 @@ static int check_fencing_done(struct lockspace *ls)
 		   fenced since node->start_time */
 
 		rv = fence_node_time(node->nodeid, &last_fenced_time);
-		if (rv < 0)
-			log_error("fenced_node_info error %d", rv);
+		if (rv < 0) {
+			log_error("fenced_node_time error %d", rv);
+			continue;
+		}
 
 		/* fenced gives us real time */
 
@@ -653,8 +655,10 @@ static int check_fencing_done(struct lockspace *ls)
 		}
 	}
 
-	if (wait_count)
+	if (wait_count) {
+		log_group(ls, "check_fencing wait_count %d", wait_count);
 		return 0;
+	}
 
 	/* now check if there are any outstanding fencing ops (for nodes
 	   we may not have seen in any lockspace), and return 0 if there
@@ -666,8 +670,10 @@ static int check_fencing_done(struct lockspace *ls)
 		return 0;
 	}
 
-	if (in_progress)
+	if (in_progress) {
+		log_group(ls, "check_fencing in progress %d", in_progress);
 		return 0;
+	}
 
 	log_group(ls, "check_fencing done");
 	return 1;
@@ -694,12 +700,15 @@ static int need_fencing(struct lockspace *ls)
 static void request_fencing(struct lockspace *ls)
 {
 	struct node *node;
+	int rv;
 
 	list_for_each_entry(node, &ls->node_history, list) {
 		if (!node->request_fencing)
 			continue;
-		fence_request(node->nodeid);
-		node->request_fencing = 0;
+		log_group(ls, "fence_request %d", node->nodeid);
+		rv = fence_request(node->nodeid);
+		if (!rv)
+			node->request_fencing = 0;
 	}
 }
 
diff --git a/dlm_controld/dlm_daemon.h b/dlm_controld/dlm_daemon.h
index 3899550..5fca041 100644
--- a/dlm_controld/dlm_daemon.h
+++ b/dlm_controld/dlm_daemon.h
@@ -348,7 +348,7 @@ void process_cluster_cfg(int ci);
 void kick_node_from_cluster(int nodeid);
 
 /* fence.c */
-void fence_request(int nodeid);
+int fence_request(int nodeid);
 int fence_node_time(int nodeid, uint64_t *last_fenced_time);
 int fence_in_progress(int *count);
 
diff --git a/dlm_controld/fence.c b/dlm_controld/fence.c
index f91d9de..50b7d4d 100644
--- a/dlm_controld/fence.c
+++ b/dlm_controld/fence.c
@@ -7,30 +7,28 @@
  */
 
 #include "dlm_daemon.h"
-#ifdef STONITH
 #include <pacemaker/crm/stonith-ng.h>
-#endif
 
-void fence_request(int nodeid)
+int fence_request(int nodeid)
 {
-#ifdef STONITH
 	int rv;
-	rv = stonith_api_kick_cs_helper(nodeid, 300, 1);
-	if (rv)
-		log_error("stonith_api_kick_cs_helper %d error %d", nodeid, rv);
-#endif
+	rv = stonith_api_kick_helper(nodeid, 300, 1);
+	if (rv) {
+		log_error("stonith_api_kick_helper %d error %d", nodeid, rv);
+		return rv;
+	}
+	return 0;
 }
 
 int fence_node_time(int nodeid, uint64_t *last_fenced_time)
 {
-#ifdef STONITH
-	*last_fenced_time = stonith_api_time_cs_helper(nodeid, 0);
-#endif
+	*last_fenced_time = stonith_api_time_helper(nodeid, 0);
 	return 0;
 }
 
 int fence_in_progress(int *count)
 {
+	*count = 0;
 	return 0;
 }
 


More information about the cluster-commits mailing list