osaf/libs/common/avsv/avsv_d2nedu.c | 35 ++++++++++------- osaf/libs/common/avsv/include/avsv_d2nmsg.h | 5 +- osaf/services/saf/avsv/avd/avd_mds.c | 11 +++-- osaf/services/saf/avsv/avd/avd_util.c | 1 + osaf/services/saf/avsv/avd/include/avd_mds.h | 2 +- osaf/services/saf/avsv/avnd/avnd_mds.c | 33 +++++++++++++--- osaf/services/saf/avsv/avnd/avnd_sidb.c | 42 +------------------- osaf/services/saf/avsv/avnd/avnd_su.c | 51 ++++++++++++++++++++++++- osaf/services/saf/avsv/avnd/include/avnd_evt.h | 1 + osaf/services/saf/avsv/avnd/include/avnd_mds.h | 5 ++- 10 files changed, 114 insertions(+), 72 deletions(-)
amfnd process aborted in immutils and node rebooted by amf watchdog with the following log: 2013-09-09 11:50:02 osafamfnd SC-2-1 err osafamfnd[5336]: saImmOmInitialize FAILED, rc = 5 When the AMF node director receives a SUSI ASGN message, it reads SI rank from IMM. If IMM does not respond in a timely manner the amfnd process will be aborted and the node restarted by the AMF watchdog. By including SI rank (an int) in the SUSI ASGN msg, the read from IMM can be skipped/done conditionally based on the amfnd MDS version. diff --git a/osaf/libs/common/avsv/avsv_d2nedu.c b/osaf/libs/common/avsv/avsv_d2nedu.c --- a/osaf/libs/common/avsv/avsv_d2nedu.c +++ b/osaf/libs/common/avsv/avsv_d2nedu.c @@ -56,6 +56,7 @@ uint32_t avsv_edp_dnd_msg(EDU_HDL *hdl, uint32_t rc = NCSCC_RC_SUCCESS; AVSV_DND_MSG *struct_ptr = NULL, **d_ptr = NULL; uint16_t ver3 = AVSV_AVD_AVND_MSG_FMT_VER_3; + uint16_t ver5 = AVSV_AVD_AVND_MSG_FMT_VER_5; EDU_INST_SET avsv_dnd_msg_rules[] = { {EDU_START, avsv_edp_dnd_msg, 0, 0, 0, @@ -217,6 +218,12 @@ uint32_t avsv_edp_dnd_msg(EDU_HDL *hdl, (long)&((AVSV_DND_MSG *)0)->msg_info.d2n_su_si_assign.su_name, 0, NULL}, {EDU_EXEC, ncs_edp_sanamet, 0, 0, 0, (long)&((AVSV_DND_MSG *)0)->msg_info.d2n_su_si_assign.si_name, 0, NULL}, + + /* Include SI rank in version 5 and higher */ + {EDU_VER_GE, NULL, 0, 0, 2, 0, 0, (EDU_EXEC_RTINE)((uint16_t *)(&(ver5)))}, + {EDU_EXEC, ncs_edp_uns32, 0, 0, 0, + (long)&((AVSV_DND_MSG *)0)->msg_info.d2n_su_si_assign.si_rank, 0, NULL}, + {EDU_EXEC, m_NCS_EDP_SAAMFHASTATET, 0, 0, 0, (long)&((AVSV_DND_MSG *)0)->msg_info.d2n_su_si_assign.ha_state, 0, NULL}, {EDU_VER_GE, NULL, 0, 0, 2, 0, 0, (EDU_EXEC_RTINE)((uint16_t *)(&(ver3)))}, @@ -410,20 +417,20 @@ int avsv_dnd_msg_test_type_fnc(NCSCONTEX LCL_JMP_OFFSET_AVSV_D2N_REG_SU_MSG = 48, LCL_JMP_OFFSET_AVSV_D2N_REG_COMP_MSG = 53, LCL_JMP_OFFSET_AVSV_D2N_INFO_SU_SI_ASSIGN_MSG = 58, - LCL_JMP_OFFSET_AVSV_D2N_PG_TRACK_ACT_RSP_MSG = 68, - LCL_JMP_OFFSET_AVSV_D2N_PG_UPD_MSG = 75, - LCL_JMP_OFFSET_AVSV_D2N_OPERATION_REQUEST_MSG = 79, - LCL_JMP_OFFSET_AVSV_D2N_PRESENCE_SU_MSG = 82, - LCL_JMP_OFFSET_AVSV_D2N_DATA_VERIFY_MSG = 86, - LCL_JMP_OFFSET_AVSV_D2N_DATA_ACK_MSG = 91, - LCL_JMP_OFFSET_AVSV_D2N_SHUTDOWN_APP_SU_MSG = 93, - LCL_JMP_OFFSET_AVSV_D2N_SET_LEDS_MSG = 95, - LCL_JMP_OFFSET_AVSV_N2D_COMP_VALID_MSG = 97, - LCL_JMP_OFFSET_AVSV_D2N_COMP_VALID_RESP_MSG = 105, - LCL_JMP_OFFSET_AVSV_D2N_ROLE_CHANGE_MSG = 109, - LCL_JMP_OFFSET_AVSV_D2N_ADMIN_OP_REQ_MSG = 112, - LCL_JMP_OFFSET_AVSV_D2N_HEARTBEAT_MSG = 116, - LCL_JMP_OFFSET_AVSV_D2N_REBOOT_MSG = 117 + LCL_JMP_OFFSET_AVSV_D2N_PG_TRACK_ACT_RSP_MSG = 70, + LCL_JMP_OFFSET_AVSV_D2N_PG_UPD_MSG = 77, + LCL_JMP_OFFSET_AVSV_D2N_OPERATION_REQUEST_MSG = 81, + LCL_JMP_OFFSET_AVSV_D2N_PRESENCE_SU_MSG = 84, + LCL_JMP_OFFSET_AVSV_D2N_DATA_VERIFY_MSG = 88, + LCL_JMP_OFFSET_AVSV_D2N_DATA_ACK_MSG = 93, + LCL_JMP_OFFSET_AVSV_D2N_SHUTDOWN_APP_SU_MSG = 95, + LCL_JMP_OFFSET_AVSV_D2N_SET_LEDS_MSG = 97, + LCL_JMP_OFFSET_AVSV_N2D_COMP_VALID_MSG = 99, + LCL_JMP_OFFSET_AVSV_D2N_COMP_VALID_RESP_MSG = 107, + LCL_JMP_OFFSET_AVSV_D2N_ROLE_CHANGE_MSG = 111, + LCL_JMP_OFFSET_AVSV_D2N_ADMIN_OP_REQ_MSG = 114, + LCL_JMP_OFFSET_AVSV_D2N_HEARTBEAT_MSG = 118, + LCL_JMP_OFFSET_AVSV_D2N_REBOOT_MSG = 119 }; AVSV_DND_MSG_TYPE type; diff --git a/osaf/libs/common/avsv/include/avsv_d2nmsg.h b/osaf/libs/common/avsv/include/avsv_d2nmsg.h --- a/osaf/libs/common/avsv/include/avsv_d2nmsg.h +++ b/osaf/libs/common/avsv/include/avsv_d2nmsg.h @@ -39,14 +39,12 @@ #include <avsv_defs.h> #include <stdbool.h> -/* In Service upgrade support */ -#define AVND_MDS_SUB_PART_VERSION 4 - /* Message format versions */ #define AVSV_AVD_AVND_MSG_FMT_VER_1 1 #define AVSV_AVD_AVND_MSG_FMT_VER_2 2 #define AVSV_AVD_AVND_MSG_FMT_VER_3 3 #define AVSV_AVD_AVND_MSG_FMT_VER_4 4 +#define AVSV_AVD_AVND_MSG_FMT_VER_5 5 /* Internode/External Components Validation result */ typedef enum { @@ -470,6 +468,7 @@ typedef struct avsv_d2n_info_su_si_assig bool single_csi; /* To differentiate single csi assignment from SI assignment.*/ uint32_t num_assigns; AVSV_SUSI_ASGN *list; + uint32_t si_rank; } AVSV_D2N_INFO_SU_SI_ASSIGN_MSG_INFO; typedef struct avsv_d2n_pg_track_act_rsp_msg_info_tag { diff --git a/osaf/services/saf/avsv/avd/avd_mds.c b/osaf/services/saf/avsv/avd/avd_mds.c --- a/osaf/services/saf/avsv/avd/avd_mds.c +++ b/osaf/services/saf/avsv/avd/avd_mds.c @@ -42,14 +42,17 @@ #include <avd_msg.h> #include "avd.h" -const MDS_CLIENT_MSG_FORMAT_VER avd_avnd_msg_fmt_map_table[AVD_AVND_SUBPART_VER_MAX] = { +const MDS_CLIENT_MSG_FORMAT_VER avd_avnd_msg_fmt_map_table[] = { AVSV_AVD_AVND_MSG_FMT_VER_1, AVSV_AVD_AVND_MSG_FMT_VER_2, - AVSV_AVD_AVND_MSG_FMT_VER_3, AVSV_AVD_AVND_MSG_FMT_VER_4}; + AVSV_AVD_AVND_MSG_FMT_VER_3, AVSV_AVD_AVND_MSG_FMT_VER_4, + AVSV_AVD_AVND_MSG_FMT_VER_5 +}; -const MDS_CLIENT_MSG_FORMAT_VER avd_avd_msg_fmt_map_table[AVD_AVD_SUBPART_VER_MAX] = { +const MDS_CLIENT_MSG_FORMAT_VER avd_avd_msg_fmt_map_table[] = { AVD_AVD_MSG_FMT_VER_1, AVD_AVD_MSG_FMT_VER_2, AVD_AVD_MSG_FMT_VER_3, AVD_AVD_MSG_FMT_VER_4, - AVD_AVD_MSG_FMT_VER_5}; + AVD_AVD_MSG_FMT_VER_5 +}; /* fwd decl */ diff --git a/osaf/services/saf/avsv/avd/avd_util.c b/osaf/services/saf/avsv/avd/avd_util.c --- a/osaf/services/saf/avsv/avd/avd_util.c +++ b/osaf/services/saf/avsv/avd/avd_util.c @@ -930,6 +930,7 @@ uint32_t avd_snd_susi_msg(AVD_CL_CB *cb, susi_msg->msg_info.d2n_su_si_assign.si_name = susi->si->name; susi_msg->msg_info.d2n_su_si_assign.ha_state = susi->state; + susi_msg->msg_info.d2n_su_si_assign.si_rank = susi->si->saAmfSIRank; /* Fill the SU SI pointer to l_susi which will be used from now * for information related to this SU SI diff --git a/osaf/services/saf/avsv/avd/include/avd_mds.h b/osaf/services/saf/avsv/avd/include/avd_mds.h --- a/osaf/services/saf/avsv/avd/include/avd_mds.h +++ b/osaf/services/saf/avsv/avd/include/avd_mds.h @@ -36,7 +36,7 @@ #define AVD_MDS_SUB_PART_VERSION 5 #define AVD_AVND_SUBPART_VER_MIN 1 -#define AVD_AVND_SUBPART_VER_MAX 4 +#define AVD_AVND_SUBPART_VER_MAX 5 #define AVD_AVD_SUBPART_VER_MIN 1 #define AVD_AVD_SUBPART_VER_MAX 5 diff --git a/osaf/services/saf/avsv/avnd/avnd_mds.c b/osaf/services/saf/avsv/avnd/avnd_mds.c --- a/osaf/services/saf/avsv/avnd/avnd_mds.c +++ b/osaf/services/saf/avsv/avnd/avnd_mds.c @@ -37,11 +37,27 @@ #include "avsv_n2avaedu.h" #include "ncsencdec_pub.h" -const MDS_CLIENT_MSG_FORMAT_VER avnd_avd_msg_fmt_map_table[AVND_AVD_SUBPART_VER_MAX] = - { AVSV_AVD_AVND_MSG_FMT_VER_1, AVSV_AVD_AVND_MSG_FMT_VER_2, AVSV_AVD_AVND_MSG_FMT_VER_3, AVSV_AVD_AVND_MSG_FMT_VER_4}; -const MDS_CLIENT_MSG_FORMAT_VER avnd_avnd_msg_fmt_map_table[AVND_AVND_SUBPART_VER_MAX] = - { AVSV_AVND_AVND_MSG_FMT_VER_1 }; -const MDS_CLIENT_MSG_FORMAT_VER avnd_ava_msg_fmt_map_table[AVND_AVA_SUBPART_VER_MAX] = { AVSV_AVND_AVA_MSG_FMT_VER_1 }; +/* messages to director */ +const MDS_CLIENT_MSG_FORMAT_VER avnd_avd_msg_fmt_map_table[] = { + AVSV_AVD_AVND_MSG_FMT_VER_1, AVSV_AVD_AVND_MSG_FMT_VER_2, + AVSV_AVD_AVND_MSG_FMT_VER_3, AVSV_AVD_AVND_MSG_FMT_VER_4, + AVSV_AVD_AVND_MSG_FMT_VER_4 +}; + +/* messages from director */ +const MDS_CLIENT_MSG_FORMAT_VER avd_avnd_msg_fmt_map_table[] = { + AVSV_AVD_AVND_MSG_FMT_VER_1, AVSV_AVD_AVND_MSG_FMT_VER_2, + AVSV_AVD_AVND_MSG_FMT_VER_3, AVSV_AVD_AVND_MSG_FMT_VER_4, + AVSV_AVD_AVND_MSG_FMT_VER_5 +}; + +const MDS_CLIENT_MSG_FORMAT_VER avnd_avnd_msg_fmt_map_table[] = { + AVSV_AVND_AVND_MSG_FMT_VER_1 +}; + +const MDS_CLIENT_MSG_FORMAT_VER avnd_ava_msg_fmt_map_table[] = { + AVSV_AVND_AVA_MSG_FMT_VER_1 +}; /* static function declarations */ @@ -507,6 +523,9 @@ uint32_t avnd_mds_rcv(AVND_CB *cb, MDS_C goto done; } + /* save the msg version for possible later use in event handlers */ + evt->msg_fmt_ver = rcv_info->i_msg_fmt_ver; + /* nullify the msg as it is used in the event */ memset(&msg, 0, sizeof(AVND_MSG)); @@ -971,7 +990,7 @@ uint32_t avnd_mds_dec(AVND_CB *cb, MDS_C case NCSMDS_SVC_ID_AVD: if (!m_NCS_MSG_FORMAT_IS_VALID(dec_info->i_msg_fmt_ver, AVND_AVD_SUBPART_VER_MIN, - AVND_AVD_SUBPART_VER_MAX, avnd_avd_msg_fmt_map_table)) { + AVND_AVD_SUBPART_VER_MAX, avd_avnd_msg_fmt_map_table)) { LOG_ER("%s,%u: wrong msg fmt not valid %u", __FUNCTION__, __LINE__, dec_info->i_msg_fmt_ver); return NCSCC_RC_FAILURE; @@ -1067,7 +1086,7 @@ uint32_t avnd_mds_flat_dec(AVND_CB *cb, case NCSMDS_SVC_ID_AVD: if (!m_NCS_MSG_FORMAT_IS_VALID(dec_info->i_msg_fmt_ver, AVND_AVD_SUBPART_VER_MIN, - AVND_AVD_SUBPART_VER_MAX, avnd_avd_msg_fmt_map_table)) { + AVND_AVD_SUBPART_VER_MAX, avd_avnd_msg_fmt_map_table)) { LOG_ER("%s,%u: wrong msg fmt not valid %u", __FUNCTION__, __LINE__, dec_info->i_msg_fmt_ver); return NCSCC_RC_FAILURE; diff --git a/osaf/services/saf/avsv/avnd/avnd_sidb.c b/osaf/services/saf/avsv/avnd/avnd_sidb.c --- a/osaf/services/saf/avsv/avnd/avnd_sidb.c +++ b/osaf/services/saf/avsv/avnd/avnd_sidb.c @@ -139,43 +139,6 @@ AVND_SU_SI_REC *avnd_silist_getlast(void return NULL; } -/** - * Return SI rank read from IMM - * - * @param dn DN of SI - * - * @return rank of SI or -1 if not configured for SI - */ -static uint32_t get_sirank(const SaNameT *dn) -{ - SaAisErrorT error; - SaImmAccessorHandleT accessorHandle; - const SaImmAttrValuesT_2 **attributes; - SaImmAttrNameT attributeNames[2] = {"saAmfSIRank", NULL}; - SaImmHandleT immOmHandle; - SaVersionT immVersion = {'A', 2, 1}; - uint32_t rank = -1; // lowest possible rank if uninitialized - - immutil_saImmOmInitialize(&immOmHandle, NULL, &immVersion); - immutil_saImmOmAccessorInitialize(immOmHandle, &accessorHandle); - - osafassert((error = immutil_saImmOmAccessorGet_2(accessorHandle, dn, - attributeNames, (SaImmAttrValuesT_2 ***)&attributes)) == SA_AIS_OK); - - osafassert((error = immutil_getAttr(attributeNames[0], attributes, 0, &rank)) == SA_AIS_OK); - - // saAmfSIRank attribute has a default value of zero (returned by IMM) - if (rank == 0) { - // Unconfigured ranks are treated as lowest possible rank - rank = -1; - } - - immutil_saImmOmAccessorFinalize(accessorHandle); - immutil_saImmOmFinalize(immOmHandle); - - return rank; -} - /**************************************************************************** Name : avnd_su_si_rec_add @@ -220,6 +183,7 @@ AVND_SU_SI_REC *avnd_su_si_rec_add(AVND_ */ /* update the si-name (key) */ memcpy(&si_rec->name, ¶m->si_name, sizeof(SaNameT)); + si_rec->rank = param->si_rank; si_rec->curr_state = param->ha_state; /* @@ -247,7 +211,6 @@ AVND_SU_SI_REC *avnd_su_si_rec_add(AVND_ /* Add to global SI list sorted by rank if appl SU */ if (!su->is_ncs) { uint32_t res; - si_rec->rank = get_sirank(¶m->si_name); si_rec->cb_dll_node.key = (uint8_t *)&si_rec->rank; res = ncs_db_link_list_add(&cb->si_list, &si_rec->cb_dll_node); osafassert(res == NCSCC_RC_SUCCESS); @@ -268,7 +231,8 @@ AVND_SU_SI_REC *avnd_su_si_rec_add(AVND_ csi_param = csi_param->next; } - TRACE_1("SU-SI record added, SU= %s : SI=%s",param->su_name.value,param->si_name.value); + TRACE_1("SU-SI record added, '%s', '%s', rank:%u", param->su_name.value, + param->si_name.value, si_rec->rank); return si_rec; err: diff --git a/osaf/services/saf/avsv/avnd/avnd_su.c b/osaf/services/saf/avsv/avnd/avnd_su.c --- a/osaf/services/saf/avsv/avnd/avnd_su.c +++ b/osaf/services/saf/avsv/avnd/avnd_su.c @@ -33,6 +33,7 @@ #include <logtrace.h> #include <avnd.h> +#include <immutil.h> static uint32_t avnd_avd_su_update_on_fover(AVND_CB *cb, AVSV_D2N_REG_SU_MSG_INFO *info); @@ -224,6 +225,47 @@ static void handle_su_si_assign_in_term_ } } +/** + * Return SI rank read from IMM + * + * @param dn DN of SI + * + * @return rank of SI or -1 if not configured for SI + */ +static uint32_t get_sirank(const SaNameT *dn) +{ + SaAisErrorT error; + SaImmAccessorHandleT accessorHandle; + const SaImmAttrValuesT_2 **attributes; + SaImmAttrNameT attributeNames[2] = {"saAmfSIRank", NULL}; + SaImmHandleT immOmHandle; + SaVersionT immVersion = {'A', 2, 1}; + uint32_t rank = -1; // lowest possible rank if uninitialized + + // TODO remove, just for test + LOG_NO("get_sirank %s", dn->value); + + TRACE_ENTER2("%s", dn->value); + immutil_saImmOmInitialize(&immOmHandle, NULL, &immVersion); + immutil_saImmOmAccessorInitialize(immOmHandle, &accessorHandle); + + osafassert((error = immutil_saImmOmAccessorGet_2(accessorHandle, dn, + attributeNames, (SaImmAttrValuesT_2 ***)&attributes)) == SA_AIS_OK); + + osafassert((error = immutil_getAttr(attributeNames[0], attributes, 0, &rank)) == SA_AIS_OK); + + // saAmfSIRank attribute has a default value of zero (returned by IMM) + if (rank == 0) { + // Unconfigured ranks are treated as lowest possible rank + rank = -1; + } + + immutil_saImmOmAccessorFinalize(accessorHandle); + immutil_saImmOmFinalize(immOmHandle); + + return rank; +} + /**************************************************************************** Name : avnd_evt_avd_info_su_si_assign_msg @@ -263,9 +305,12 @@ uint32_t avnd_evt_avd_info_su_si_assign_ avnd_msgid_assert(info->msg_id); cb->rcv_msg_id = info->msg_id; - if ((info->msg_act == AVSV_SUSI_ACT_DEL) || - (info->msg_act == AVSV_SUSI_ACT_MOD)) { - + if (info->msg_act == AVSV_SUSI_ACT_ASGN) { + /* SI rank was introduced in version 5 of the amfnd protocol, if the + * message version is older then that, read SI rank from IMM */ + if (evt->msg_fmt_ver < 5) + info->si_rank = get_sirank(&info->si_name); + } else { if (info->si_name.length > 0) { if (avnd_su_si_rec_get(cb, &info->su_name, &info->si_name) == NULL) LOG_ER("susi_assign_evh: '%s' is not assigned to '%s'", diff --git a/osaf/services/saf/avsv/avnd/include/avnd_evt.h b/osaf/services/saf/avsv/avnd/include/avnd_evt.h --- a/osaf/services/saf/avsv/avnd/include/avnd_evt.h +++ b/osaf/services/saf/avsv/avnd/include/avnd_evt.h @@ -159,6 +159,7 @@ typedef struct avnd_pm_mon_evt { typedef struct avnd_evt_tag { struct avnd_evt_tag *next; MDS_SYNC_SND_CTXT mds_ctxt; + MDS_CLIENT_MSG_FORMAT_VER msg_fmt_ver; NCS_IPC_PRIORITY priority; AVND_EVT_TYPE type; diff --git a/osaf/services/saf/avsv/avnd/include/avnd_mds.h b/osaf/services/saf/avsv/avnd/include/avnd_mds.h --- a/osaf/services/saf/avsv/avnd/include/avnd_mds.h +++ b/osaf/services/saf/avsv/avnd/include/avnd_mds.h @@ -30,8 +30,11 @@ #ifndef AVND_MDS_H #define AVND_MDS_H +/* In Service upgrade support */ +#define AVND_MDS_SUB_PART_VERSION 5 + #define AVND_AVD_SUBPART_VER_MIN 1 -#define AVND_AVD_SUBPART_VER_MAX 4 +#define AVND_AVD_SUBPART_VER_MAX 5 #define AVND_AVND_SUBPART_VER_MIN 1 #define AVND_AVND_SUBPART_VER_MAX 1 ------------------------------------------------------------------------------ Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test & Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees_APR _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel