osaf/services/saf/amf/amfd/ckpt_dec.cc | 5 +---- osaf/services/saf/amf/amfd/comp.cc | 21 +++++++++++++++++++++ osaf/services/saf/amf/amfd/include/comp.h | 1 + 3 files changed, 23 insertions(+), 4 deletions(-)
Some times, because of timing issues, apply callback is reaching delayed at standby controller. It happened during component oper state checkpoiting. Since apply callback is not received at standby controller, component is not found in data base and counter comp_updt is mismatched during warn sync and standby amfd asserts. Fix for this is to create comp when not found in data base and wait for apply callback. When apply callback comes later, the other parameters like su are updated. diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc b/osaf/services/saf/amf/amfd/ckpt_dec.cc --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc @@ -2419,10 +2419,7 @@ static uint32_t dec_comp_oper_state(AVD_ return status; } - if (NULL == (comp_struct = avd_comp_get(&comp_ptr->comp_info.name))) { - LOG_ER("%s: comp not found, %s", __FUNCTION__, comp_ptr->comp_info.name.value); - return NCSCC_RC_FAILURE; - } + comp_struct = avd_comp_get_or_create(&comp_ptr->comp_info.name); /* Update the fields received in this checkpoint message */ comp_struct->saAmfCompOperState = comp_ptr->saAmfCompOperState; diff --git a/osaf/services/saf/amf/amfd/comp.cc b/osaf/services/saf/amf/amfd/comp.cc --- a/osaf/services/saf/amf/amfd/comp.cc +++ b/osaf/services/saf/amf/amfd/comp.cc @@ -1570,6 +1570,27 @@ static void comp_ccb_apply_cb(CcbUtilOpe TRACE_LEAVE(); } +/** + * Return an Comp object if it exist, otherwise create it and + * return a reference to the new object. + * @param dn + * + * @return AVD_COMP* + */ +AVD_COMP *avd_comp_get_or_create(const SaNameT *dn) +{ + AVD_COMP *comp = avd_comp_get(dn); + + if (!comp) { + TRACE("'%s' does not exist, creating it", dn->value); + comp = avd_comp_new(dn); + osafassert(comp != NULL); + avd_comp_db_add(comp); + } + + return comp; +} + void avd_comp_constructor(void) { NCS_PATRICIA_PARAMS patricia_params; diff --git a/osaf/services/saf/amf/amfd/include/comp.h b/osaf/services/saf/amf/amfd/include/comp.h --- a/osaf/services/saf/amf/amfd/include/comp.h +++ b/osaf/services/saf/amf/amfd/include/comp.h @@ -234,5 +234,6 @@ extern AVD_COMPCS_TYPE *avd_compcstype_g extern AVD_COMPCS_TYPE *avd_compcstype_getnext(const SaNameT *dn); extern AVD_COMPCS_TYPE * avd_compcstype_find_match(const SaNameT *csi, const AVD_COMP *comp); extern void avd_compcstype_constructor(void); +extern AVD_COMP *avd_comp_get_or_create(const SaNameT *dn); #endif ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel