cluster: RHEL6 - cman init: fix start sequence error handling

Fabio M. Di Nitto fabbione at fedoraproject.org
Fri Mar 30 08:27:45 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=ff280bc349cb7ce973aaab1f1a3dd1b289dff711
Commit:        ff280bc349cb7ce973aaab1f1a3dd1b289dff711
Parent:        662f23bf7316e892de7922b7cec37e0407dab738
Author:        Fabio M. Di Nitto <fdinitto at redhat.com>
AuthorDate:    Fri Mar 30 09:58:36 2012 +0200
Committer:     Fabio M. Di Nitto <fdinitto at redhat.com>
CommitterDate: Fri Mar 30 10:26:58 2012 +0200

cman init: fix start sequence error handling

Any daemon that fails to start would leave no traces.

the problem with cman init is that we need to handle multiple daemons
and tools. If one in the chain fails, we never reverted to the original
state of the system. This can indeed cause other issues.

Fix the init script to "stop" cman if any error happens during "start.

Resolves: rhbz#806002

Reviewed-by: Christine Caulfield <ccaulfie at redhat.com>
Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>
---
 cman/init.d/cman.in |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in
index 48fab3c..1268b59 100644
--- a/cman/init.d/cman.in
+++ b/cman/init.d/cman.in
@@ -19,6 +19,9 @@
 # set secure PATH
 PATH="/bin:/usr/bin:/sbin:/usr/sbin:@SBINDIR@"
 
+# save invokation for rollback ops
+thisinvokation="$0"
+
 local_chkconfig()
 {
 	case "$1" in
@@ -183,6 +186,9 @@ nok() {
 	echo -e "$errmsg"
 	failure
 	echo
+	if [ "$currentaction" = "start" ]; then
+		$thisinvokation stop
+	fi
 	exit 1
 }
 
@@ -695,6 +701,7 @@ leave_fence_domain()
 
 start()
 {
+	currentaction="start"
 	breakpoint="$1"
 
 	sshd_enabled && service sshd start


More information about the cluster-commits mailing list