Hi Kazutomo-san,

On Mon, Jun 14, 2010 at 10:48:03AM +0900, NAKAHIRA Kazutomo wrote:
> Hi, all
> 
> I refined a sfex RA to speed up start/stop process of the sfex.
> 
> An attached patch modify static "sleep 2/4" in a sfex RA.
> Please see attached and comment me if there are any suggestions.

Patch applied. I just changed wording in some log messages.

Cheers,

Dejan

> Best regards,
> NAKAHIRA Kazutomo
> 
> -- 
> NTT Open Source Software Center
> Infrastructure Software Technology Unit

> # HG changeset patch
> # User NAKAHIRA Kazutomo <[email protected]>
> # Date 1276475594 -32400
> # Node ID a4627a7bbf3d1efdb2fd3742100128297179ffd9
> # Parent  cbd80d4017c85878017c2651149e2ba23691ce17
> sfex RA: Refine sfex_daemon start-up/shutodown method.
> 
> diff -r cbd80d4017c8 -r a4627a7bbf3d heartbeat/sfex
> --- a/heartbeat/sfex  Tue Jun 08 20:07:16 2010 +0200
> +++ b/heartbeat/sfex  Mon Jun 14 09:33:14 2010 +0900
> @@ -133,12 +133,16 @@
>               return $OCF_ERR_GENERIC
>       fi
>       
> -     sleep 2
> -     sfex_monitor
> -     if [ $? -eq $OCF_SUCCESS ]; then
> -             ocf_log info "sfex_daemon: started."
> -             return $OCF_SUCCESS
> -     fi
> +     while :
> +     do
> +             sfex_monitor
> +             if [ $? -eq $OCF_SUCCESS ]; then
> +                     ocf_log info "sfex_daemon: started."
> +                     return $OCF_SUCCESS
> +             fi
> +             ocf_log debug "Waiting for the start-up of the sfex_daemon..."
> +             sleep 1
> +     done
>       ocf_log err "Can't find a sfex_daemon process. Starting a sfex_daemon 
> failed."
>       return $OCF_ERR_GENERIC
>  }
> @@ -168,13 +172,36 @@
>  #sfex could be in state D if the device is gone, and then not terminate.     
>  #Wait and check again if the daemon is already properly shutdown.
>  
> -     sleep 4
> +     shutdown_timeout=$((($OCF_RESKEY_CRM_meta_timeout/1000)-5))
> +     count=0
> +     while [ $count -lt $shutdown_timeout ]
> +     do
> +             sfex_monitor
> +             if [ $? -eq $OCF_NOT_RUNNING ]; then
> +                     ocf_log info "sfex_daemon: stopped."
> +                     return $OCF_SUCCESS
> +             fi
> +             count=`expr $count + 1`
> +             ocf_log debug "Waiting for the shutdown of the 
> sfex_daemon($count/$shutdown_timeout)."
> +             sleep 1
> +     done
> +     
>       sfex_monitor
> -     rc=$?
> -     if [ $rc -ne $OCF_NOT_RUNNING ]; then
> -             ocf_log err "sfex_daemon failed to stop"
> -             return $rc
> +     if [ $? -ne $OCF_NOT_RUNNING ]; then
> +             ocf_log warn "Waiting for the shutdown of the sfex_daemon is 
> time-out. Now stopping sfex_daemon using SIGKILL."
> +             /bin/kill -s KILL $pid
>       fi
> +
> +     while :
> +     do
> +             sfex_monitor
> +             if [ $? -eq $OCF_NOT_RUNNING ]; then
> +                     break;
> +             fi
> +             ocf_log debug "Waiting for the kill -KILL of the sfex_daemon."
> +             sleep 1
> +     done
> +
>       ocf_log info "sfex_daemon: stopped."
>       return $OCF_SUCCESS
>  }

> _______________________________________________________
> Linux-HA-Dev: [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/

_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to