osaf/libs/common/smfsv/include/smfsv_evt.h | 1 + osaf/services/saf/smfsv/smfd/smfd_amf.c | 36 +++++++++++++++++----------- osaf/services/saf/smfsv/smfd/smfd_cb.h | 2 +- osaf/services/saf/smfsv/smfd/smfd_evt.c | 37 ++++++++++++++++++++++++++++++ osaf/services/saf/smfsv/smfd/smfd_mds.c | 16 ++++++++---- 5 files changed, 72 insertions(+), 20 deletions(-)
diff --git a/osaf/libs/common/smfsv/include/smfsv_evt.h b/osaf/libs/common/smfsv/include/smfsv_evt.h --- a/osaf/libs/common/smfsv/include/smfsv_evt.h +++ b/osaf/libs/common/smfsv/include/smfsv_evt.h @@ -42,6 +42,7 @@ typedef enum { SMFD_EVT_MDS_INFO = 1, SMFD_EVT_CMD_RSP = 2, SMFD_EVT_CBK_RSP = 3, + SMFD_EVT_QUIESCED_ACK = 4, SMFD_EVT_MAX } SMFD_EVT_TYPE; diff --git a/osaf/services/saf/smfsv/smfd/smfd_amf.c b/osaf/services/saf/smfsv/smfd/smfd_amf.c --- a/osaf/services/saf/smfsv/smfd/smfd_amf.c +++ b/osaf/services/saf/smfsv/smfd/smfd_amf.c @@ -124,26 +124,33 @@ static SaAisErrorT amf_quiescing_state_h static SaAisErrorT amf_quiesced_state_handler(smfd_cb_t * cb, SaInvocationT invocation) { - TRACE_ENTER2("HA AMF QUIESCED STATE request"); + TRACE_ENTER(); + V_DEST_RL mds_role; + SaAisErrorT rc = SA_AIS_OK; + + /* Give up our IMM OI implementer role */ + if (campaign_oi_deactivate(cb) != NCSCC_RC_SUCCESS) { + LOG_ER("amf_quiesced_state_handler oi deactivate FAILED"); + } /* ** Change the MDS VDSET role to Quiesced. Wait for MDS callback with type ** MDS_CALLBACK_QUIESCED_ACK. Don't change cb->ha_state now. */ - - if (campaign_oi_deactivate(cb) != NCSCC_RC_SUCCESS) { - LOG_ER("amf_quiesced_state_handler oi deactivate FAILED"); - } - + mds_role = cb->mds_role; cb->mds_role = V_DEST_RL_QUIESCED; - - if (smfd_mds_change_role(cb) != NCSCC_RC_SUCCESS) { - TRACE("smfd_mds_change_role FAILED"); + if ((rc = smfd_mds_change_role(cb)) != NCSCC_RC_SUCCESS) { + LOG_ER("smfd_mds_change_role [V_DEST_RL_QUIESCED] FAILED"); + rc = SA_AIS_ERR_FAILED_OPERATION; + cb->mds_role = mds_role; + goto done; } cb->amf_invocation_id = invocation; - cb->is_quisced_set = true; - return SA_AIS_OK; + cb->is_quiesced_set = true; +done: + TRACE_LEAVE(); + return rc; } /**************************************************************************** @@ -233,7 +240,7 @@ static void amf_csi_set_callback(SaInvoc } if (result != SA_AIS_OK) - goto done; + goto response; if (new_haState == SA_AMF_HA_QUIESCED) /* AMF response will be done later when MDS quiesced ack has been received */ @@ -254,11 +261,12 @@ static void amf_csi_set_callback(SaInvoc if ((rc = smfd_mds_change_role(smfd_cb)) != NCSCC_RC_SUCCESS) { TRACE("smfd_mds_change_role FAILED"); result = SA_AIS_ERR_FAILED_OPERATION; + goto response; } } - + response: + saAmfResponse(smfd_cb->amf_hdl, invocation, result); done: - saAmfResponse(smfd_cb->amf_hdl, invocation, result); TRACE_LEAVE(); } diff --git a/osaf/services/saf/smfsv/smfd/smfd_cb.h b/osaf/services/saf/smfsv/smfd/smfd_cb.h --- a/osaf/services/saf/smfsv/smfd/smfd_cb.h +++ b/osaf/services/saf/smfsv/smfd/smfd_cb.h @@ -36,7 +36,7 @@ typedef struct smfd_cb { SaNameT comp_name; /* Components's name SMFD */ SaAmfHandleT amf_hdl; /* AMF handle, obtained thru AMF init */ SaInvocationT amf_invocation_id; /* AMF InvocationID - needed to handle Quiesed state */ - bool is_quisced_set; + bool is_quiesced_set; SaSelectionObjectT amfSelectionObject; /* Selection Object to wait for amf events */ SaImmOiHandleT campaignOiHandle; /* IMM Campaign OI handle */ SaSelectionObjectT campaignSelectionObject; /* Selection Object to wait for campaign IMM events */ diff --git a/osaf/services/saf/smfsv/smfd/smfd_evt.c b/osaf/services/saf/smfsv/smfd/smfd_evt.c --- a/osaf/services/saf/smfsv/smfd/smfd_evt.c +++ b/osaf/services/saf/smfsv/smfd/smfd_evt.c @@ -30,6 +30,7 @@ #include "smfsv_evt.h" void proc_callback_rsp(smfd_cb_t *, SMFSV_EVT *); +void proc_quiesced_ack(smfd_cb_t *, SMFSV_EVT *); /**************************************************************************** * Name : proc_mds_info @@ -125,6 +126,11 @@ void smfd_process_mbx(SYSF_MBX * mbx) proc_callback_rsp(smfd_cb, evt); break; } + case SMFD_EVT_QUIESCED_ACK: + { + proc_quiesced_ack(smfd_cb, evt); + break; + } default: { LOG_ER("SMFND received unknown event %d", @@ -202,3 +208,34 @@ void proc_callback_rsp(smfd_cb_t *cb, SM TRACE_LEAVE(); return; } + +/**************************************************************************** + * Name : proc_quiesced_ack + * + * Description : This is the function which is called when smfd receives an + * quiesced ack event from MDS + * + * Arguments : evt - Message that was posted to the SMFSV Mail box. + * + * Return Values : None + * + * Notes : None. + *****************************************************************************/ +void proc_quiesced_ack(smfd_cb_t *cb, SMFSV_EVT *evt) +{ + TRACE_ENTER(); + + if (cb->is_quiesced_set == true) { + /* Update control block */ + cb->is_quiesced_set = false; + cb->ha_state = SA_AMF_HA_QUIESCED; + + /* Respond to AMF */ + if (saAmfResponse(cb->amf_hdl, cb->amf_invocation_id, SA_AIS_OK) != SA_AIS_OK) { + LOG_ER("saAmfResponse failed"); + } + } else + LOG_ER("Received SMFD_EVT_QUIESCED_ACK message but is_quiesced_set==false"); + + TRACE_LEAVE(); +} diff --git a/osaf/services/saf/smfsv/smfd/smfd_mds.c b/osaf/services/saf/smfsv/smfd/smfd_mds.c --- a/osaf/services/saf/smfsv/smfd/smfd_mds.c +++ b/osaf/services/saf/smfsv/smfd/smfd_mds.c @@ -213,16 +213,22 @@ static uint32_t mds_rcv(struct ncsmds_ca static uint32_t mds_quiesced_ack(struct ncsmds_callback_info *mds_info) { - SMFSV_EVT *smfsv_evt; + SMFSV_EVT *smfsv_evt; - /** allocate an SMFSV_EVT now **/ + /** allocate an SMFSV_EVT now **/ if (NULL == (smfsv_evt = calloc(1, sizeof(SMFSV_EVT)))) { - LOG_WA("calloc FAILED"); + LOG_NO("calloc FAILED"); goto err; } - if (smfd_cb->is_quisced_set == true) { - { + if (smfd_cb->is_quiesced_set == true) { + /** Initialize the Event here **/ + smfsv_evt->type = SMFSV_EVT_TYPE_SMFD; + smfsv_evt->info.smfd.type = SMFD_EVT_QUIESCED_ACK; + smfsv_evt->cb_hdl = (uint32_t)mds_info->i_yr_svc_hdl; + + /* Push the event and we are done */ + if (NCSCC_RC_FAILURE == m_NCS_IPC_SEND(&smfd_cb->mbx, smfsv_evt, NCS_IPC_PRIORITY_VERY_HIGH)) { TRACE("ipc send failed"); smfsv_evt_destroy(smfsv_evt); goto err; ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel