Hi Neel

Ack with comments

Tested that long DN setting during campaign init works again.

The solution for reading this setting results in a lot of redundant code. 
Reading of this setting from IMM and updating global variables is done in many 
places (I have counted to 5). This is risky and hard to handle in a threaded 
system.
A better solution is probably to constantly keep track of changes of this 
setting e.g. by using an IMM applier running in its own thread, not saving the 
information in global variable (we should try to get rid of the cb struct) and 
encapsulate all handling of this setting. The only thing that's interesting in 
the rest of the code is the correct value. Nowhere in the code it should be 
needed to handle this setting in any other way than to read it.

Thanks
Lennart

> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> Sent: den 21 oktober 2016 13:32
> To: Lennart Lund <[email protected]>; Rafael Odzakow
> <[email protected]>
> Cc: [email protected]
> Subject: [PATCH 1 of 1] smf:read imm longdn attribute at campaigninit
> [#2119]
> 
>  osaf/services/saf/smfsv/smfd/SmfCampaignInit.cc |  17
> +++++++++++++++--
>  1 files changed, 15 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/osaf/services/saf/smfsv/smfd/SmfCampaignInit.cc
> b/osaf/services/saf/smfsv/smfd/SmfCampaignInit.cc
> --- a/osaf/services/saf/smfsv/smfd/SmfCampaignInit.cc
> +++ b/osaf/services/saf/smfsv/smfd/SmfCampaignInit.cc
> @@ -225,11 +225,24 @@ SmfCampaignInit::execute()
>                  return false;
>          }
> 
> +     TRACE("3. Read_IMM_long_DN_config_and_set_control_block()");
> +     if
> (!immUtil.read_IMM_long_DN_config_and_set_control_block(smfd_cb)) {
> +             LOG_ER("SmfCampaignInit: reading long DN config from IMM
> FAILED");
> +             TRACE_LEAVE();
> +             return false;
> +     }
> +
>       std::list < SmfUpgradeAction * >::iterator upActiter;
>       upActiter = m_campInitAction.begin();
>       while (upActiter != m_campInitAction.end()) {
> -                     SaAisErrorT rc = (*upActiter)-
> >execute(SmfCampaignThread::instance()->getImmHandle(),
> -                                                       &initRollbackDn);
> +             TRACE("4. %s:
> read_IMM_long_DN_config_and_set_control_block()",__FUNCTION__);
> +             if
> (!immUtil.read_IMM_long_DN_config_and_set_control_block(smfd_cb)) {
> +                     LOG_ER("SmfCampaignInit: reading long DN config
> from IMM FAILED");
> +                     TRACE_LEAVE();
> +                     return false;
> +             }
> +             SaAisErrorT rc = (*upActiter)-
> >execute(SmfCampaignThread::instance()->getImmHandle(),
> +                             &initRollbackDn);
>               if (rc != SA_AIS_OK) {
>                       LOG_ER("SmfCampaignInit init action %d failed,
> rc=%s", (*upActiter)->getId(), saf_error(rc));
>                       TRACE_LEAVE();

------------------------------------------------------------------------------
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