예제 #1
0
static uns32 cpd_evt_mds_quiesced_ack_rsp(CPD_CB *cb, CPD_EVT *evt, CPSV_SEND_INFO *sinfo)
{
	uns32 rc = NCSCC_RC_SUCCESS;
	SaAisErrorT saErr = SA_AIS_OK;
	cpd_mbcsv_chgrole(cb);
	saAmfResponse(cb->amf_hdl, cb->amf_invocation, saErr);
	return rc;
}
예제 #2
0
void cpd_saf_csi_set_cb(SaInvocationT invocation,
			const SaNameT *compName, SaAmfHAStateT haState, SaAmfCSIDescriptorT csiDescriptor)
{
	CPD_CB *cb = 0;
	SaAisErrorT saErr = SA_AIS_OK;
	V_DEST_RL mds_role;
	/*  V_CARD_QA   anchor; */
	NCSVDA_INFO vda_info;
	uint32_t rc = NCSCC_RC_SUCCESS;
	CPD_CPND_INFO_NODE *node_info = NULL;
	MDS_DEST prev_dest;

	TRACE_ENTER();
	cb = ncshm_take_hdl(NCS_SERVICE_ID_CPD, gl_cpd_cb_hdl);
	if (cb) {

		if ((cb->ha_state == SA_AMF_HA_STANDBY) && (haState == SA_AMF_HA_ACTIVE)) {
			if (cb->cold_or_warm_sync_on == true) {
				TRACE("STANDBY cpd_saf_csi_set_cb -cb->cold_or_warm_sync_on == true ");
				saErr = SA_AIS_ERR_TRY_AGAIN;
				saAmfResponse(cb->amf_hdl, invocation, saErr);
				ncshm_give_hdl(cb->cpd_hdl);
				TRACE_4("cpd vdest change role failed");
				m_CPSV_DBG_SINK(NCSCC_RC_FAILURE,
						"cpd_role_change: Failed to send Error report to AMF for Active role assignment during Cold-Sync");
				return;
			}
		}

		if ((cb->ha_state == SA_AMF_HA_ACTIVE) && (haState == SA_AMF_HA_QUIESCED)) {
			if (cb->cold_or_warm_sync_on == true) {
				TRACE("ACTIVE cpd_saf_csi_set_cb -cb->cold_or_warm_sync_on == true ");
			}
		}

		/* cb->ha_state = haState; */

		/*     saAmfResponse(cb->amf_hdl, invocation, saErr); */

   		if (SA_AMF_HA_ACTIVE == haState) {
		        /** Change the MDS role **/
			cb->ha_state = haState;
			mds_role = V_DEST_RL_ACTIVE;
			TRACE("ACTIVE STATE");

			/* If this is the active server, become implementer again. */
			/* If this is the active Director, become implementer */
			saErr = immutil_saImmOiImplementerSet(cb->immOiHandle, implementer_name);
			if (saErr != SA_AIS_OK){
				LOG_ER("cpd immOiImplmenterSet failed with err = %u",saErr);
				exit(EXIT_FAILURE);
			}
			/*   anchor   = cb->cpd_anc; */
		} else if (SA_AMF_HA_QUIESCED == haState) {
			mds_role = V_DEST_RL_QUIESCED;
			cb->amf_invocation = invocation;
			cb->is_quiesced_set = true;
			memset(&vda_info, 0, sizeof(vda_info));

			vda_info.req = NCSVDA_VDEST_CHG_ROLE;
			vda_info.info.vdest_chg_role.i_vdest = cb->cpd_dest_id;
			/* vda_info.info.vdest_chg_role.i_anc = anchor; */
			vda_info.info.vdest_chg_role.i_new_role = mds_role;
			rc = ncsvda_api(&vda_info);
			if (NCSCC_RC_SUCCESS != rc) {
				m_LEAP_DBG_SINK_VOID;
				LOG_ER("cpd vdest change role failed");
				ncshm_give_hdl(cb->cpd_hdl);
				TRACE_LEAVE();
				return;
			}
			ncshm_give_hdl(cb->cpd_hdl);
			TRACE_2("cpd csi set cb success");
			TRACE_LEAVE();
			return;
		} else {
      		        /** Change the MDS role **/
		        cb->ha_state = haState;
			mds_role = V_DEST_RL_STANDBY;
			TRACE("STANDBY STATE");
			/*   anchor   = cb->cpd_anc; */
		}
		memset(&vda_info, 0, sizeof(vda_info));

		vda_info.req = NCSVDA_VDEST_CHG_ROLE;
		vda_info.info.vdest_chg_role.i_vdest = cb->cpd_dest_id;
		/* vda_info.info.vdest_chg_role.i_anc = anchor; */
		vda_info.info.vdest_chg_role.i_new_role = mds_role;
		rc = ncsvda_api(&vda_info);
		if (NCSCC_RC_SUCCESS != rc) {
			m_LEAP_DBG_SINK_VOID;
			LOG_ER("cpd vdest change role failed");
			ncshm_give_hdl(cb->cpd_hdl);
			TRACE_LEAVE();
			return;
		}
		if (cpd_mbcsv_chgrole(cb) != NCSCC_RC_SUCCESS) {
			TRACE_4("cpd mbcsv chgrole failed");
		}

		/** Set the CB's anchor value */
		/*      cb->cpd_anc= anchor;  */
		saAmfResponse(cb->amf_hdl, invocation, saErr);
		ncshm_give_hdl(cb->cpd_hdl);

		if (SA_AMF_HA_ACTIVE == cb->ha_state) {
			cpd_cpnd_info_node_getnext(&cb->cpnd_tree, NULL, &node_info);
			while (node_info) {
				prev_dest = node_info->cpnd_dest;
				if (node_info->timer_state == 2) {
					TRACE	
						("THE TIMER STATE IS 2 MEANS TIMER EXPIRED BUT STILL DID NOT GET ACTIVE STATE");
					cpd_process_cpnd_down(cb, &node_info->cpnd_dest);
				}
				cpd_cpnd_info_node_getnext(&cb->cpnd_tree, &prev_dest, &node_info);

			}
			TRACE_2("cpd csi set cb success I AM ACTIVE ");
		}
		if (SA_AMF_HA_STANDBY == cb->ha_state)
			TRACE_2("cpd csi set cb success I AM STANDBY");

	} else {
		TRACE_4("cpd donot exist");
	}
	TRACE_LEAVE();
	return;
}	/* End of cpd_saf_csi_set_cb() */