* Again remove reading SG red model * Remove avsv_cpy_SG_DN_from_DN() * change avnd_get_su_and_sg_attr() to su_get_config_attr() and instead call it from avnd_evt_avd_reg_su_evh()
Thanks, Hans On 7 June 2013 08:39, <[email protected]> wrote: > osaf/libs/common/avsv/avsv_util.c | 28 +++++++++ > osaf/libs/common/avsv/include/avsv_util.h | 1 + > osaf/services/saf/avsv/avnd/avnd_compdb.c | 1 + > osaf/services/saf/avsv/avnd/avnd_sudb.c | 79 > +++++++++++++++++++++++++++ > osaf/services/saf/avsv/avnd/include/avnd_su.h | 7 ++ > 5 files changed, 116 insertions(+), 0 deletions(-) > > > With this patch amfnd will maintain the red model of SU and also > saAmfSUFailover attribute of SU. Amfnd will read them from IMM before any > instantiation of SU. > > diff --git a/osaf/libs/common/avsv/avsv_util.c > b/osaf/libs/common/avsv/avsv_util.c > --- a/osaf/libs/common/avsv/avsv_util.c > +++ b/osaf/libs/common/avsv/avsv_util.c > @@ -416,3 +416,31 @@ AVSV_COMP_TYPE_VAL avsv_amfcompcategory_ > return avsv_comp_type; > } > > + > +/** > + * Extracts SG DN from the given DN and copies it into the provided bufffer. > + * @param ptr to SaNameT in which DN will be copied. > + * @param ptr to SaNameT which contains the SG DN > + * @return NCSCC_RC_FAILURE/NCSCC_RC_SUCCESS > + */ > + > +uint32_t avsv_cpy_SG_DN_from_DN(SaNameT *d_sg_dn, SaNameT *s_dn_name) > +{ > + char *tmp = NULL; > + > + memset(d_sg_dn, 0, sizeof(SaNameT)); > + tmp = strstr((char*)s_dn_name->value, "safSg"); > + > + if (!tmp) > + return NCSCC_RC_FAILURE; > + > + if (strlen(tmp) < SA_MAX_NAME_LENGTH) { > + strcpy((char*)d_sg_dn->value, tmp); > + > + /* Fill the length and return the pointer */ > + d_sg_dn->length = strlen((char*)d_sg_dn->value); > + } else > + return NCSCC_RC_FAILURE; > + > + return NCSCC_RC_SUCCESS; > +} > diff --git a/osaf/libs/common/avsv/include/avsv_util.h > b/osaf/libs/common/avsv/include/avsv_util.h > --- a/osaf/libs/common/avsv/include/avsv_util.h > +++ b/osaf/libs/common/avsv/include/avsv_util.h > @@ -84,6 +84,7 @@ extern void avsv_create_association_clas > extern void avsv_sanamet_init(const SaNameT *haystack, SaNameT *dn, const > char *needle); > > extern AVSV_COMP_TYPE_VAL > avsv_amfcompcategory_to_avsvcomptype(SaAmfCompCategoryT saf_comp_category); > +extern unsigned int avsv_cpy_SG_DN_from_DN(SaNameT *, SaNameT *); > > #ifdef __cplusplus > } > diff --git a/osaf/services/saf/avsv/avnd/avnd_compdb.c > b/osaf/services/saf/avsv/avnd/avnd_compdb.c > --- a/osaf/services/saf/avsv/avnd/avnd_compdb.c > +++ b/osaf/services/saf/avsv/avnd/avnd_compdb.c > @@ -1768,6 +1768,7 @@ unsigned int avnd_comp_config_get_su(AVN > avnd_hc_config_get(comp); > } > } > + avnd_get_su_and_sg_attr(su); > > rc = NCSCC_RC_SUCCESS; > > diff --git a/osaf/services/saf/avsv/avnd/avnd_sudb.c > b/osaf/services/saf/avsv/avnd/avnd_sudb.c > --- a/osaf/services/saf/avsv/avnd/avnd_sudb.c > +++ b/osaf/services/saf/avsv/avnd/avnd_sudb.c > @@ -28,6 +28,7 @@ > */ > > #include "avnd.h" > +#include <immutil.h> > > /**************************************************************************** > Name : avnd_sudb_init > @@ -292,6 +293,18 @@ uint32_t avnd_su_oper_req(AVND_CB *cb, A > m_AVND_SEND_CKPT_UPDT_ASYNC_RMV(cb, su, AVND_CKPT_SU_CONFIG); > rc = avnd_sudb_rec_del(cb, ¶m->name); > break; > + case AVSV_OBJ_OPR_MOD: { > + switch (param->attr_id) { > + case saAmfSUFailOver_ID: > + osafassert(sizeof(uint32_t) == param->value_len); > + su->sufailover = m_NCS_OS_NTOHL(*(uint32_t > *)(param->value)); > + break; > + default: > + LOG_NO("%s: Unsupported attribute %u", __FUNCTION__, > param->attr_id); > + goto done; > + } > + break; > + } > default: > LOG_NO("%s: Unsupported action %u", __FUNCTION__, param->act); > goto done; > @@ -304,3 +317,69 @@ done: > TRACE_LEAVE(); > return rc; > } > + > +/** > + * Reads attributes from IMM which are required to be maintained at Amfnd > also. > + * At present saAmfSUFailover and saAmfSgtRedundancyModel are read. > + * > + * @param su > + * > + */ > +void avnd_get_su_and_sg_attr(AVND_SU *su) > +{ > + SaImmAccessorHandleT accessorHandle; > + const SaImmAttrValuesT_2 **attributes; > + SaImmHandleT immOmHandle; > + SaVersionT immVersion = { 'A', 2, 1 }; > + SaNameT sg, sgtype, sutype; > + TRACE_ENTER2("'%s'", su->name.value); > + > + immutil_saImmOmInitialize(&immOmHandle, NULL, &immVersion); > + immutil_saImmOmAccessorInitialize(immOmHandle, &accessorHandle); > + > + if (immutil_saImmOmAccessorGet_2(accessorHandle, &su->name, NULL, > + (SaImmAttrValuesT_2 ***)&attributes) != SA_AIS_OK) { > + LOG_ER("saImmOmAccessorGet_2 FAILED for '%s'", > su->name.value); > + goto done; > + } > + if (m_AVND_SU_IS_PREINSTANTIABLE(su)) { > + if (immutil_getAttr("saAmfSUFailover", attributes, 0, > &su->sufailover) != SA_AIS_OK) { > + if (immutil_getAttr("saAmfSUType", attributes, 0, > &sutype) == SA_AIS_OK) { > + if > (immutil_saImmOmAccessorGet_2(accessorHandle, &sutype, NULL, > + (SaImmAttrValuesT_2 > ***)&attributes) == SA_AIS_OK) { > + > immutil_getAttr("saAmfSutDefSUFailover", attributes, 0, &su->sufailover); > + } > + } > + } > + } > + else > + su->sufailover = true; > + > + if (avsv_cpy_SG_DN_from_DN(&sg, &su->name) != NCSCC_RC_SUCCESS) { > + LOG_ER("Could not retrieve SG name from SU DN"); > + goto done; > + } > + > + if (immutil_saImmOmAccessorGet_2(accessorHandle, &sg, NULL, > + (SaImmAttrValuesT_2 ***)&attributes) != SA_AIS_OK) { > + LOG_ER("saImmOmAccessorGet_2 FAILED for '%s'", sg.value); > + goto done; > + } > + > + if (immutil_getAttr("saAmfSGType", attributes, 0, &sgtype) != > SA_AIS_OK) > + LOG_ER("saAmfSGType attribute not present in '%s'", sg.value); > + > + if (immutil_saImmOmAccessorGet_2(accessorHandle, &sgtype, NULL, > + (SaImmAttrValuesT_2 ***)&attributes) != SA_AIS_OK) { > + LOG_ER("saImmOmAccessorGet_2 FAILED for '%s'", sgtype.value); > + goto done; > + } > + > + if (immutil_getAttr("saAmfSgtRedundancyModel", attributes, 0, > &su->sg_redundancy_model) != SA_AIS_OK) > + LOG_ER("saAmfSgtRedundancyModel attribute not present in > '%s'", sgtype.value); > + > +done: > + immutil_saImmOmAccessorFinalize(accessorHandle); > + immutil_saImmOmFinalize(immOmHandle); > + TRACE_LEAVE2(); > +} > diff --git a/osaf/services/saf/avsv/avnd/include/avnd_su.h > b/osaf/services/saf/avsv/avnd/include/avnd_su.h > --- a/osaf/services/saf/avsv/avnd/include/avnd_su.h > +++ b/osaf/services/saf/avsv/avnd/include/avnd_su.h > @@ -158,6 +158,11 @@ typedef struct avnd_su_tag { > bool is_ncs; > bool su_is_external; /*indicates if this SU is external */ > > + /* To maintain saAmfSUFailover attribute of SU classs at Amfnd. */ > + bool sufailover; /* sufailover is enabled or not for the SU. */ > + > + /* Redundancy Model of the SG of this SU */ > + uint32_t sg_redundancy_model; > } AVND_SU; > > #define AVND_SU_NULL ((AVND_SU *)0) > @@ -401,5 +406,7 @@ extern struct avnd_su_si_rec *avnd_silis > extern struct avnd_su_si_rec *avnd_silist_getnext(const struct > avnd_su_si_rec *); > extern struct avnd_su_si_rec *avnd_silist_getprev(const struct > avnd_su_si_rec *); > extern struct avnd_su_si_rec *avnd_silist_getlast(void); > +extern void avnd_get_su_and_sg_attr(AVND_SU *su); > +extern bool avnd_sufailover_in_progress(AVND_SU *su); > > #endif > > ------------------------------------------------------------------------------ > How ServiceNow helps IT people transform IT departments: > 1. A cloud service to automate IT design, transition and operations > 2. Dashboards that offer high-level views of enterprise services > 3. A single system of record for all IT processes > http://p.sf.net/sfu/servicenow-d2d-j > _______________________________________________ > Opensaf-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/opensaf-devel ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
