Hi Vijay,

Almost there. I found one more thing about usage of the Timer class that I had 
missed. See attached diff with my comments.
Also another minor comment. Naming the Timer class object " adminOpTimer" is 
not correct here since it is not used for timing an admin operation. Maybe you 
should give it a better name?

Thanks
Lennart

> -----Original Message-----
> From: Vijay Roy [mailto:[email protected]]
> Sent: den 10 oktober 2017 12:28
> To: Lennart Lund <[email protected]>
> Cc: [email protected]; Vijay Roy <[email protected]>
> Subject: [PATCH 1/1] smf: Upgrade failed due to CCB aborted by imm sync
> request [#2584]
> 
> The Patch provides the fix where smfCreateRollbackElement return OK to
> avoid failed/ERR_EXIST situation.
> Also fixed the logging of messages correctly.
> 
> * This issue is a by-product of the fix/patch provided at commit
> 44d113c4fa669065afe78d70bc81c5297d79ec0e.
> ---
>  src/smf/smfd/SmfCampaignWrapup.cc | 61 ++++++++++++++++++++++++-
> --------------
>  1 file changed, 37 insertions(+), 24 deletions(-)
> 
> diff --git a/src/smf/smfd/SmfCampaignWrapup.cc
> b/src/smf/smfd/SmfCampaignWrapup.cc
> index 199ee19..10bdbf0 100644
> --- a/src/smf/smfd/SmfCampaignWrapup.cc
> +++ b/src/smf/smfd/SmfCampaignWrapup.cc
> @@ -228,39 +228,52 @@ bool
> SmfCampaignWrapup::executeCampComplete() {
>          base::Sleep(base::kFiveHundredMilliseconds);
>          continue;
>       } else if (ais_rc != SA_AIS_OK) {
> -        LOG_WA("%s: SmfCampaignWrapup::executeCampComplete Fail '%s'",
> __FUNCTION__,
> -             saf_error(ais_rc));
> +        LOG_WA("%s: SmfCampaignWrapup::executeCampComplete Fail '%s'",
> +              __FUNCTION__, saf_error(ais_rc));
>          rc = false;
> -        break;
>       }
> +     break;
>    }
> +
>    if (adminOpTimer.is_timeout() == true && ais_rc != SA_AIS_OK) {
> -    LOG_WA("%s: SmfCampaignWrapup::executeCampComplete()  timeout
> Fail '%s'", __FUNCTION__,
> -           saf_error(ais_rc));
> +     LOG_WA("%s: SmfCampaignWrapup::executeCampComplete()  timeout
> Fail '%s'",
> +        __FUNCTION__, saf_error(ais_rc));
> +     rc = false;
>    }
> 
> -  for (auto& elem : m_campCompleteAction) {
> -    base::Timer adminOpTimer(60000);
> -    while (adminOpTimer.is_timeout() == false) {
> -      ais_rc = (*elem).execute(SmfCampaignThread::instance()-
> >getImmHandle(),
> +  if (rc == true)
> +  {
> +     for (auto& elem : m_campCompleteAction) {
> +       base::Timer adminOpTimer(60000);
> +       while (adminOpTimer.is_timeout() == false) {
> +          ais_rc = (*elem).execute(SmfCampaignThread::instance()-
> >getImmHandle(),
>                                    &completeRollbackDn);
> -      if (ais_rc == SA_AIS_ERR_TRY_AGAIN) {
> -         base::Sleep(base::kFiveHundredMilliseconds);
> -         continue;
> -      } else if (ais_rc != SA_AIS_OK) {
> -         LOG_WA("%s: SmfCampaignWrapup::executeCampComplete Fail '%s'",
> __FUNCTION__,
> -             saf_error(ais_rc));
> -         rc = false;
> -         break;
> -      }
> -    }
> -    if (adminOpTimer.is_timeout() == true && ais_rc != SA_AIS_OK) {
> -      LOG_WA("%s: SmfCampaignWrapup::executeCampComplete():
> m_campCompleteAction timeout Fail '%s'"
> -                   , __FUNCTION__, saf_error(ais_rc));
> -    }
> +          if (ais_rc == SA_AIS_ERR_TRY_AGAIN) {
> +             base::Sleep(base::kFiveHundredMilliseconds);
> +             continue;
> +               } else if (ais_rc != SA_AIS_OK) {
> +              LOG_WA("%s: SmfCampaignWrapup::executeCampComplete Fail
> '%s'",
> +              __FUNCTION__, saf_error(ais_rc));
> +              rc = false;
> +       }
> +          break;
> +       }
> +       if (adminOpTimer.is_timeout() == true && ais_rc != SA_AIS_OK) {
> +          LOG_WA("%s: SmfCampaignWrapup::executeCampComplete(): "
> +             " m_campCompleteAction timeout Fail '%s'",
> +               __FUNCTION__, saf_error(ais_rc));
> +          rc = false;
> +       }
> +       if (rc == false)
> +       break;
> +     }
>    }
> 
> -  LOG_NO("CAMP: Campaign complete actions completed");
> +  if (rc == true)
> +     LOG_NO("CAMP: Campaign complete actions completed");
> +  else
> +     LOG_NO("CAMP: Campaign complete actions Failed");
> +
>    TRACE_LEAVE();
> 
>    return rc;
> --
> 1.9.1

Attachment: smf_2584_comment2.diff
Description: smf_2584_comment2.diff

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to