cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: mgrac@sourceware.org <mgrac@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/rgmanager/src/resources apache.metadat ...
Date: 29 Sep 2006 10:44:11 -0000	[thread overview]
Message-ID: <20060929104411.18524.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	mgrac at sourceware.org	2006-09-29 10:44:09

Modified files:
	rgmanager/src/resources: apache.metadata apache.sh 
	                         mysql.metadata mysql.sh 
	                         openldap.metadata openldap.sh 
	                         postgres-8.metadata postgres-8.sh 
	                         samba.metadata samba.sh 
	rgmanager/src/resources/utils: messages.sh ra-skelet.sh 

Log message:
	Some application needs time until they stop all theirs processes, so we have to wait a few moments until main/parent process is finished. This patch adds an option 'shutdown_wait' for each application's RA.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/apache.metadata.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/apache.sh.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/mysql.metadata.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/mysql.sh.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/openldap.metadata.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/openldap.sh.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/postgres-8.metadata.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/postgres-8.sh.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/samba.metadata.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/samba.sh.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/utils/messages.sh.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/utils/ra-skelet.sh.diff?cvsroot=cluster&r1=1.3&r2=1.4

--- cluster/rgmanager/src/resources/apache.metadata	2006/09/20 08:07:04	1.2
+++ cluster/rgmanager/src/resources/apache.metadata	2006/09/29 10:44:09	1.3
@@ -50,6 +50,15 @@
 		<content type="string" />
 	</parameter>
 
+	<parameter name="shutdown_wait">
+		<longdesc lang="en">
+			Wait X seconds for correct end of service shutdown
+		</longdesc>
+		<shortdesc lang="en">
+			Wait X seconds for correct end of service shutdown
+		</shortdesc>
+		<content type="number" />
+	</parameter>
 
         <parameter name="service_name" inherit="service%name">
             <longdesc lang="en">
--- cluster/rgmanager/src/resources/apache.sh	2006/09/26 23:59:14	1.6
+++ cluster/rgmanager/src/resources/apache.sh	2006/09/29 10:44:09	1.7
@@ -210,7 +210,7 @@
 {
 	clog_service_stop $CLOG_INIT
 
-	stop_generic "$APACHE_pid_file"
+	stop_generic "$APACHE_pid_file" "$OCF_RESKEY_shutdown_wait"
 	
 	if [ $? -ne 0 ]; then
 		clog_service_stop $CLOG_FAILED
--- cluster/rgmanager/src/resources/mysql.metadata	2006/09/20 08:15:01	1.2
+++ cluster/rgmanager/src/resources/mysql.metadata	2006/09/29 10:44:09	1.3
@@ -51,6 +51,16 @@
 		<content type="string" />
 	</parameter>
 
+	<parameter name="shutdown_wait">
+		<longdesc lang="en">
+			Wait X seconds for correct end of service shutdown
+		</longdesc>
+		<shortdesc lang="en">
+			Wait X seconds for correct end of service shutdown
+		</shortdesc>
+		<content type="number" />
+	</parameter>
+
         <parameter name="service_name" inherit="service%name">
             <longdesc lang="en">
 	    	Inherit the service name.  We need to know
--- cluster/rgmanager/src/resources/mysql.sh	2006/09/26 23:59:14	1.6
+++ cluster/rgmanager/src/resources/mysql.sh	2006/09/29 10:44:09	1.7
@@ -144,7 +144,7 @@
 {
 	clog_service_stop $CLOG_INIT
 
-	stop_generic "$MYSQL_pid_file"
+	stop_generic "$MYSQL_pid_file" "$OCF_RESKEY_shutdown_wait"
 	
 	if [ $? -ne 0 ]; then
 		clog_service_stop $CLOG_FAILED
--- cluster/rgmanager/src/resources/openldap.metadata	2006/09/14 12:22:32	1.1
+++ cluster/rgmanager/src/resources/openldap.metadata	2006/09/29 10:44:09	1.2
@@ -54,6 +54,16 @@
 		<content type="string" />
 	</parameter>
 
+	<parameter name="shutdown_wait">
+		<longdesc lang="en">
+			Wait X seconds for correct end of service shutdown
+		</longdesc>
+		<shortdesc lang="en">
+			Wait X seconds for correct end of service shutdown
+		</shortdesc>
+		<content type="number" />
+	</parameter>
+
         <parameter name="service_name" inherit="service%name">
             <longdesc lang="en">
 	    	Inherit the service name.  We need to know
--- cluster/rgmanager/src/resources/openldap.sh	2006/09/26 23:59:14	1.4
+++ cluster/rgmanager/src/resources/openldap.sh	2006/09/29 10:44:09	1.5
@@ -178,7 +178,7 @@
 {
 	clog_service_stop $CLOG_INIT
 
-	stop_generic "$LDAP_pid_file"
+	stop_generic "$LDAP_pid_file" "$OCF_RESKEY_shutdown_wait"
 	
 	if [ $? -ne 0 ]; then
 		clog_service_stop $CLOG_FAILED
--- cluster/rgmanager/src/resources/postgres-8.metadata	2006/09/20 07:14:54	1.1
+++ cluster/rgmanager/src/resources/postgres-8.metadata	2006/09/29 10:44:09	1.2
@@ -51,6 +51,16 @@
 		<content type="string" />
 	</parameter>
 
+	<parameter name="shutdown_wait">
+		<longdesc lang="en">
+			Wait X seconds for correct end of service shutdown
+		</longdesc>
+		<shortdesc lang="en">
+			Wait X seconds for correct end of service shutdown
+		</shortdesc>
+		<content type="number" />
+	</parameter>
+
         <parameter name="service_name" inherit="service%name">
             <longdesc lang="en">
 	    	Inherit the service name.  We need to know
--- cluster/rgmanager/src/resources/postgres-8.sh	2006/09/26 23:59:14	1.2
+++ cluster/rgmanager/src/resources/postgres-8.sh	2006/09/29 10:44:09	1.3
@@ -163,7 +163,7 @@
 {
 	clog_service_stop $CLOG_INIT
 
-	stop_generic "$PSQL_pid_file"	
+	stop_generic "$PSQL_pid_file" "$OCF_RESKEY_shutdown_wait"
 	if [ $? -ne 0 ]; then
 		clog_service_stop $CLOG_FAILED
 		return $OCF_ERR_GENERIC
--- cluster/rgmanager/src/resources/samba.metadata	2006/09/26 23:18:44	1.1
+++ cluster/rgmanager/src/resources/samba.metadata	2006/09/29 10:44:09	1.2
@@ -50,6 +50,16 @@
 		<content type="string" />
 	</parameter>
 
+	<parameter name="shutdown_wait">
+		<longdesc lang="en">
+			Wait X seconds for correct end of service shutdown
+		</longdesc>
+		<shortdesc lang="en">
+			Wait X seconds for correct end of service shutdown
+		</shortdesc>
+		<content type="number" />
+	</parameter>
+
         <parameter name="service_name" inherit="service%name">
             <longdesc lang="en">
 	    	Inherit the service name.  We need to know
--- cluster/rgmanager/src/resources/samba.sh	2006/09/26 23:59:14	1.2
+++ cluster/rgmanager/src/resources/samba.sh	2006/09/29 10:44:09	1.3
@@ -166,7 +166,7 @@
 {
 	clog_service_stop $CLOG_INIT
 
-	stop_generic "$SAMBA_smbd_pid_file"
+	stop_generic "$SAMBA_smbd_pid_file" "$OCF_RESKEY_shutdown_wait"
 	
 	if [ $? -ne 0 ]; then
 		clog_service_stop $CLOG_FAILED
--- cluster/rgmanager/src/resources/utils/messages.sh	2006/09/26 23:12:38	1.2
+++ cluster/rgmanager/src/resources/utils/messages.sh	2006/09/29 10:44:09	1.3
@@ -74,6 +74,9 @@
 		$CLOG_FAILED)
 			ocf_log error "Stopping Service $OCF_RESOURCE_INSTANCE > Failed"
 			;;
+		$CLOG_FAILED_NOT_STOPPED)
+			ocf_log error "Stopping Service $OCF_RESOURCE_INSTANCE > Failed - Application Is Still Running"
+			;;
 	esac
 	return 0
 }
@@ -115,6 +118,9 @@
 		$CLOG_SUCCEED)
 			ocf_log debug "Verifying Configuration Of $OCF_RESOURCE_INSTANCE > Succeed"
 			;;
+		$CLOG_FAILED_NOT_CHILD)
+			ocf_log error "Service $OCF_RESOURCE_INSTANCE Is Not A Child Of A Service"
+			;;
 		$CLOG_FAILED)
 			if [ "x$2" = "x" ]; then
 				ocf_log error "Verifying Configuration Of $OCF_RESOURCE_INSTANCE > Failed"
--- cluster/rgmanager/src/resources/utils/ra-skelet.sh	2006/09/20 07:14:55	1.3
+++ cluster/rgmanager/src/resources/utils/ra-skelet.sh	2006/09/29 10:44:09	1.4
@@ -46,17 +46,37 @@
 stop_generic()
 {
 	declare pid_file="$1"
+	declare kill_timeout="$2"
+	declare pid;
+	declare count=0;
 
 	if [ ! -e "$pid_file" ]; then
 		clog_check_file_exist $CLOG_FAILED_NOT_FOUND "$pid_file"
 		return $OCF_ERR_GENERIC
 	fi
 
-	kill -TERM `cat "$pid_file"`
+	if [ -z "$kill_timeout" ]; then
+		kill_timeout=20
+	fi
+
+	read pid < "$pid_file"
+
+	kill -TERM "$pid"
 
 	if [ $? -ne 0 ]; then
 		return $OCF_ERR_GENERIC
 	fi
+
+	until [ `ps --pid "$pid" &> /dev/null; echo $?` = '1' ] || [ $count -gt $kill_timeout ]
+	do
+		sleep 1
+		let count=$count+1
+	done
+
+	if [ $count -gt $kill_timeout ]; then
+		clog_service_stop $CLOG_FAILED_NOT_STOPPED
+		return $OCF_ERR_GENERIC
+	fi
 	
 	return 0;
 }



             reply	other threads:[~2006-09-29 10:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-29 10:44 mgrac [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-04-05 15:08 [Cluster-devel] cluster/rgmanager/src/resources apache.metadat lhh
2007-04-23 13:07 ` Simone Gotti
2007-04-27 17:56   ` Lon Hohberger
2006-10-10 13:57 mgrac
2006-09-20  8:07 mgrac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060929104411.18524.qmail@sourceware.org \
    --to=mgrac@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).