cluster/rgmanager/src/resources apache.metadat ...
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
rgmanager/src/resources/apache.metadata +9 -0
@@ -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">
rgmanager/src/resources/apache.sh +1 -1
@@ -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
rgmanager/src/resources/mysql.metadata +10 -0
@@ -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
rgmanager/src/resources/mysql.sh +1 -1
@@ -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
rgmanager/src/resources/openldap.metadata +10 -0
@@ -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
rgmanager/src/resources/openldap.sh +1 -1
@@ -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
rgmanager/src/resources/postgres-8.metadata +10 -0
@@ -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
rgmanager/src/resources/postgres-8.sh +1 -1
@@ -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
rgmanager/src/resources/samba.metadata +10 -0
@@ -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
rgmanager/src/resources/samba.sh +1 -1
@@ -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
rgmanager/src/resources/utils/messages.sh +6 -0
@@ -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"
rgmanager/src/resources/utils/ra-skelet.sh +21 -1
@@ -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; }