From: <pra...@or...> - 2015-05-04 10:11:01
|
osaf/services/saf/amf/amfnd/chc.cc | 2 +- osaf/services/saf/amf/amfnd/hcdb.cc | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) saAmfHealthcheckStart() API fails with SA_AIS_ERR_NOT_EXIST in the reported case. In the reported case, Application is up with 2 SUs with one component in each SU. Each component belongs to same component type.HealtchCheckKey is configured for component type. Now, dynamically, a SU is added in the system having one component of same component type and a different health check key is configured for the same component type. When this SU is unlocked, saAmfHealthcheckStart() API fails with SA_AIS_ERR_NOT_EXIST. Why ? As a part of dynamic addition of SU, AMFND reads SU configuration from IMM. While reading information for healthCheckType, AMFND reads all keys again for the same compType and try to create again record for it. Since record already exists in its database, record is not added in database and at this error AMF does not continue to read other healthCheckType from IMM.AMFND must skip creating existing records and must continue to read other records from IMM. Patch ensures that AMFND first checks if record already exists in its database. It creates record only if it does not exists. Thus error situation while addition of record is avoided and all records are read. diff --git a/osaf/services/saf/amf/amfnd/chc.cc b/osaf/services/saf/amf/amfnd/chc.cc --- a/osaf/services/saf/amf/amfnd/chc.cc +++ b/osaf/services/saf/amf/amfnd/chc.cc @@ -100,7 +100,7 @@ uint32_t avnd_evt_ava_hc_start_evh(AVND_ } /* validate the healthcheck start message */ avnd_comp_hc_param_val(cb, AVSV_AMF_HC_START, (uint8_t *)hc_start, &comp, 0, &amf_rc); - + TRACE_1("sending response:%d",amf_rc); /* send the response back to AvA */ rc = avnd_amf_resp_send(cb, AVSV_AMF_HC_START, amf_rc, 0, &api_info->dest, &evt->mds_ctxt, comp, msg_from_avnd); diff --git a/osaf/services/saf/amf/amfnd/hcdb.cc b/osaf/services/saf/amf/amfnd/hcdb.cc --- a/osaf/services/saf/amf/amfnd/hcdb.cc +++ b/osaf/services/saf/amf/amfnd/hcdb.cc @@ -326,9 +326,15 @@ SaAisErrorT avnd_hctype_config_get(SaImm while (immutil_saImmOmSearchNext_2(searchHandle, &hc_name, (SaImmAttrValuesT_2 ***)&attributes) == SA_AIS_OK) { TRACE_1("'%s'", hc_name.value); - - if (hctype_create(avnd_cb, &hc_name, attributes) == NULL) - goto done2; + //A record may get created in the context of some other component of same comptype. + AVND_HCTYPE *hctype = NULL; + if ((hctype = (AVND_HCTYPE *)ncs_patricia_tree_get(&hctypedb, + (uint8_t *)&hc_name)) == NULL) { + if (hctype_create(avnd_cb, &hc_name, attributes) == NULL) + goto done2; + } + else + TRACE_2("Record already exists"); } error = SA_AIS_OK; |