osaf/libs/common/amf/include/amf_defs.h | 3 ++- osaf/services/saf/amf/amfd/comptype.cc | 22 +++++++++++++++++----- osaf/services/saf/amf/amfnd/compdb.cc | 18 ++++++++++++++---- osaf/services/saf/amf/amfnd/include/avnd_comp.h | 1 + 4 files changed, 34 insertions(+), 10 deletions(-)
Added support for saAmfCtDefRecoveryOnError diff --git a/osaf/libs/common/amf/include/amf_defs.h b/osaf/libs/common/amf/include/amf_defs.h --- a/osaf/libs/common/amf/include/amf_defs.h +++ b/osaf/libs/common/amf/include/amf_defs.h @@ -251,7 +251,8 @@ typedef enum typedef enum { saAmfCtDefCallbackTimeout_ID = 1, - saAmfCtDefClcCliTimeout_ID = 2 + saAmfCtDefClcCliTimeout_ID = 2, + saAmfCtDefRecoveryOnError_ID = 3 } AVSV_AMF_COMPTYPE_ATTR_ID; /* Attribute ID enum for the SaAmfHealthcheck class */ diff --git a/osaf/services/saf/amf/amfd/comptype.cc b/osaf/services/saf/amf/amfd/comptype.cc --- a/osaf/services/saf/amf/amfd/comptype.cc +++ b/osaf/services/saf/amf/amfd/comptype.cc @@ -432,26 +432,38 @@ static void ccb_apply_modify_hdlr(const i = 0; while ((attr_mod = opdata->param.modify.attrMods[i++]) != NULL) { AVSV_PARAM_INFO param; - const SaImmAttrValuesT_2 *attribute = &attr_mod->modAttr; - SaTimeT *param_val = (SaTimeT *)attribute->attrValues[0]; - memset(¶m, 0, sizeof(param)); param.class_id = AVSV_SA_AMF_COMP_TYPE; param.act = AVSV_OBJ_OPR_MOD; param.name = opdata->objectName; - param.value_len = sizeof(*param_val); - memcpy(param.value, param_val, param.value_len); + const SaImmAttrValuesT_2 *attribute = &attr_mod->modAttr; if (!strcmp(attribute->attrName, "saAmfCtDefCallbackTimeout")) { + SaTimeT *param_val = (SaTimeT *)attribute->attrValues[0]; TRACE("saAmfCtDefCallbackTimeout to '%llu' for compType '%s' on node '%s'", *param_val, opdata->objectName.value, (*it)->name.value); + + param.value_len = sizeof(*param_val); + memcpy(param.value, param_val, param.value_len); param.attr_id = saAmfCtDefCallbackTimeout_ID; avd_snd_op_req_msg(avd_cb, *it, ¶m); } else if (!strcmp(attribute->attrName, "saAmfCtDefClcCliTimeout")) { + SaTimeT *param_val = (SaTimeT *)attribute->attrValues[0]; TRACE("saAmfCtDefClcCliTimeout to '%llu' for compType '%s' on node '%s'", *param_val, opdata->objectName.value, (*it)->name.value); + + param.value_len = sizeof(*param_val); + memcpy(param.value, param_val, param.value_len); param.attr_id = saAmfCtDefClcCliTimeout_ID; avd_snd_op_req_msg(avd_cb, *it, ¶m); + } else if (!strcmp(attribute->attrName, "saAmfCtDefRecoveryOnError")) { + SaAmfRecommendedRecoveryT *param_val = (SaAmfRecommendedRecoveryT *)attribute->attrValues[0]; + TRACE("saAmfCtDefRecoveryOnError to '%u' for compType '%s' on node '%s'", *param_val, + opdata->objectName.value, (*it)->name.value); + param.value_len = sizeof(*param_val); + memcpy(param.value, param_val, param.value_len); + param.attr_id = saAmfCtDefRecoveryOnError_ID; + avd_snd_op_req_msg(avd_cb, *it, ¶m); } else LOG_WA("Unexpected attribute name: %s", attribute->attrName); } diff --git a/osaf/services/saf/amf/amfnd/compdb.cc b/osaf/services/saf/amf/amfnd/compdb.cc --- a/osaf/services/saf/amf/amfnd/compdb.cc +++ b/osaf/services/saf/amf/amfnd/compdb.cc @@ -896,14 +896,13 @@ uint32_t avnd_comptype_oper_req(AVND_CB const char* comp_type_name; SaTimeT saAmfCtDefCallbackTimeout = 0; SaTimeT saAmfCtDefClcCliTimeout = 0; + SaAmfRecommendedRecoveryT saAmfCtDefRecoveryOnError; TRACE_ENTER2("Op %u, %s", param->act, param->name.value); switch (param->act) { case AVSV_OBJ_OPR_MOD: { - osafassert(sizeof(SaTimeT) == param->value_len); - // 1. find component from componentType, // input example, param->name.value = safVersion=1,safCompType=AmfDemo1 comp_type_name = (char *) param->name.value; @@ -921,6 +920,7 @@ uint32_t avnd_comptype_oper_req(AVND_CB switch (param->attr_id) { case saAmfCtDefCallbackTimeout_ID: saAmfCtDefCallbackTimeout = *((SaTimeT *) param->value); + osafassert(sizeof(SaTimeT) == param->value_len); if (comp->use_comptype_attr.test(PxiedInstCallbackTimeout)) { comp->pxied_inst_cbk_timeout = saAmfCtDefCallbackTimeout; TRACE("comp->pxied_inst_cbk_timeout modified to '%llu'", comp->pxied_inst_cbk_timeout); @@ -945,6 +945,7 @@ uint32_t avnd_comptype_oper_req(AVND_CB case saAmfCtDefClcCliTimeout_ID: AVND_COMP_CLC_CMD_PARAM *cmd; saAmfCtDefClcCliTimeout = *((SaTimeT *) param->value); + osafassert(sizeof(SaTimeT) == param->value_len); if (comp->use_comptype_attr.test(CompInstantiateTimeout)) { cmd = &comp->clc_info.cmds[AVND_COMP_CLC_CMD_TYPE_INSTANTIATE - 1]; cmd->timeout = saAmfCtDefClcCliTimeout; @@ -971,6 +972,14 @@ uint32_t avnd_comptype_oper_req(AVND_CB TRACE("cmd->timeout (AM Stop) modified to '%llu'", cmd->timeout); } break; + case saAmfCtDefRecoveryOnError_ID: + saAmfCtDefRecoveryOnError = *((SaAmfRecommendedRecoveryT *) param->value); + osafassert(sizeof(SaAmfRecommendedRecoveryT) == param->value_len); + if (comp->use_comptype_attr.test(DefRecoveryOnError)) { + comp->err_info.def_rec = saAmfCtDefRecoveryOnError; + TRACE("comp->err_info.def_rec modified to '%u'", comp->err_info.def_rec); + } + break; default: LOG_WA("Unexpected attribute id: %d", param->attr_id); } @@ -1541,9 +1550,10 @@ static int comp_init(AVND_COMP *comp, co 0, &comp->quies_complete_cbk_timeout) != SA_AIS_OK) comp->quies_complete_cbk_timeout = comptype->saAmfCompQuiescingCompleteTimeout; - if (immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfCompRecoveryOnError"), attributes, 0, &comp->err_info.def_rec) != SA_AIS_OK) + if (immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfCompRecoveryOnError"), attributes, 0, &comp->err_info.def_rec) != SA_AIS_OK) { comp->err_info.def_rec = comptype->saAmfCtDefRecoveryOnError; - else { + comp->use_comptype_attr.set(DefRecoveryOnError); + } else { if ((SaAmfRecommendedRecoveryT)comp->err_info.def_rec == SA_AMF_NO_RECOMMENDATION) { comp->err_info.def_rec = SA_AMF_COMPONENT_FAILOVER; LOG_NO("COMPONENT_FAILOVER(%u) used instead of NO_RECOMMENDATION(%u) for '%s'", diff --git a/osaf/services/saf/amf/amfnd/include/avnd_comp.h b/osaf/services/saf/amf/amfnd/include/avnd_comp.h --- a/osaf/services/saf/amf/amfnd/include/avnd_comp.h +++ b/osaf/services/saf/amf/amfnd/include/avnd_comp.h @@ -292,6 +292,7 @@ enum UsedComptypeAttrs { CompCleanupTimeout, CompAmStartTimeout, CompAmStopTimeout, + DefRecoveryOnError, NumAttrs }; ------------------------------------------------------------------------------ _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel