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

[Cluster-devel] [PATCH] merge cman and qdisk init scripts into cman



Hi Lon,

on your suggestion... do $subject.

Also make sure to start qdisk only if we need to (via ccs_tool query).

Fabio
diff --git a/cman/init.d/Makefile b/cman/init.d/Makefile
index 554aa75..c7a226b 100644
--- a/cman/init.d/Makefile
+++ b/cman/init.d/Makefile
@@ -1,26 +1,19 @@
-TARGET1=cman
-TARGET2=qdiskd
+TARGET=cman
 
-INITDT=$(TARGET1) $(TARGET2)
+INITDT=$(TARGET)
 
-all: $(TARGET1) $(TARGET2)
+all: $(TARGET)
 
 include ../../make/defines.mk
 include $(OBJDIR)/make/clean.mk
 include $(OBJDIR)/make/install.mk
 include $(OBJDIR)/make/uninstall.mk
 
-$(TARGET1): $(S)/$(TARGET1).in
-	cat $(S)/$(TARGET1).in | sed \
+$(TARGET): $(S)/$(TARGET).in
+	cat $(S)/$(TARGET).in | sed \
 		-e 's# SBINDIR@#${sbindir}#g' \
 		-e 's# INITDDIR@#${initddir}#g' \
 		-e 's# NOTIFYDDIR@#${notifyddir}#g' \
-	> $(TARGET1)
-
-$(TARGET2): $(S)/$(TARGET2).in
-	cat $(S)/$(TARGET2).in | sed \
-		-e 's# SBINDIR@#${sbindir}#g' \
-		-e 's# INITDDIR@#${initddir}#g' \
-	> $(TARGET2)
+	> $(TARGET)
 
 clean: generalclean
diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in
index bbaec7a..399c17f 100644
--- a/cman/init.d/cman.in
+++ b/cman/init.d/cman.in
@@ -225,27 +225,10 @@ unfence_self()
 
 start_qdiskd()
 {
-    declare current_runlevel
-
-    current_runlevel=$(/sbin/runlevel 2>/dev/null | awk '{ print $2 }' 2>/dev/null)
-    #
-    # Start qdiskd before fenced to resolve bug #436381.  This only
-    # happens if qdiskd is configured to run in the runlevel we are in
-    #
-    chkconfig --levels "$current_runlevel" qdiskd 2>/dev/null
-    if [ $? -ne 0 ]; then
-        # qdiskd doesn't start at this runlevel.
-        return 0
-    fi
-
-    echo -n "   Starting qdiskd... "
-    service qdiskd start > /dev/null 2>&1
-    if [ $? -eq 0 ] 
-    then
-	echo "done"
-    else
-	echo "failed"
-	return 1
+    status qdiskd > /dev/null 2>&1
+    if [ $? -ne 0 ] && \
+	ccs_tool query /cluster/quorumd >/dev/null 2>&1; then
+	errmsg=$( @SBINDIR@/qdiskd -Q 2>&1 ) || return 1
     fi
     return 0
 }
@@ -495,7 +478,15 @@ start()
         return 1
     fi
 
+    echo -n "   Starting qdiskd... "
     start_qdiskd
+    if [ $? -eq 0 ]
+    then
+	echo "done"
+    else
+	echo "failed"
+	return 1
+    fi
 
     echo -n "   Starting daemons... "
     start_daemons
@@ -585,6 +576,23 @@ stop_cmannotifyd()
     return 0
 }
 
+stop_qdiskd()
+{
+    echo -n "Stopping the Quorum Disk Daemon: "
+    pid="$(pidof qdiskd)"
+    while [ -n "$pid" ] && [ $retries -lt 5 ]; do
+	kill $pid 2>&1
+	sleep 1
+	((retries++))
+	pid="$(pidof qdiskd)"
+    done
+    if [ -z "$(pidof qdiskd)" ]; then
+	return 0
+    else
+	return 1
+    fi
+}
+
 stop_fence()
 {
     if pidof fenced > /dev/null 2>&1
@@ -646,6 +654,16 @@ stop()
 	return 1
     fi
 
+    echo -n "Stopping the Quorum Disk Daemon: "
+    stop_qdiskd
+    if [ $? -eq 0 ]
+    then
+	echo "done"
+    else
+	echo "failed"
+	return 1
+    fi
+
     echo -n "   Stopping cman... "
     if [ $1 ]; then
 	stop_cman $1

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