Hi Mahesh,

There is a case the saClmInitialize() returns SA_AIS_ERR_TIMEOUT or
SA_AIS_ERR_NO_RESOURCES after headless state.
Without the patch, the cpnd exits immediately in case these fault code
returned. After 2 times restart, this leads the node reboot.

With this patch, the cpnd can retry for more times. This will reduces the
chance of node reboot.

Best regards,
Nhat Pham

-----Original Message-----
From: A V Mahesh [mailto:mahesh.va...@oracle.com]
Sent: Wednesday, May 11, 2016 1:55 PM
To: Nhat Pham <nhat.p...@dektech.com.au>; anders.wid...@ericsson.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1 of 1] cpnd: To improve handling fault code returned by
saClmInitialize [#1821]


Hi Nhat Pham,

Can please share issue observed and addressed,   before and after this
improvement patch.

-AVM

On 5/11/2016 11:32 AM, Nhat Pham wrote:
>   osaf/services/saf/cpsv/cpnd/cpnd_init.c |  27
+++++++++++++++++++++------
>   1 files changed, 21 insertions(+), 6 deletions(-)
>
>
> diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_init.c
b/osaf/services/saf/cpsv/cpnd/cpnd_init.c
> --- a/osaf/services/saf/cpsv/cpnd/cpnd_init.c
> +++ b/osaf/services/saf/cpsv/cpnd/cpnd_init.c
> @@ -30,6 +30,7 @@
>   #include <daemon.h>
>   #include "cpnd.h"
>   #include "osaf_poll.h"
> +#include "osaf_time.h"
>
>   enum {
>       FD_TERM,
> @@ -240,8 +241,12 @@ static uint32_t cpnd_lib_init(CPND_CREAT
>       gen_cbk.saClmClusterNodeGetCallback = NULL;
>       gen_cbk.saClmClusterTrackCallback = cpnd_clm_cluster_track_cb;
>       rc = saClmInitialize(&clmHandle, &gen_cbk, &clm_version);
> -     while (rc == SA_AIS_ERR_TRY_AGAIN) {
> -             usleep(1000000);
> +     while (rc == SA_AIS_ERR_TRY_AGAIN || rc == SA_AIS_ERR_TIMEOUT ||
> +             rc == SA_AIS_ERR_NO_RESOURCES || rc ==
SA_AIS_ERR_UNAVAILABLE) {
> +             if (rc != SA_AIS_ERR_TRY_AGAIN) {
> +                     LOG_WA("cpnd_lib_init: saClmInitialize returned %u",
rc);
> +             }
> +             osaf_nanosleep(&kHundredMilliseconds);
>               rc = saClmInitialize(&clmHandle, &gen_cbk, &clm_version);
>       }
>
> @@ -586,17 +591,27 @@ void cpnd_main_process(CPND_CB *cb)
>                               SaClmCallbacksT gen_cbk;
>
>                               LOG_NO("Bad CLM handle. Reinitializing.");
> -                             usleep(100000);
> +                             osaf_nanosleep(&kHundredMilliseconds);
>
>                               m_CPSV_GET_AMF_VER(clm_version);
>                               gen_cbk.saClmClusterNodeGetCallback = NULL;
>                               gen_cbk.saClmClusterTrackCallback =
cpnd_clm_cluster_track_cb;
>
>                               clm_error = saClmInitialize(&clmHandle,
&gen_cbk, &clm_version);
> +
> +                             while (clm_error == SA_AIS_ERR_TRY_AGAIN ||
clm_error == SA_AIS_ERR_TIMEOUT ||
> +                                     clm_error == SA_AIS_ERR_NO_RESOURCES
|| clm_error == SA_AIS_ERR_UNAVAILABLE) {
> +                                     if (clm_error !=
SA_AIS_ERR_TRY_AGAIN) {
> +                                             LOG_WA("cpnd clm init failed
with return value:%d", clm_error);
> +                                     }
> +
osaf_nanosleep(&kHundredMilliseconds);
> +                                     clm_error =
saClmInitialize(&clmHandle, &gen_cbk, &clm_version);
> +                             }
> +
>                               if (clm_error != SA_AIS_OK) {
> -                                      LOG_ER("cpnd clm init failed with
return value:%d", clm_error);
> -                                       TRACE_LEAVE();
> -                                        return;
> +                                     LOG_ER("cpnd clm init failed with
return value:%d", clm_error);
> +                                     TRACE_LEAVE();
> +                                     return;
>                               }
>                               cb->clm_hdl = clmHandle;
>                       } else if (clm_error != SA_AIS_OK) {



------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to