From mboxrd@z Thu Jan 1 00:00:00 1970 From: mgrac@sourceware.org Date: 29 Sep 2006 10:44:11 -0000 Subject: [Cluster-devel] cluster/rgmanager/src/resources apache.metadat ... Message-ID: <20060929104411.18524.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 @@ + + + Wait X seconds for correct end of service shutdown + + + Wait X seconds for correct end of service shutdown + + + --- 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 @@ + + + Wait X seconds for correct end of service shutdown + + + Wait X seconds for correct end of service shutdown + + + + 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 @@ + + + Wait X seconds for correct end of service shutdown + + + Wait X seconds for correct end of service shutdown + + + + 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 @@ + + + Wait X seconds for correct end of service shutdown + + + Wait X seconds for correct end of service shutdown + + + + 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 @@ + + + Wait X seconds for correct end of service shutdown + + + Wait X seconds for correct end of service shutdown + + + + 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; }