示例#1
0
/****************************************************************************
 * Name          : amf_quiesced_state_handler
 *
 * Description   : This function is called upon receving an Quiesced state
 *                 assignment from AMF.
 *
 * Arguments     : invocation - Designates a particular invocation.
 *                 cb         - A pointer to the SMFD control block. 
 *
 * Return Values : None
 *
 * Notes         : None
 *****************************************************************************/
static SaAisErrorT amf_quiesced_state_handler(smfd_cb_t * cb,
					      SaInvocationT invocation)
{
	TRACE_ENTER();
	V_DEST_RL mds_role;
	SaAisErrorT rc = SA_AIS_OK;

	/* Terminate threads and finalize the OI handle */
	if (campaign_oi_deactivate(cb) != NCSCC_RC_SUCCESS) {
		LOG_NO("amf_quiesced_state_handler oi deactivate FAILED, continue");
	}

	/*
	 ** Change the MDS VDSET role to Quiesced. Wait for MDS callback with type
	 ** MDS_CALLBACK_QUIESCED_ACK. Don't change cb->ha_state now.
	 */
	mds_role = cb->mds_role;
	cb->mds_role = V_DEST_RL_QUIESCED;
	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_quiesced_set = true;
done:
	TRACE_LEAVE();
	return rc;
}
示例#2
0
/****************************************************************************
 * Name          : smfd_mds_init
 *
 * Description   : This function .
 *
 * Arguments     : cb   : SMFD control Block pointer.
 *
 * Return Values : NCSCC_RC_SUCCESS/Error Code.
 *
 * Notes         : None.
 *****************************************************************************/
uint32_t smfd_mds_init(smfd_cb_t * cb)
{
	uint32_t rc;

	TRACE_ENTER();

	/* Create the VDEST for SMFD */
	rc = mds_vdest_create(cb);
	if (rc != NCSCC_RC_SUCCESS) {
		LOG_ER(" smfd_mds_init: named vdest create FAILED\n");
		goto done;
	}

	/* Register MDS communication */
	rc = mds_register(cb);
	if (rc != NCSCC_RC_SUCCESS) {
		LOG_ER(" smfd_mds_init: mds register FAILED\n");
		goto done;
	}

	/* Set the role of MDS */
	if (cb->ha_state == SA_AMF_HA_ACTIVE)
		cb->mds_role = V_DEST_RL_ACTIVE;
	else
		cb->mds_role = V_DEST_RL_STANDBY;

	rc = smfd_mds_change_role(cb);
	if (rc != NCSCC_RC_SUCCESS) {
		LOG_ER("MDS role change to %d FAILED\n", cb->mds_role);
		goto done;
	}

 done:
	TRACE_LEAVE();
	return rc;
}
示例#3
0
/****************************************************************************
 * Name          : amf_csi_set_callback
 *
 * Description   : AMF callback function called 
 *                 when there is any change in the HA state.
 *
 * Arguments     : invocation     - This parameter designated a particular 
 *                                  invocation of this callback function. The 
 *                                  invoke process return invocation when it 
 *                                  responds to the Avilability Management 
 *                                  FrameWork using the saAmfResponse() 
 *                                  function.
 *                 compName       - A pointer to the name of the component 
 *                                  whose readiness stae the Availability 
 *                                  Management Framework is setting.
 *                 haState        - The new HA state to be assumeb by the 
 *                                  component service instance identified by 
 *                                  csiName.
 *                 csiDescriptor - This will indicate whether or not the 
 *                                  component service instance for 
 *                                  ativeCompName went through quiescing.
 *
 * Return Values : None.
 *
 * Notes         : None.
 *****************************************************************************/
static void amf_csi_set_callback(SaInvocationT invocation,
				 const SaNameT * compName,
				 SaAmfHAStateT new_haState,
				 SaAmfCSIDescriptorT csiDescriptor)
{
	SaAisErrorT result = SA_AIS_OK;
	SaAmfHAStateT prev_haState;
	bool role_change = true;
	uint32_t rc = NCSCC_RC_SUCCESS;

	TRACE_ENTER();

	/*
	 *  Handle Active to Active role change.
	 */
	prev_haState = smfd_cb->ha_state;

	/* Invoke the appropriate state handler routine */
	switch (new_haState) {
	case SA_AMF_HA_ACTIVE:
		result = amf_active_state_handler(smfd_cb, invocation);
		break;
	case SA_AMF_HA_STANDBY:
		result = amf_standby_state_handler(smfd_cb, invocation);
		break;
	case SA_AMF_HA_QUIESCED:
		result = amf_quiesced_state_handler(smfd_cb, invocation);
		break;
	case SA_AMF_HA_QUIESCING:
		result = amf_quiescing_state_handler(smfd_cb, invocation);
		break;
	default:
		LOG_WA("invalid state: %d ", new_haState);
		result = SA_AIS_ERR_BAD_OPERATION;
		break;
	}

	if (result != SA_AIS_OK)
		goto response;

	if (new_haState == SA_AMF_HA_QUIESCED)
 	        /* AMF response will be done later when MDS quiesced ack has been received */
		goto done;

	/* Update control block */
	smfd_cb->ha_state = new_haState;

        /* Handle active to active role change. */
        if ((prev_haState == SA_AMF_HA_ACTIVE) && (new_haState == SA_AMF_HA_ACTIVE))
                role_change = false;

        /* Handle Stby to Stby role change. */
        if ((prev_haState == SA_AMF_HA_STANDBY) && (new_haState == SA_AMF_HA_STANDBY))
                role_change = false;

	if (role_change == true) {
		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:
	TRACE_LEAVE();
}