[Cluster-devel] unfencing

David Teigland teigland at redhat.com
Thu Feb 26 21:35:44 UTC 2009


On Fri, Feb 20, 2009 at 03:44:32PM -0600, David Teigland wrote:
> init.d/cman would run:
> 	cman_tool join
> 	fence_node -U <ourname>

How does this look?  I'm not up on the ins and outs of init scripts.
In the common case, no unfencing will happen, and nothing is printed.
If unfencing is defined and fails, the whole script exits with failure.
That's important for fence_scsi, but not necessarily for other forms
of unfencing... should we make that behavior conditional on fence_scsi?


diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in
index 9303a0b..b8303cb 100644
--- a/cman/init.d/cman.in
+++ b/cman/init.d/cman.in
@@ -236,6 +236,25 @@ start_cman()
     return 0
 }
 
+unfence_self()
+{
+    fence_node -U > /dev/null 2>&1
+    error=$?
+
+    if [ $error -eq 0 ]
+    then
+        echo "   Unfencing self... done"
+        return 0
+    else
+        if [ $error -eq 1 ]
+        then
+            echo "   Unfencing self... failed"
+            return 1
+        else
+            return 0
+        fi
+    fi
+}
 
 start_qdiskd()
 {
@@ -502,6 +521,12 @@ start()
 	return 1
     fi
 
+    unfence_self
+    if [ $? -eq 1 ]
+    then
+        return 1
+    fi
+
     start_qdiskd
 
     echo -n "   Starting daemons... "




More information about the Cluster-devel mailing list