void ckptTerminate(SaInvocationT invocation, const SaNameT *compName) { SaAisErrorT rc = SA_AIS_OK; clLogWarning(CL_LOG_AREA_UNSPECIFIED, CL_LOG_CONTEXT_UNSPECIFIED,"Checkpoint service is stopping."); /* * Deregister with debug server. */ ckptDebugDeregister(gCkptSvr->eoHdl); /* * Wait for all the other threads to finalize */ clEoQueuesQuiesce(); /* * Deregister with cpm. */ rc = saAmfComponentUnregister(amfHandle, compName, NULL); /* * Cleanup the persistent DB information. */ /* Feature not supported -- see bug 6017 -- don't forget to uncomment ckptDataBackupInitialize()! ckptDataBackupFinalize(); */ /* * Cleanup resources taken by ckpt server. */ ckptShutDown(); /* Ok tell SAFplus that we handled it properly */ saAmfResponse(amfHandle, invocation, SA_AIS_OK); unblockNow = CL_TRUE; }
void clCompAppTerminate(SaInvocationT invocation, const SaNameT *compName) { SaAisErrorT rc = SA_AIS_OK; clprintf (CL_LOG_SEV_INFO, "Component [%.*s] : PID [%d]. Terminating\n", compName->length, compName->value, mypid); /* * Unregister with AMF and respond to AMF saying whether the * termination was successful or not. */ if ( (rc = saAmfComponentUnregister(amfHandle, compName, NULL)) != SA_AIS_OK) goto errorexit; saAmfResponse(amfHandle, invocation, SA_AIS_OK); clprintf (CL_LOG_SEV_INFO, "Component [%.*s] : PID [%d]. Terminated\n", compName->length, compName->value, mypid); unblockNow = CL_TRUE; return; errorexit: clprintf (CL_LOG_SEV_ERROR, "Component [%.*s] : PID [%d]. Termination error [0x%x]\n", compName->length, compName->value, mypid, rc); return; }
void safTerminate(SaInvocationT invocation, const SaNameT *compName) { SaAisErrorT rc = SA_AIS_OK; clprintf (CL_LOG_SEV_INFO, "Component [%.*s] : PID [%d]. Terminating\n", compName->length, compName->value, mypid); /* * Unregister with AMF and respond to AMF saying whether the * termination was successful or not. */ if ( (rc = saAmfComponentUnregister(amfHandle, compName, NULL)) != SA_AIS_OK) { clprintf (CL_LOG_SEV_ERROR, "Component [%.*s] : PID [%d]. Unregister failed with error [0x%x]\n", compName->length, compName->value, mypid, rc); return; } /* Ok tell SAFplus that we handled it properly */ saAmfResponse(amfHandle, invocation, SA_AIS_OK); clprintf (CL_LOG_SEV_INFO, "Component [%.*s] : PID [%d]. Terminated\n", compName->length, compName->value, mypid); clEvalAppLogStreamClose(gEvalLogStream); unblockNow = CL_TRUE; }
void clLogSvrTerminate(SaInvocationT invocation, const SaNameT *compName) { ClRcT rc = CL_OK; ClLogSvrEoDataT *pSvrEoEntry = NULL; //ClHandleT hCpm = CL_HANDLE_INVALID_VALUE; CL_LOG_DEBUG_TRACE(("Enter")); clLogInfo("SVR", "MAI", "Unregistering with cpm...... [%.*s]\n", compName->length, compName->value); gClLogSvrExiting = CL_TRUE; rc = clLogSvrEoEntryGet(&pSvrEoEntry, NULL); if( CL_OK != rc ) { return ; } //hCpm = pSvrEoEntry->hCpm; saAmfComponentUnregister(amfHandle,compName, NULL); #if 1 CL_LOG_CLEANUP(clLogSvrShutdown(), CL_OK); #endif saAmfResponse(amfHandle, invocation, SA_AIS_OK); CL_LOG_DEBUG_TRACE(("Exit")); unblockNow = CL_TRUE; //(void)hCpm; }
/**************************************************************************** Name : proxy_healthcheck_callback Description : This routine is a callback to perform the healthcheck and report any healthcheck failure to AMF. It is specified as a part of AMF initialization. It demonstrates the use of following AMF APIs: a) saAmfHealthcheckStop() b) saAmfComponentErrorReport() Arguments : inv - particular invocation of this callback function comp_name - ptr to the component name health_check_key - ptr to the healthcheck key for which the healthcheck is to be performed. Return Values : None. Notes : This routine responds to the healhcheck callbacks for AVSV_HEALTHCHECK_CALLBACK_MAX_COUNT times after which it sends an error report. ******************************************************************************/ void proxy_healthcheck_callback(SaInvocationT inv, const SaNameT *comp_name, SaAmfHealthcheckKeyT *health_check_key) { SaAisErrorT rc; static int healthcheck_count = 0; printf("\n Dispatched 'HealthCheck' Callback \n Component: %s \n HealthCheckKey: %s \n", comp_name->value, health_check_key->key); /* Respond immediately */ rc = saAmfResponse(pxy_pxd_cb.pxy_info.amfHandle, inv, SA_AIS_OK); if ( SA_AIS_OK != rc ) { saAmfComponentUnregister(pxy_pxd_cb.pxy_info.amfHandle, &pxy_pxd_cb.pxy_info.compName, 0); saAmfFinalize(pxy_pxd_cb.pxy_info.amfHandle); printf("\nsaAmfResponse returned failure for Health Check. Result %d\n",rc); return; } /* Increment healthcheck count */ healthcheck_count++; return; }
/**************************************************************************** * Name : eds_se_lib_destroy * * Description : Invoked to destroy the EDS * * * Arguments : * Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE.. * * Notes : None. *****************************************************************************/ static uint32_t eds_se_lib_destroy(NCS_LIB_REQ_INFO *req_info) { /** Code to destroy the EDS **/ EDS_CB *eds_cb; m_INIT_CRITICAL; TRACE_ENTER(); if (NULL == (eds_cb = (NCSCONTEXT)ncshm_take_hdl(NCS_SERVICE_ID_EDS, gl_eds_hdl))) { LOG_ER("Handle take failed for global handle"); TRACE_LEAVE(); return (NCSCC_RC_FAILURE); } else { m_START_CRITICAL; /** Lock EDA_CB **/ m_NCS_LOCK(&eds_cb->cb_lock, NCS_LOCK_WRITE); /* deregister from AMF */ saAmfComponentUnregister(eds_cb->amf_hdl, &eds_cb->comp_name, NULL); /* End association from the AMF lib */ saAmfFinalize(eds_cb->amf_hdl); /* Finalize with CLM */ saClmFinalize(eds_cb->clm_hdl); /* Clean up all internal structures */ eds_remove_reglist_entry(eds_cb, 0, true); /* Destroy the cb */ eds_cb_destroy(eds_cb); /* Give back the handle */ ncshm_give_hdl(gl_eds_hdl); ncshm_destroy_hdl(NCS_SERVICE_ID_GLD, gl_eds_hdl); /* Detach from IPC */ m_NCS_IPC_DETACH(&eds_cb->mbx, eds_clear_mbx, eds_cb); /* Disconnect from MDS */ eds_mds_finalize(eds_cb); /* Release the IPC */ m_NCS_IPC_RELEASE(&eds_cb->mbx, NULL); /** UnLock EDA_CB **/ m_NCS_UNLOCK(&eds_cb->cb_lock, NCS_LOCK_WRITE); m_NCS_LOCK_DESTROY(&eds_cb->cb_lock); m_MMGR_FREE_EDS_CB(eds_cb); gl_eds_hdl = 0; m_END_CRITICAL; TRACE("eds-cb-lib destroy done ."); } TRACE_LEAVE(); return (NCSCC_RC_SUCCESS); }
/**************************************************************************** * Name : cpd_amf_deregister * * Description : CPD deregisters with AMF for involking process. * * Arguments : cpd_cb - Ifsv control block pointer. * * Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE. * * Notes : None. *****************************************************************************/ uint32_t cpd_amf_deregister(CPD_CB *cpd_cb) { SaNameT comp_name = { 5, "CPD" }; if (saAmfComponentUnregister(cpd_cb->amf_hdl, &comp_name, (SaNameT *)NULL) == SA_AIS_OK) return NCSCC_RC_SUCCESS; else return NCSCC_RC_FAILURE; }
static void safTerminate(SaInvocationT invocation, const SaNameT *compName) { SaAisErrorT rc = SA_AIS_OK; if(gClMsgInit) { ClBoolT lockStatus = CL_TRUE; ClTimerTimeOutT timeout = {.tsSec = 0, .tsMilliSec = 0}; clOsalMutexLock(&gClMsgFinalizeLock); while(gClMsgSvcRefCnt > 0) { clOsalCondWait(&gClMsgFinalizeCond, &gClMsgFinalizeLock, timeout); } safMsgFinalize(&lockStatus); if(lockStatus) { clOsalMutexUnlock(&gClMsgFinalizeLock); } } rc = saAmfComponentUnregister(amfHandle, compName, NULL); clCpmClientFinalize(amfHandle); //clCpmResponse(cpmHandle, invocation, CL_OK); saAmfResponse(amfHandle, invocation, SA_AIS_OK); return; } static void clMsgRegisterWithCpm(void) { SaAisErrorT rc = SA_AIS_OK; SaAmfCallbacksT callbacks = {0}; SaVersionT version = {0}; version.releaseCode = 'B'; version.majorVersion = 0x01; version.minorVersion = 0x01; callbacks.saAmfHealthcheckCallback = NULL; callbacks.saAmfComponentTerminateCallback = safTerminate; callbacks.saAmfCSISetCallback = NULL; callbacks.saAmfCSIRemoveCallback = NULL; callbacks.saAmfProtectionGroupTrackCallback = NULL; rc = saAmfInitialize(&amfHandle, &callbacks, &version); if( rc != SA_AIS_OK) { clLogError("MSG", "INI", "saAmfInitialize failed with error code [0x%x].", rc); return ; } rc = saAmfComponentNameGet(amfHandle, &appName); rc = saAmfComponentRegister(amfHandle, &appName, NULL); }
/**************************************************************************** Name : proxy_csi_set_callback Description : This routine is a callback to set (add/modify) the HA state of a CSI (or all the CSIs) that is newly/already assigned to the component. It is specified as a part of AMF initialization. Arguments : inv - particular invocation of this callback function comp_name - ptr to the component name ha_state - ha state to be assumed by the CSI (or all the CSIs) csi_desc - CSI descriptor Return Values : None. Notes : None. ******************************************************************************/ void proxy_csi_set_callback(SaInvocationT inv, const SaNameT *comp_name, SaAmfHAStateT ha_state, SaAmfCSIDescriptorT csi_desc) { SaAmfHAStateT ha_st; SaAisErrorT rc = SA_AIS_OK; SaNameT *csi_name; uns8 trk_flags; uns32 index = 0; printf("\n'Proxy CSI Set' Callback \n Component: %s \n CSIName: %s \n HAState: %s \n CSIFlags: %s \n", comp_name->value, csi_desc.csiName.value, ha_state_str[ha_state], csi_flag_str[csi_desc.csiFlags]); switch(ha_state) { case SA_AMF_HA_ACTIVE: /* We need to register all the proxied component when becoming ACT */ pxy_pxd_cb.pxy_info.haState = ha_state; for(index=0; index<PXY_PXD_NUM_OF_PROXIED_COMP; index++) pxy_pxd_cb.pxd_info[index].reg_pxied_comp = TRUE; break; case SA_AMF_HA_QUIESCED: /* We need to unregister to all proxied components, if going to STDBY from ACT.*/ if(SA_AMF_HA_ACTIVE == pxy_pxd_cb.pxy_info.haState) { /* If previous HA state is ACT, then unregister all proxied comp. */ pxy_pxd_cb.unreg_pxied_comp = TRUE; } pxy_pxd_cb.pxy_info.haState = ha_state; break; case SA_AMF_HA_STANDBY: pxy_pxd_cb.pxy_info.haState = ha_state; break; default: rc=SA_AIS_ERR_FAILED_OPERATION; break; }; rc = saAmfResponse(pxy_pxd_cb.pxy_info.amfHandle, inv, rc); if ( SA_AIS_OK != rc ) { printf("\nsaAmfResponse returned failure for CSI Set. Result %d\n",rc); saAmfComponentUnregister(pxy_pxd_cb.pxy_info.amfHandle, &pxy_pxd_cb.pxy_info.compName, 0); saAmfFinalize(pxy_pxd_cb.pxy_info.amfHandle); return; } return; }
void clCompAppTerminate( SaInvocationT invocation, const SaNameT *compName) { SaAisErrorT rc = SA_AIS_OK; clprintf (CL_LOG_SEV_INFO, "Component [%.*s] : PID [%d]. Terminating\n", compName->length, compName->value, mypid); /* * Application should figure out whether the termination request * was for the proxy itself or one of its proxied components. * * In case the termination request was for a proxied component, * call the proxied specific termination function and unregister * the proxied component. * Otherwise, unregister the proxy component and * call the client finalize function. */ /* * ---BEGIN_APPLICATION_CODE--- */ // ... /* * ---END_APPLICATION_CODE--- */ /* * Unregister with AMF and send back a response */ if ( (rc = saAmfComponentUnregister(amfHandle, compName, NULL)) != SA_AIS_OK) goto errorexit; saAmfResponse(amfHandle, invocation, SA_AIS_OK); clprintf (CL_LOG_SEV_INFO, "Component [%.*s] : PID [%d]. Terminated\n", compName->length, compName->value, mypid); unblockNow = CL_TRUE; return; errorexit: clprintf (CL_LOG_SEV_ERROR, "Component [%.*s] : PID [%d]. Termination error [0x%x]\n", compName->length, compName->value, mypid, rc); return; }
/**************************************************************************** Name : avsv_amf_comp_terminate_callback Description : This routine is a callback to terminate the component. It is specified as a part of AMF initialization. Arguments : inv - particular invocation of this callback function comp_name - ptr to the component name Return Values : None. Notes : None ******************************************************************************/ void avsv_amf_comp_terminate_callback(SaInvocationT inv, const SaNameT *comp_name) { SaAisErrorT rc; syslog(LOG_INFO, "\n Dispatched 'Component Terminate' Callback \n Component: %s ", comp_name->value); /* Respond immediately */ rc = saAmfResponse(gl_amf_hdl, inv, SA_AIS_OK); if ( SA_AIS_OK != rc ) { syslog(LOG_ERR, "saAmfResponse FAILED - %u", rc); saAmfComponentUnregister(gl_amf_hdl, &gl_comp_name, 0); saAmfFinalize(gl_amf_hdl); } }
void clEventTerminate(SaInvocationT invocation, const SaNameT *compName) { clEvtFinalize(); /* No need to check error messages b/c cannot do anything about the errors anyway... am shutting down */ saAmfComponentUnregister(gClEvtAmfHandle, compName, NULL); saAmfResponse(gClEvtAmfHandle, invocation, SA_AIS_OK); unblockNow = CL_TRUE; }
/**************************************************************************** Name : proxy_comp_terminate_callback Description : This routine is a callback to terminate the component. It is specified as a part of AMF initialization. Arguments : inv - particular invocation of this callback function comp_name - ptr to the component name Return Values : None. Notes : None ******************************************************************************/ void proxy_comp_terminate_callback(SaInvocationT inv, const SaNameT *comp_name) { SaAisErrorT rc; printf("\n Proxy 'Component Terminate' Callback \n Component: %s \n", comp_name->value); rc = saAmfResponse(pxy_pxd_cb.pxy_info.amfHandle, inv, SA_AIS_OK); if ( SA_AIS_OK != rc ) { saAmfComponentUnregister(pxy_pxd_cb.pxy_info.amfHandle, &pxy_pxd_cb.pxy_info.compName, 0); saAmfFinalize(pxy_pxd_cb.pxy_info.amfHandle); printf("\nsaAmfResponse returned failure for Comp Terminate. Result %d\n",rc); } return; }
/**************************************************************************** * Name : cpnd_amf_deregister * * Description : CPND deregisters with AMF for involking process. * * Arguments : cpnd_cb - Ifsv control block pointer. * * Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE. * * Notes : None. *****************************************************************************/ uns32 cpnd_amf_deregister(CPND_CB *cpnd_cb) { SaNameT comp_name; SaAisErrorT error; /* get the component name */ error = saAmfComponentNameGet(cpnd_cb->amf_hdl, &comp_name); if (error != SA_AIS_OK) { m_LOG_CPND_CL(CPND_AMF_COMP_NAME_GET_FAILED, CPND_FC_HDLN, NCSFL_SEV_ERROR, __FILE__, __LINE__); return NCSCC_RC_FAILURE; } if (saAmfComponentUnregister(cpnd_cb->amf_hdl, &comp_name, (SaNameT *)NULL) == SA_AIS_OK) return NCSCC_RC_SUCCESS; else { m_LOG_CPND_CL(CPND_AMF_COMP_UNREG_FAILED, CPND_FC_GENERIC, NCSFL_SEV_ERROR, __FILE__, __LINE__); return NCSCC_RC_FAILURE; } }
int main (void) { SaAmfHandleT handle; int result; SaNameT compName; pthread_t dispatch_thread; pthread_attr_t dispatch_thread_attribute; result = saAmfInitialize (&handle, &amfCallbacks, &version); if (result != SA_OK) { printf ("initialize result is %d\n", result); exit (1); } setSanameT (&compName, "comp_b_in_su_y"); result = saAmfComponentRegister (&handle, &compName, NULL); printf ("register result is %d (should be 1)\n", result); pthread_attr_init (&dispatch_thread_attribute); pthread_attr_setschedpolicy (&dispatch_thread_attribute, SCHED_FIFO); // pthread_attr_setschedparam (&dispatch_thread_attribute, 99); pthread_create (&dispatch_thread, NULL, th_dispatch, &handle); sleep (5); printf ("Finalizing handle\n"); saAmfComponentUnregister (&handle, &compName, NULL); saAmfFinalize (&handle); printf ("Handle Finalized\n"); sleep (1); /* this sleep isn't really necessary */ result = saAmfInitialize (&handle, &amfCallbacks, &version); result = saAmfComponentRegister (&handle, &compName, NULL); pthread_create (&dispatch_thread, NULL, th_dispatch, &handle); sleep (10); // saAmfFinalize (&handle); exit (0); }
/**************************************************************************** Name : avsv_amf_csi_remove_callback Description : This routine is a callback to remove the CSI (or all the CSIs) that is/are assigned to the component. It is specified as a part of AMF initialization. Arguments : inv - particular invocation of this callback function comp_name - ptr to the component name csi_name - ptr to the CSI name that is being removed csi_flags - specifies if one or more CSIs are affected Return Values : None. Notes : None ******************************************************************************/ void avsv_amf_csi_remove_callback(SaInvocationT inv, const SaNameT *comp_name, const SaNameT *csi_name, SaAmfCSIFlagsT csi_flags) { SaAisErrorT rc; syslog(LOG_INFO, "\n Dispatched 'CSI Remove' Callback \n Component: %s \n CSI: %s \n CSIFlags: %s ", comp_name->value, csi_name->value, csi_flag_str[csi_flags]); /* Reset the ha state */ gl_ha_state = 0; /* Respond immediately */ rc = saAmfResponse(gl_amf_hdl, inv, SA_AIS_OK); if ( SA_AIS_OK != rc ) { syslog(LOG_ERR, "saAmfResponse FAILED - %u", rc); saAmfComponentUnregister(gl_amf_hdl, &gl_comp_name, 0); saAmfFinalize(gl_amf_hdl); } }
/* Unregistration and Finalization with AMF Library */ uns32 dts_amf_finalize(DTS_CB *dts_cb_inst) { SaAisErrorT status = SA_AIS_OK; /* delete the fd from the select list */ memset(&dts_cb_inst->dts_amf_sel_obj, 0, sizeof(SaSelectionObjectT)); /* Disable the health monitoring */ status = saAmfHealthcheckStop(dts_cb_inst->amf_hdl, &dts_cb_inst->comp_name, &dts_cb_inst->health_chk_key); if (status != SA_AIS_OK) { /* log the error */ m_DTS_DBG_SINK(NCSCC_RC_FAILURE, "dts_amf_finalize: Helath Check stop failed"); /* continue finalization */ } /* Unregister with AMF */ status = saAmfComponentUnregister(dts_cb_inst->amf_hdl, &dts_cb_inst->comp_name, NULL); if (status != SA_AIS_OK) { /* log the error */ m_DTS_DBG_SINK(NCSCC_RC_FAILURE, "dts_amf_finalize: Component unregistered failed!!"); /* continue finalization */ } /* Finalize */ status = saAmfFinalize(dts_cb_inst->amf_hdl); if (status != SA_AIS_OK) { /* log the error */ return m_DTS_DBG_SINK(NCSCC_RC_FAILURE, "dts_amf_finalize: Component Finalized failed!!"); } dts_cb_inst->amf_init = FALSE; m_LOG_DTS_API(DTS_AMF_FINALIZE); return NCSCC_RC_SUCCESS; }
/**************************************************************************** Name : proxy_csi_remove_callback Description : This routine is a callback to remove the CSI (or all the CSIs) that is/are assigned to the component. It is specified as a part of AMF initialization. Arguments : inv - particular invocation of this callback function comp_name - ptr to the component name csi_name - ptr to the CSI name that is being removed csi_flags - specifies if one or more CSIs are affected Return Values : None. Notes : None ******************************************************************************/ void proxy_csi_remove_callback(SaInvocationT inv, const SaNameT *comp_name, const SaNameT *csi_name, SaAmfCSIFlagsT csi_flags) { SaAisErrorT rc; printf("\n Proxy 'CSI Remove' Callback \n Component: %s \n CSI: %s \n CSIFlags: %s \n", comp_name->value, csi_name->value, csi_flag_str[csi_flags]); /* Reset the ha state */ pxy_pxd_cb.pxy_info.haState = 0; /* Respond immediately */ rc = saAmfResponse(pxy_pxd_cb.pxy_info.amfHandle, inv, SA_AIS_OK); if ( SA_AIS_OK != rc ) { saAmfComponentUnregister(pxy_pxd_cb.pxy_info.amfHandle, &pxy_pxd_cb.pxy_info.compName, 0); saAmfFinalize(pxy_pxd_cb.pxy_info.amfHandle); printf("\nsaAmfResponse returned failure for CSI Remove. Result %d\n",rc); } return; }
static void safTerminate(SaInvocationT invocation, const SaNameT *compName) { if(gClMsgInit) { ClBoolT lockStatus = CL_TRUE; ClTimerTimeOutT timeout = { 0, 0}; clOsalMutexLock(&gClMsgFinalizeLock); while(gClMsgSvcRefCnt > 0) { clOsalCondWait(&gClMsgFinalizeCond, &gClMsgFinalizeLock, timeout); } safMsgFinalize(&lockStatus); if(lockStatus) { clOsalMutexUnlock(&gClMsgFinalizeLock); } } IGNORE_RETURN(saAmfComponentUnregister(amfHandle, compName, NULL)); clCpmClientFinalize(amfHandle); //clCpmResponse(cpmHandle, invocation, CL_OK); saAmfResponse(amfHandle, invocation, SA_AIS_OK); return; }
/**************************************************************************** * Name : gld_se_lib_destroy * * Description : Invoked to destroy the GLD * * * Arguments : * Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE.. * * Notes : None. *****************************************************************************/ uns32 gld_se_lib_destroy(NCS_LIB_REQ_INFO *req_info) { GLSV_GLD_CB *gld_cb; if ((gld_cb = (NCSCONTEXT)ncshm_take_hdl(NCS_SERVICE_ID_GLD, gl_gld_hdl)) == NULL) { m_LOG_GLD_HEADLINE(GLD_TAKE_HANDLE_FAILED, NCSFL_SEV_ERROR, __FILE__, __LINE__, 0); return (NCSCC_RC_FAILURE); } else { /* Disconnect from MDS */ gld_mds_shut(gld_cb); saAmfComponentUnregister(gld_cb->amf_hdl, &gld_cb->comp_name, (SaNameT *)NULL); saAmfFinalize(gld_cb->amf_hdl); ncshm_give_hdl(gl_gld_hdl); ncshm_destroy_hdl(NCS_SERVICE_ID_GLD, gl_gld_hdl); m_NCS_IPC_DETACH(&gld_cb->mbx, gld_clear_mbx, gld_cb); gld_cb_destroy(gld_cb); m_MMGR_FREE_GLSV_GLD_CB(gld_cb); } return (NCSCC_RC_SUCCESS); }
/**************************************************************************** Name : avsv_amf_csi_set_callback Description : This routine is a callback to set (add/modify) the HA state of a CSI (or all the CSIs) that is newly/already assigned to the component. It is specified as a part of AMF initialization. It demonstrates the use of following AMF APIs: a) saAmfHAStateGet() b) saAmfHealthcheckStart() c) saAmfProtectionGroupTrack() d) saAmfComponentUnregister() e) saAmfFinalize() Arguments : inv - particular invocation of this callback function comp_name - ptr to the component name ha_state - ha state to be assumed by the CSI (or all the CSIs) csi_desc - CSI descriptor Return Values : None. Notes : This routine starts health check on the active entity. If the CSI transitions from standby to active, the demo is considered over & then the usage of 'Component Unregister' & 'AMF Finalize' is illustrated. ******************************************************************************/ void avsv_amf_csi_set_callback(SaInvocationT inv, const SaNameT *comp_name, SaAmfHAStateT ha_state, SaAmfCSIDescriptorT csi_desc) { SaAmfHAStateT ha_st; SaAisErrorT rc; SaAmfHealthcheckInvocationT hc_inv; SaAmfRecommendedRecoveryT rec_rcvr; SaNameT *csi_name; SaUint8T trk_flags; SaAmfProtectionGroupNotificationBufferT *not_buf; syslog(LOG_INFO, "Dispatched 'CSI Set' Callback for Component: '%s'", comp_name->value); syslog(LOG_INFO, "\tCSIName: %s \n HAState: %s \n CSIFlags: %s ", csi_desc.csiName.value, ha_state_str[ha_state], csi_flag_str[csi_desc.csiFlags]); /* Store the ha state */ gl_ha_state = ha_state; /* Respond immediately */ rc = saAmfResponse(gl_amf_hdl, inv, SA_AIS_OK); if ( SA_AIS_OK != rc ) { syslog(LOG_ERR, "saAmfResponse FAILED - %u", rc); saAmfComponentUnregister(gl_amf_hdl, &gl_comp_name, 0); saAmfFinalize(gl_amf_hdl); return; } /* * If ha-state is active & it's a new assignment, demonstrate the usage * of ha-state-get & start healthcheck */ if ( (SA_AMF_HA_ACTIVE == ha_state) && (SA_AMF_CSI_NEW_ASSIGN == csi_desc.csiStateDescriptor.activeDescriptor.transitionDescriptor) ) { /*###################################################################### Demonstrating the use of saAmfHAStateGet() ######################################################################*/ syslog(LOG_INFO, "INVOKING saAmfHAStateGet() API !!!"); sleep(2); rc = saAmfHAStateGet(gl_amf_hdl, &gl_comp_name, &csi_desc.csiName, &ha_st); if ( SA_AIS_OK != rc ) { syslog(LOG_ERR, "saAmfHAStateGet FAILED - %u", rc); saAmfComponentUnregister(gl_amf_hdl, &gl_comp_name, 0); saAmfFinalize(gl_amf_hdl); return; } syslog(LOG_INFO, "CompName: %s \n CSIName: %s \n HAState: %s ", gl_comp_name.value, csi_desc.csiName.value, ha_state_str[ha_st]); /*###################################################################### Demonstrating the use of saAmfHealthcheckStart() ######################################################################*/ syslog(LOG_INFO, "DEMONSTRATING AMF-INITIATED HEALTHCHECK !!!"); sleep(2); /* Fill the healthcheck parameters */ hc_inv = SA_AMF_HEALTHCHECK_AMF_INVOKED; rec_rcvr = SA_AMF_COMPONENT_FAILOVER; /* Start the Healthcheck */ rc = saAmfHealthcheckStart(gl_amf_hdl, &gl_comp_name, &gl_healthcheck_key, hc_inv, rec_rcvr); if ( SA_AIS_OK != rc ) { syslog(LOG_ERR, "saAmfHealthcheckStart FAILED - %u", rc); saAmfComponentUnregister(gl_amf_hdl, &gl_comp_name, 0); saAmfFinalize(gl_amf_hdl); return; } syslog(LOG_INFO, "Started AMF-Initiated HealthCheck (with Component Failover Recommended Recovery) \n Comp: %s \n HealthCheckKey: %s ", gl_comp_name.value, gl_healthcheck_key.key); } /* * If ha-state is standby, start tracking the protection group * associated with this CSI & initiate counter reading from the active */ if ( SA_AMF_HA_STANDBY == ha_state ) { /*###################################################################### Demonstrating the use of saAmfProtectionGroupTrack() ######################################################################*/ /* Fill the protection group track parameters */ csi_name = &csi_desc.csiName; trk_flags = SA_TRACK_CHANGES_ONLY; not_buf = NULL; /* Start Tracking the Protection Group */ rc = saAmfProtectionGroupTrack(gl_amf_hdl, csi_name, trk_flags, not_buf); if ( SA_AIS_OK != rc ) { syslog(LOG_ERR, "saAmfProtectionGroupTrack FAILED - %u", rc); saAmfComponentUnregister(gl_amf_hdl, &gl_comp_name, 0); saAmfFinalize(gl_amf_hdl); return; } syslog(LOG_INFO, "\n Started Protection Group Tracking \n CSI: %s \n Track Flags: Changes Only ", csi_name->value); } /* If ha-state is active & it is a result of failover, stop the demo */ if ( (SA_AMF_HA_ACTIVE == ha_state) && (SA_AMF_CSI_NEW_ASSIGN != csi_desc.csiStateDescriptor.activeDescriptor.transitionDescriptor) ) { syslog(LOG_INFO, "\n\n DEMO OVER (UNREGISTER & FINALIZE THE COMPONENT) !!! "); /*###################################################################### Demonstrating the use of saAmfComponentUnregister() ######################################################################*/ sleep(15); rc = saAmfComponentUnregister(gl_amf_hdl, &gl_comp_name, 0); if ( SA_AIS_OK != rc ) { syslog(LOG_ERR, "saAmfComponentUnregister FAILED - %u", rc); return; } syslog(LOG_INFO, " Component UnRegistered !!! "); /*###################################################################### Demonstrating the use of saAmfFinalize() ######################################################################*/ sleep(2); rc = saAmfFinalize(gl_amf_hdl); if ( SA_AIS_OK != rc ) { syslog(LOG_ERR, "saAmfFinalize FAILED - %u", rc); return; } syslog(LOG_INFO, " AMF Finalize Done !!! "); /* Reset the ha state */ gl_ha_state = 0; } }
ClRcT clLogSvrInitialize(ClUint32T argc,ClCharT *argv[]) { SaAmfCallbacksT callbacks = {0}; SaVersionT version; ClRcT rc = CL_OK; ClLogSvrEoDataT *pSvrEoEntry = NULL; ClBoolT *pCookie = NULL; ClIocAddressT invalidAddr = {{0}}; clLogCompName =(ClCharT*) "LOG"; /* Override generated eo name with a short name for our server */ gClLogServer = CL_FALSE; /* Mark me as the log server */ clLogInfo(CL_LOG_AREA_UNSPECIFIED, CL_LOG_CONTEXT_UNSPECIFIED, "Log Server initialization started..."); clAppConfigure(&clEoConfig,clEoBasicLibs,clEoClientLibs); version.releaseCode = 'B'; version.majorVersion = 0x01; version.minorVersion = 0x01; callbacks.saAmfHealthcheckCallback = NULL; /* rarely necessary because SAFplus monitors the process */ callbacks.saAmfComponentTerminateCallback = clLogSvrTerminate; callbacks.saAmfCSISetCallback = NULL; callbacks.saAmfCSIRemoveCallback = NULL; callbacks.saAmfProtectionGroupTrackCallback = NULL; callbacks.saAmfProxiedComponentInstantiateCallback = NULL; callbacks.saAmfProxiedComponentCleanupCallback = NULL; rc = saAmfInitialize(&amfHandle, &callbacks, &version); if( SA_AIS_OK != rc ) { CL_LOG_DEBUG_ERROR(("saAmfInitialize(): rc[0x %x]", rc)); return rc; } #if defined(CL_DEBUG) && defined(CL_DEBUG_START) clLogDebugLevelSet(); #endif CL_LOG_DEBUG_TRACE(("Enter")); clLogSvrMutexModeSet(); /* * Here dummy initialization of Idl handle to avoid mutiple database * Initialization & finalization databases. Keeping this handle alive * will avoid this. coz Idl library will delete the handle database if the * handle count becomes zero. Mutiple times we are initializing & deleting * the handles in our log service usage. */ rc = clLogIdlHandleInitialize(invalidAddr, &shLogDummyIdl); if( CL_OK != rc ) { return rc; } rc = clLogSvrCommonDataInit(); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clLogSvrCommonDataInit(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clIdlHandleFinalize(shLogDummyIdl), CL_OK); return rc; } rc = clLogStreamOwnerLocalBootup(); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clLogStreamOwnerLocalInit(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clLogSvrCommonDataFinalize(), CL_OK); CL_LOG_CLEANUP(clIdlHandleFinalize(shLogDummyIdl), CL_OK); return rc; } pCookie = (ClBoolT*) clHeapCalloc(1, sizeof(ClBoolT)); if( NULL == pCookie ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc()")); CL_LOG_CLEANUP(clLogStreamOwnerLocalShutdown(), CL_OK); CL_LOG_CLEANUP(clLogStreamOwnerEoDataFree(), CL_OK); CL_LOG_CLEANUP(clLogSvrCommonDataFinalize(), CL_OK); CL_LOG_CLEANUP(clIdlHandleFinalize(shLogDummyIdl), CL_OK); return CL_LOG_RC(CL_ERR_NO_MEMORY); } *pCookie = CL_FALSE; rc = clLogSvrBootup(pCookie); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clLogSvrDataInit(): rc[0x %x]", rc)); clHeapFree(pCookie); CL_LOG_CLEANUP(clLogStreamOwnerLocalShutdown(), CL_OK); CL_LOG_CLEANUP(clLogSvrCommonDataFinalize(), CL_OK); CL_LOG_CLEANUP(clIdlHandleFinalize(shLogDummyIdl), CL_OK); return rc; } clLogInfo(CL_LOG_AREA_UNSPECIFIED, CL_LOG_CONTEXT_UNSPECIFIED, "Log server boot type is [%s]", (*pCookie == 1)? "Restart": "Normal"); rc = clLogSvrEoEntryGet(&pSvrEoEntry, NULL); if( CL_OK != rc ) { CL_LOG_CLEANUP(clLogSvrEoDataFinalize(), CL_OK); CL_LOG_CLEANUP(clLogSvrEoDataFree(), CL_OK); clHeapFree(pCookie); CL_LOG_CLEANUP(clLogStreamOwnerLocalShutdown(), CL_OK); CL_LOG_CLEANUP(clLogStreamOwnerEoDataFree(), CL_OK); CL_LOG_CLEANUP(clLogSvrCommonDataFinalize(), CL_OK); CL_LOG_CLEANUP(clIdlHandleFinalize(shLogDummyIdl), CL_OK); return rc; } pSvrEoEntry->hCpm = amfHandle; rc = saAmfComponentNameGet(amfHandle, &logServerName); if( SA_AIS_OK != rc ) { CL_LOG_DEBUG_ERROR(("saAmfComponentNameGet(): rc[0x %x]", rc)); saAmfFinalize(amfHandle); CL_LOG_CLEANUP(clLogSvrEoDataFinalize(), CL_OK); CL_LOG_CLEANUP(clLogSvrEoDataFree(), CL_OK); clHeapFree(pCookie); CL_LOG_CLEANUP(clLogStreamOwnerLocalShutdown(), CL_OK); CL_LOG_CLEANUP(clLogStreamOwnerEoDataFree(), CL_OK); CL_LOG_CLEANUP(clLogSvrCommonDataFinalize(), CL_OK); CL_LOG_CLEANUP(clIdlHandleFinalize(shLogDummyIdl), CL_OK); return rc; } rc = saAmfComponentRegister(amfHandle, &logServerName, NULL); if( SA_AIS_OK != rc ) { CL_LOG_DEBUG_ERROR(("saAmfComponentRegister(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clLogSvrEoDataFinalize(), CL_OK); CL_LOG_CLEANUP(clLogSvrEoDataFree(), CL_OK); clHeapFree(pCookie); CL_LOG_CLEANUP(clLogStreamOwnerLocalShutdown(), CL_OK); CL_LOG_CLEANUP(clLogStreamOwnerEoDataFree(), CL_OK); CL_LOG_CLEANUP(clLogSvrCommonDataFinalize(), CL_OK); CL_LOG_CLEANUP(clIdlHandleFinalize(shLogDummyIdl), CL_OK); saAmfFinalize(amfHandle); return rc; } pSvrEoEntry->hTimer = CL_HANDLE_INVALID_VALUE; if( CL_FALSE == *pCookie ) { rc = clLogSvrTimerDeleteNStart(pSvrEoEntry, pCookie); } else { rc = clLogTimerCallback((void *) pCookie); } if( CL_OK != rc ) { saAmfComponentUnregister(amfHandle, &logServerName, NULL); CL_LOG_CLEANUP(clLogSvrEoDataFinalize(), CL_OK); CL_LOG_CLEANUP(clLogSvrEoDataFree(), CL_OK); clHeapFree(pCookie); CL_LOG_CLEANUP(clLogStreamOwnerLocalShutdown(), CL_OK); CL_LOG_CLEANUP(clLogStreamOwnerEoDataFree(), CL_OK); CL_LOG_CLEANUP(clLogSvrCommonDataFinalize(), CL_OK); CL_LOG_CLEANUP(clIdlHandleFinalize(shLogDummyIdl), CL_OK); saAmfFinalize(amfHandle); return rc; } rc = clLogDebugRegister(); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clLogDebugRegister(): rc[0x %x]", rc)); } clLogNotice(CL_LOG_AREA_UNSPECIFIED, CL_LOG_CONTEXT_UNSPECIFIED, "Log Server partially up"); CL_LOG_DEBUG_TRACE(("Exit")); return CL_OK; }
/**************************************************************************** Name : avsv_amf_healthcheck_callback Description : This routine is a callback to perform the healthcheck and report any healthcheck failure to AMF. It is specified as a part of AMF initialization. It demonstrates the use of following AMF APIs: a) saAmfHealthcheckStop() b) saAmfComponentErrorReport() Arguments : inv - particular invocation of this callback function comp_name - ptr to the component name health_check_key - ptr to the healthcheck key for which the healthcheck is to be performed. Return Values : None. Notes : This routine responds to the healhcheck callbacks for AVSV_HEALTHCHECK_CALLBACK_MAX_COUNT times after which it sends an error report. ******************************************************************************/ void avsv_amf_healthcheck_callback(SaInvocationT inv, const SaNameT *comp_name, SaAmfHealthcheckKeyT *health_check_key) { SaAisErrorT rc; static int healthcheck_count = 0; syslog(LOG_INFO, "\n Dispatched 'HealthCheck' Callback \n Component: %s \n HealthCheckKey: %s ", comp_name->value, health_check_key->key); /* Respond immediately */ rc = saAmfResponse(gl_amf_hdl, inv, SA_AIS_OK); if ( SA_AIS_OK != rc ) { syslog(LOG_ERR, "saAmfResponse FAILED - %u", rc); saAmfComponentUnregister(gl_amf_hdl, &gl_comp_name, 0); saAmfFinalize(gl_amf_hdl); return; } /* Increment healthcheck count */ healthcheck_count++; /* Send the Error Report */ if (AMF_HEALTHCHECK_CALLBACK_MAX_COUNT == healthcheck_count) { /*###################################################################### Demonstrating the use of saAmfHealthcheckStop() ######################################################################*/ rc = saAmfHealthcheckStop(gl_amf_hdl, &gl_comp_name, &gl_healthcheck_key); if ( SA_AIS_OK != rc ) { syslog(LOG_ERR, "saAmfHealthcheckStop FAILED - %u", rc); saAmfComponentUnregister(gl_amf_hdl, &gl_comp_name, 0); saAmfFinalize(gl_amf_hdl); return; } syslog(LOG_INFO, "\n Stopped HealthCheck for Comp: %s with HealthCheckKey: %s ", gl_comp_name.value, gl_healthcheck_key.key); /*###################################################################### Demonstrating the use of saAmfComponentErrorReport() ######################################################################*/ syslog(LOG_INFO, "\n\n DEMONSTRATING COMPONENT FAILOVER THROUGH ERROR REPORT !!! "); sleep(2); rc = saAmfComponentErrorReport(gl_amf_hdl, &gl_comp_name, 0, SA_AMF_COMPONENT_FAILOVER, 0); if ( SA_AIS_OK != rc ) { syslog(LOG_ERR, "saAmfComponentErrorReport FAILED - %u", rc); saAmfComponentUnregister(gl_amf_hdl, &gl_comp_name, 0); saAmfFinalize(gl_amf_hdl); return; } syslog(LOG_INFO, "\n Sent Error Report for Comp: %s with CompFailover as the recommended recovery ", gl_comp_name.value); /* Reset the ha state */ gl_ha_state = 0; } }
/**************************************************************************** Name : pxy_pxd_amf_process Description : This routine is an entry point for the AMF interface task. It demonstrates the use of following AMF APIs a) saAmfInitialize b) saAmfSelectionObjectGet c) saAmfCompNameGet d) saAmfComponentRegister e) saAmfDispatch Arguments : None. Return Values : None. Notes : None ******************************************************************************/ void pxy_pxd_amf_process (void) { SaAisErrorT rc; NCS_SEL_OBJ_SET wait_sel_objs, all_sel_objs; SaSelectionObjectT pxy_amf_sel_obj,pxd_amf_sel_obj[PXY_PXD_NUM_OF_PROXIED_COMP]; NCS_SEL_OBJ pxy_amf_ncs_sel_obj,pxd_amf_ncs_sel_obj[PXY_PXD_NUM_OF_PROXIED_COMP]; NCS_SEL_OBJ highest_sel_obj,wait_sel_fd; int ret = 0; uns32 comp_inv_hc_time_out = 500; uns32 index = 0; /* this is to allow to establish MDS session with AvSv */ m_NCS_TASK_SLEEP(3000); pxy_pxd_proxy_initialize(); rc = pxy_pxd_proxy_amf_init(); if (SA_AIS_OK != rc) return; for(index = 0; index < PXY_PXD_NUM_OF_PROXIED_COMP; index++) rc = pxy_pxd_proxied_amf_init(index); if (SA_AIS_OK != rc) return; /* Get the selection object corresponding to this AMF handle */ rc = saAmfSelectionObjectGet(pxy_pxd_cb.pxy_info.amfHandle, &pxy_amf_sel_obj); if (SA_AIS_OK != rc) { saAmfFinalize(pxy_pxd_cb.pxy_info.amfHandle); return; } for(index = 0; index < PXY_PXD_NUM_OF_PROXIED_COMP; index++) { /* Get the selection object corresponding to this AMF handle */ rc = saAmfSelectionObjectGet(pxy_pxd_cb.pxd_info[index].amfHandle, &pxd_amf_sel_obj[index]); if (SA_AIS_OK != rc) { saAmfFinalize(pxy_pxd_cb.pxy_info.amfHandle); printf("\n AMF Selection Object Get Failed for index %d !!!\n",index); return; } } printf("\n AMF Selection Object Get Successful !!! \n"); rc = saAmfComponentNameGet(pxy_pxd_cb.pxy_info.amfHandle, &pxy_pxd_cb.pxy_info.compName); if (SA_AIS_OK != rc) { saAmfFinalize(pxy_pxd_cb.pxy_info.amfHandle); return; } printf("\n Component Name Get Successful !!! \n CompName: %s \n", pxy_pxd_cb.pxy_info.compName.value); rc = saAmfComponentRegister(pxy_pxd_cb.pxy_info.amfHandle, &pxy_pxd_cb.pxy_info.compName, 0); if (SA_AIS_OK != rc) { saAmfFinalize(pxy_pxd_cb.pxy_info.amfHandle); return; } printf("\n Proxy Component Registered !!! \n"); /* Reset the wait select objects */ m_NCS_SEL_OBJ_ZERO(&all_sel_objs); m_SET_FD_IN_SEL_OBJ((uns32)pxy_amf_sel_obj, pxy_amf_ncs_sel_obj); m_NCS_SEL_OBJ_SET(pxy_amf_ncs_sel_obj, &all_sel_objs); highest_sel_obj = pxy_amf_ncs_sel_obj; for(index = 0; index < PXY_PXD_NUM_OF_PROXIED_COMP; index++) { m_SET_FD_IN_SEL_OBJ((uns32)pxd_amf_sel_obj[index], pxd_amf_ncs_sel_obj[index]); m_NCS_SEL_OBJ_SET(pxd_amf_ncs_sel_obj[index], &all_sel_objs); highest_sel_obj = m_GET_HIGHER_SEL_OBJ(highest_sel_obj, pxd_amf_ncs_sel_obj[index]); } wait_sel_objs = all_sel_objs; wait_sel_fd = highest_sel_obj; /* Now wait forever */ while ((ret = m_NCS_SEL_OBJ_SELECT(wait_sel_fd, &wait_sel_objs, NULL, NULL, &comp_inv_hc_time_out)) != -1) { comp_inv_hc_time_out = 500; /* Check if it's an event from AMF */ if(m_NCS_SEL_OBJ_ISSET(pxy_amf_ncs_sel_obj, &wait_sel_objs)) { printf("\n Got Proxy AMF event!!! \n"); /* There is an AMF callback waiting to be be processed. Process it */ rc = saAmfDispatch(pxy_pxd_cb.pxy_info.amfHandle, SA_DISPATCH_ALL); if (SA_AIS_OK != rc) { printf("\n Proxy saAmfDispatch failed !!! \n"); break; } } for(index = 0; index < PXY_PXD_NUM_OF_PROXIED_COMP; index++) { if(TRUE == pxy_pxd_cb.pxd_info[index].reg_pxied_comp) { printf("\n Before registering pxd[%d]!!!\n",index); /* Need to register proxied component */ rc = saAmfComponentRegister(pxy_pxd_cb.pxd_info[index].amfHandle, &pxy_pxd_cb.pxd_info[index].compName, &pxy_pxd_cb.pxy_info.compName); if (SA_AIS_OK == rc) { printf("\n Proxied[%d] Component Registeration Successful. " "Comp %s. rc is %d\n",index, pxy_pxd_cb.pxd_info[index].compName.value,rc); pxy_pxd_cb.pxd_info[index].health_start = TRUE; pxy_pxd_cb.pxd_info[index].reg_pxied_comp = FALSE; } else if (SA_AIS_ERR_TRY_AGAIN == rc) { printf("\n Proxied[%d] Component Registeration failed. TRY_AGAIN" " Comp %s. rc is %d\n",index, pxy_pxd_cb.pxd_info[index].compName.value,rc); } else { printf("\n Proxied[%d] Component Registeration failed." " Comp %s. rc is %d\n",index, pxy_pxd_cb.pxd_info[index].compName.value,rc); pxy_pxd_cb.pxd_info[index].reg_pxied_comp = FALSE; } } } /* if(TRUE == pxy_pxd_cb.reg_pxied_comp) */ /* Section 1 Starts : Health Check : SA_AMF_HEALTHCHECK_AMF_INVOKED */ { SaAmfHealthcheckInvocationT hc_inv; SaAmfRecommendedRecoveryT rec_rcvr; for(index = 0; index < PXY_PXD_NUM_OF_PROXIED_COMP; index++) { if(TRUE == pxy_pxd_cb.pxd_info[index].health_start) { printf("\n Before registering hc [%d]!!!\n",index); hc_inv = SA_AMF_HEALTHCHECK_AMF_INVOKED; rec_rcvr = SA_AMF_COMPONENT_FAILOVER; rc = saAmfHealthcheckStart(pxy_pxd_cb.pxd_info[index].amfHandle, &pxy_pxd_cb.pxd_info[index].compName, &pxy_pxd_cb.pxd_info[index].healthcheck_key, hc_inv, rec_rcvr); if (SA_AIS_OK == rc ) { printf("Started AMF-Initiated HealthCheck (with Component " "Failover Recommended Recovery) \n Comp: %s \n" "HealthCheckKey: %s \n", pxy_pxd_cb.pxd_info[index].compName.value, pxy_pxd_cb.pxd_info[index].healthcheck_key.key); pxy_pxd_cb.pxd_info[index].health_start = FALSE; pxy_pxd_cb.pxd_info[index].health_start_comp_inv = TRUE; } else if(SA_AIS_ERR_TRY_AGAIN == rc) { printf(" AMF-Initiated HealthCheck TRY_AGAIN (with Component" " Failover Recommended Recovery) \n Comp: %s \n" "HealthCheckKey: %s. Res %d \n", pxy_pxd_cb.pxd_info[index].compName.value, pxy_pxd_cb.pxd_info[index].healthcheck_key.key, rc); } else { printf(" AMF-Initiated HealthCheck failed (with Component " "Failover Recommended Recovery) \n Comp: %s \n" "HealthCheckKey: %s. Res %d \n", pxy_pxd_cb.pxd_info[index].compName.value, pxy_pxd_cb.pxd_info[index].healthcheck_key.key, rc); pxy_pxd_cb.pxd_info[index].health_start = FALSE; } } /* if(TRUE == pxy_pxd_cb.pxd_info[index].health_start)*/ } } /* Section 1 Ends : Health Check : SA_AMF_HEALTHCHECK_AMF_INVOKED */ if(TRUE == pxy_pxd_cb.unreg_pxied_comp) { for(index = 0; index < PXY_PXD_NUM_OF_PROXIED_COMP; index++) { printf("\n Before unregistering PXD[%d]!!! \n",index); /* Need to unregister proxied component */ rc = saAmfComponentUnregister(pxy_pxd_cb.pxd_info[index].amfHandle, &pxy_pxd_cb.pxd_info[index].compName, &pxy_pxd_cb.pxy_info.compName); if (SA_AIS_OK != rc) { printf("\n Proxied Component unreg failed. Comp %s, Pxy Comp %s, Res %d\n", pxy_pxd_cb.pxd_info[index].compName.value, pxy_pxd_cb.pxy_info.compName.value,rc); } else printf("\n Proxied Component unreg Succ. Comp %s, Pxy Comp %s\n", pxy_pxd_cb.pxd_info[index].compName.value, pxy_pxd_cb.pxy_info.compName.value); pxy_pxd_cb.unreg_pxied_comp = FALSE; pxy_pxd_cb.pxd_info[index].health_start_comp_inv = FALSE; } } for(index = 0; index < PXY_PXD_NUM_OF_PROXIED_COMP; index++) { /* Check if it's an event from AMF */ if(m_NCS_SEL_OBJ_ISSET(pxd_amf_ncs_sel_obj[index], &wait_sel_objs)) { printf("\n Before Pxd dispatch PXD[%d] !!!\n",index); /* There is an AMF callback waiting to be be processed. Process it */ rc = saAmfDispatch(pxy_pxd_cb.pxd_info[index].amfHandle, SA_DISPATCH_ONE); if (SA_AIS_OK != rc) { printf("\n PXD[%d] saAmfDispatch failed !!! \n",index); break; } } } /* Again set AMF select object to wait for another callback */ wait_sel_objs = all_sel_objs; wait_sel_fd = highest_sel_obj; }/* While loop */ printf("\n\n Proxy Exited, ret %d!!!\n\n",ret); return; }
void clGmsServerTerminate(SaInvocationT invocation, const SaNameT *compName) { ClRcT rc = CL_OK; gmsGlobalInfo.opState = CL_GMS_STATE_SHUTING_DOWN; clLog(CRITICAL,GEN,NA, "Got termination request for component [%.*s]. Started Shutting Down...", compName->length,compName->value); rc = clEoClientUninstallTables (gmsGlobalInfo.gmsEoObject, CL_EO_SERVER_SYM_MOD(gAspFuncTable, GMS)); if (rc != CL_OK) { clLog(ERROR,GEN,NA, "clEoClientUninstall failed with rc = 0x%x", rc); } /* * Unregister with AMF and respond to AMF saying whether the * termination was successful or not. */ rc = clDebugDeregister(gGmsDebugReg); if (rc != CL_OK) { clLog(ERROR,GEN,NA, "clDebugDeregister failed with rc = 0x%x", rc); } /* Close the leader election algorithm dl if open */ #ifndef VXWORKS_BUILD if (pluginHandle != NULL) { dlclose(pluginHandle); } #endif if(gClTotemRunning) { /* We need to invoke openais finalize function instead of signal * handler here */ totempg_finalize(); /* Waiting for 10ms before invoking exit() */ usleep(10000); } clLog(CRITICAL,GEN,NA, "GMS server exiting"); rc = clHandleDatabaseDestroy(contextHandleDatabase); if (rc != CL_OK) { clLog(ERROR,GEN,NA, "contextHandleDatabase destroy failed with Rc = 0x%x",rc); } rc = saAmfComponentUnregister(amfHandle, compName, NULL); if(rc != SA_AIS_OK) { clLog(ERROR,GEN,NA, "saAmfComponentUnregister failed with rc = 0x%x", rc); } rc = saAmfFinalize(amfHandle); if (rc != SA_AIS_OK) { clLog(ERROR,GEN,NA, "saAmfFinalize failed with rc = 0x%x", rc); } /* Ok tell SAFplus that we handled it properly */ rc = saAmfResponse(amfHandle, invocation, SA_AIS_OK); if (rc != SA_AIS_OK) { clLog(ERROR,GEN,NA, "clCpmResponse failed with rc = 0x%x", rc); } unblockNow = CL_TRUE; }
/**************************************************************************** Name : avsv_amf_protection_group_callback Description : This routine is a callback to notify the application of any changes in the protection group. It demonstrates the use of following AMF APIs: a) saAmfProtectionGroupTrackStop() b) saAmfPmStart() c) saAmfPmStop() Arguments : csi_name - ptr to the csi-name not_buf - ptr to the notification buffer mem_num - number of components that belong to this protection group err - error code Return Values : None. Notes : None. ******************************************************************************/ void avsv_amf_protection_group_callback(const SaNameT *csi_name, SaAmfProtectionGroupNotificationBufferT *not_buf, SaUint32T mem_num, SaAisErrorT err) { unsigned int item_count; pid_t pid; SaAmfPmErrorsT pm_err; SaAmfRecommendedRecoveryT rec_rcvr; SaAmfPmStopQualifierT stop_qual; SaAisErrorT rc; syslog(LOG_INFO, "\n Dispatched 'Protection Group' Callback \n CSI: %s \n No. of Members: %d ", csi_name->value, mem_num); if ( SA_AIS_OK != err ) return; /* Print the Protection Group members */ for (item_count= 0; item_count < not_buf->numberOfItems; item_count++) { syslog(LOG_INFO, " CompName[%d]: %s ", item_count, not_buf->notification[item_count].member.compName.value); syslog(LOG_INFO, " Rank[%d] : %d ", item_count, not_buf->notification[item_count].member.rank); syslog(LOG_INFO, " HAState[%d] : %s ", item_count, ha_state_str[not_buf->notification[item_count].member.haState]); syslog(LOG_INFO, " Change[%d] : %s ", item_count, pg_change_str[not_buf->notification[item_count].change]); } /*###################################################################### Demonstrating the use of saAmfProtectionGroupTrackStop() ######################################################################*/ rc = saAmfProtectionGroupTrackStop(gl_amf_hdl, csi_name); if ( SA_AIS_OK != rc ) { syslog(LOG_ERR, "saAmfProtectionGroupTrackStop FAILED - %u", rc); saAmfComponentUnregister(gl_amf_hdl, &gl_comp_name, 0); saAmfFinalize(gl_amf_hdl); return; } syslog(LOG_INFO, "\n Stopped Protection Group Tracking for CSI: %s ", csi_name->value); /*###################################################################### Demonstrating the use of saAmfPmStart() ######################################################################*/ /* Fill the `Passive Monitoring Start' parameters */ pid = getpid(); pm_err = SA_AMF_PM_NON_ZERO_EXIT; rec_rcvr = SA_AMF_COMPONENT_RESTART; /* Start Passive Monitoring */ rc = saAmfPmStart(gl_amf_hdl, &gl_comp_name, pid, 0, pm_err, rec_rcvr); if ( SA_AIS_OK != rc ) { syslog(LOG_ERR, "saAmfPmStart FAILED - %u", rc); saAmfComponentUnregister(gl_amf_hdl, &gl_comp_name, 0); saAmfFinalize(gl_amf_hdl); return; } syslog(LOG_INFO, "\n Started Passive Monitoring for Comp: %s ", gl_comp_name.value); /*###################################################################### Demonstrating the use of saAmfPmStop() ######################################################################*/ /* Fill the `Passive Monitoring Stop' parameters */ pid = getpid(); pm_err = SA_AMF_PM_NON_ZERO_EXIT; stop_qual = SA_AMF_PM_PROC; /* Start Passive Monitoring */ rc = saAmfPmStop(gl_amf_hdl, &gl_comp_name, stop_qual, pid, pm_err); if ( SA_AIS_OK != rc ) { syslog(LOG_ERR, "saAmfPmStop FAILED - %u", rc); saAmfComponentUnregister(gl_amf_hdl, &gl_comp_name, 0); saAmfFinalize(gl_amf_hdl); return; } syslog(LOG_INFO, "\n Stopped Passive Monitoring for Comp: %s ", gl_comp_name.value); }
/**************************************************************************** Name : avsv_amf_process Description : This routine is an entry point for the AMF interface task. It demonstrates the use of following AMF APIs a) saAmfInitialize b) saAmfSelectionObjectGet c) saAmfCompNameGet d) saAmfComponentRegister e) saAmfDispatch Arguments : None. Return Values : None. Notes : None ******************************************************************************/ void *avsv_amf_process (void* dummy) { SaAmfCallbacksT reg_callback_set; SaVersionT ver; SaAisErrorT rc; SaSelectionObjectT amf_sel_obj; struct pollfd fds[1]; syslog(LOG_INFO, " AMF thread entered"); /*######################################################################### Demonstrating the use of saAmfInitialize() #########################################################################*/ /* Fill the callbacks that are to be registered with AMF */ memset(®_callback_set, 0, sizeof(SaAmfCallbacksT)); reg_callback_set.saAmfCSISetCallback = avsv_amf_csi_set_callback; reg_callback_set.saAmfCSIRemoveCallback = avsv_amf_csi_remove_callback; reg_callback_set.saAmfHealthcheckCallback = avsv_amf_healthcheck_callback; reg_callback_set.saAmfComponentTerminateCallback = avsv_amf_comp_terminate_callback; reg_callback_set.saAmfProtectionGroupTrackCallback = avsv_amf_protection_group_callback; /* Fill the AMF version */ m_AMF_VER_GET(ver); /* Initialize AMF */ rc = saAmfInitialize(&gl_amf_hdl, ®_callback_set, &ver); if (SA_AIS_OK != rc) { syslog(LOG_ERR, " saAmfInitialize FAILED %u", rc); goto done; } syslog(LOG_INFO, "AMF Initialization Done !!!"); syslog(LOG_INFO, "\tAmfHandle: %llx ", gl_amf_hdl); /*######################################################################### Demonstrating the use of saAmfSelectionObjectGet() #########################################################################*/ /* Get the selection object corresponding to this AMF handle */ rc = saAmfSelectionObjectGet(gl_amf_hdl, &amf_sel_obj); if (SA_AIS_OK != rc) { syslog(LOG_ERR, "saAmfSelectionObjectGet FAILED %u", rc); saAmfFinalize(gl_amf_hdl); goto done; } syslog(LOG_INFO, "AMF Selection Object Get Successful !!!"); /*######################################################################### Demonstrating the use of saAmfCompNameGet() #########################################################################*/ rc = saAmfComponentNameGet(gl_amf_hdl, &gl_comp_name); if (SA_AIS_OK != rc) { syslog(LOG_ERR, "saAmfComponentNameGet FAILED %u", rc); saAmfFinalize(gl_amf_hdl); goto done; } syslog(LOG_INFO, "Component Name Get Successful !!!"); syslog(LOG_INFO, "\tCompName: %s", gl_comp_name.value); /*######################################################################### Demonstrating the use of saAmfComponentRegister() #########################################################################*/ rc = saAmfComponentRegister(gl_amf_hdl, &gl_comp_name, 0); if (SA_AIS_OK != rc) { syslog(LOG_ERR, "saAmfComponentRegister FAILED %u", rc); saAmfFinalize(gl_amf_hdl); goto done; } syslog(LOG_INFO, "Component Registered !!!"); fds[0].fd = amf_sel_obj; fds[0].events = POLLIN; /***** Now wait on the AMF selection object *****/ while (1) { int res = poll(fds, 1, -1); if (res == -1) { if (errno == EINTR) continue; else { syslog(LOG_ERR, "poll FAILED - %s", strerror(errno)); exit(1); } } /*###################################################################### Demonstrating the use of saAmfDispatch() ######################################################################*/ if (fds[0].revents & POLLIN) { /* There is an AMF callback waiting to be be processed. Process it */ rc = saAmfDispatch(gl_amf_hdl, SA_DISPATCH_ONE); if (SA_AIS_OK != rc) { syslog(LOG_ERR, "saAmfDispatch FAILED %u", rc); saAmfComponentUnregister(gl_amf_hdl, &gl_comp_name, 0); saAmfFinalize(gl_amf_hdl); break; } } } syslog(LOG_INFO, "DEMO OVER !!!"); done: return NULL; }
/**************************************************************************** * Name : gld_se_lib_init * * Description : Invoked to Initialize the GLD * * * Arguments : * Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE.. * * Notes : None. *****************************************************************************/ uns32 gld_se_lib_init(NCS_LIB_REQ_INFO *req_info) { GLSV_GLD_CB *gld_cb; SaAisErrorT amf_error; uns32 res = NCSCC_RC_SUCCESS; SaAmfHealthcheckKeyT Healthy; int8 *health_key; /* Register with Logging subsystem */ if (NCS_GLSV_LOG == 1) gld_flx_log_reg(); /* Allocate and initialize the control block */ gld_cb = m_MMGR_ALLOC_GLSV_GLD_CB; if (gld_cb == NULL) { m_LOG_GLD_MEMFAIL(GLD_CB_ALLOC_FAILED, __FILE__, __LINE__); return NCSCC_RC_FAILURE; } memset(gld_cb, 0, sizeof(GLSV_GLD_CB)); /* TBD- Pool id is to be set */ gl_gld_hdl = gld_cb->my_hdl = ncshm_create_hdl(gld_cb->hm_poolid, NCS_SERVICE_ID_GLD, (NCSCONTEXT)gld_cb); if (0 == gld_cb->my_hdl) { m_LOG_GLD_HEADLINE(GLD_CREATE_HANDLE_FAILED, NCSFL_SEV_ERROR, __FILE__, __LINE__, 0); m_MMGR_FREE_GLSV_GLD_CB(gld_cb); return NCSCC_RC_FAILURE; } /* Initialize the cb parameters */ if (gld_cb_init(gld_cb) != NCSCC_RC_SUCCESS) { m_MMGR_FREE_GLSV_GLD_CB(gld_cb); return NCSCC_RC_FAILURE; } /* Initialize amf framework */ if (gld_amf_init(gld_cb) != NCSCC_RC_SUCCESS) { m_LOG_GLD_SVC_PRVDR(GLD_AMF_INIT_ERROR, NCSFL_SEV_ERROR, __FILE__, __LINE__); m_MMGR_FREE_GLSV_GLD_CB(gld_cb); return NCSCC_RC_FAILURE; } m_LOG_GLD_SVC_PRVDR(GLD_AMF_INIT_SUCCESS, NCSFL_SEV_INFO, __FILE__, __LINE__); /* Bind to MDS */ if (gld_mds_init(gld_cb) != NCSCC_RC_SUCCESS) { saAmfFinalize(gld_cb->amf_hdl); m_MMGR_FREE_GLSV_GLD_CB(gld_cb); m_LOG_GLD_SVC_PRVDR(GLD_MDS_INSTALL_FAIL, NCSFL_SEV_ERROR, __FILE__, __LINE__); return NCSCC_RC_FAILURE; } else m_LOG_GLD_SVC_PRVDR(GLD_MDS_INSTALL_SUCCESS, NCSFL_SEV_INFO, __FILE__, __LINE__); /* Initialise with the MBCSV service */ if (glsv_gld_mbcsv_register(gld_cb) != NCSCC_RC_SUCCESS) { m_LOG_GLD_MBCSV(GLD_MBCSV_INIT_FAILED, NCSFL_SEV_ERROR, __FILE__, __LINE__); gld_mds_shut(gld_cb); saAmfFinalize(gld_cb->amf_hdl); m_MMGR_FREE_GLSV_GLD_CB(gld_cb); return NCSCC_RC_FAILURE; } else { m_LOG_GLD_MBCSV(GLD_MBCSV_INIT_SUCCESS, NCSFL_SEV_INFO, __FILE__, __LINE__); } /* register glsv with imm */ amf_error = gld_imm_init(gld_cb); if (amf_error != SA_AIS_OK) { glsv_gld_mbcsv_unregister(gld_cb); gld_mds_shut(gld_cb); saAmfFinalize(gld_cb->amf_hdl); m_MMGR_FREE_GLSV_GLD_CB(gld_cb); gld_log(NCSFL_SEV_ERROR, "Imm Init Failed %u\n", amf_error); return NCSCC_RC_FAILURE; } /* TASK CREATION AND INITIALIZING THE MAILBOX */ if ((m_NCS_IPC_CREATE(&gld_cb->mbx) != NCSCC_RC_SUCCESS) || (m_NCS_IPC_ATTACH(&gld_cb->mbx) != NCSCC_RC_SUCCESS) || (m_NCS_TASK_CREATE((NCS_OS_CB)gld_main_process, &gld_cb->mbx, "GLD", m_GLD_TASK_PRIORITY, m_GLD_STACKSIZE, &gld_cb->task_hdl) != NCSCC_RC_SUCCESS) || (m_NCS_TASK_START(gld_cb->task_hdl) != NCSCC_RC_SUCCESS)) { m_LOG_GLD_HEADLINE(GLD_IPC_TASK_INIT, NCSFL_SEV_ERROR, __FILE__, __LINE__, 0); saImmOiFinalize(gld_cb->immOiHandle); glsv_gld_mbcsv_unregister(gld_cb); gld_mds_shut(gld_cb); saAmfFinalize(gld_cb->amf_hdl); m_NCS_TASK_RELEASE(gld_cb->task_hdl); m_NCS_IPC_RELEASE(&gld_cb->mbx, NULL); m_MMGR_FREE_GLSV_GLD_CB(gld_cb); return (NCSCC_RC_FAILURE); } m_NCS_EDU_HDL_INIT(&gld_cb->edu_hdl); /* register GLD component with AvSv */ amf_error = saAmfComponentRegister(gld_cb->amf_hdl, &gld_cb->comp_name, (SaNameT *)NULL); if (amf_error != SA_AIS_OK) { m_LOG_GLD_SVC_PRVDR(GLD_AMF_REG_ERROR, NCSFL_SEV_ERROR, __FILE__, __LINE__); m_NCS_EDU_HDL_FLUSH(&gld_cb->edu_hdl); m_NCS_TASK_RELEASE(gld_cb->task_hdl); m_NCS_IPC_RELEASE(&gld_cb->mbx, NULL); saImmOiFinalize(gld_cb->immOiHandle); glsv_gld_mbcsv_unregister(gld_cb); gld_mds_shut(gld_cb); saAmfFinalize(gld_cb->amf_hdl); m_MMGR_FREE_GLSV_GLD_CB(gld_cb); return NCSCC_RC_FAILURE; } else m_LOG_GLD_SVC_PRVDR(GLD_AMF_REG_SUCCESS, NCSFL_SEV_INFO, __FILE__, __LINE__); /** start the AMF health check **/ memset(&Healthy, 0, sizeof(Healthy)); health_key = (int8 *)getenv("GLSV_ENV_HEALTHCHECK_KEY"); if (health_key == NULL) { if (strlen("A1B2") < sizeof(Healthy.key)) strncpy((char *)Healthy.key, "A1B2", sizeof(Healthy.key)); m_LOG_GLD_HEADLINE(GLD_HEALTH_KEY_DEFAULT_SET, NCSFL_SEV_INFO, __FILE__, __LINE__, 0); } else { if (strlen((char *)health_key) < sizeof(Healthy.key)) strncpy((char *)Healthy.key, (char *)health_key, SA_AMF_HEALTHCHECK_KEY_MAX - 1); } Healthy.keyLen = strlen((char *)Healthy.key); amf_error = saAmfHealthcheckStart(gld_cb->amf_hdl, &gld_cb->comp_name, &Healthy, SA_AMF_HEALTHCHECK_AMF_INVOKED, SA_AMF_COMPONENT_FAILOVER); if (amf_error != SA_AIS_OK) { m_LOG_GLD_SVC_PRVDR(GLD_AMF_HLTH_CHK_START_FAIL, NCSFL_SEV_ERROR, __FILE__, __LINE__); saAmfComponentUnregister(gld_cb->amf_hdl, &gld_cb->comp_name, (SaNameT *)NULL); m_NCS_EDU_HDL_FLUSH(&gld_cb->edu_hdl); m_NCS_TASK_RELEASE(gld_cb->task_hdl); m_NCS_IPC_RELEASE(&gld_cb->mbx, NULL); saImmOiFinalize(gld_cb->immOiHandle); glsv_gld_mbcsv_unregister(gld_cb); gld_mds_shut(gld_cb); saAmfFinalize(gld_cb->amf_hdl); m_MMGR_FREE_GLSV_GLD_CB(gld_cb); } else m_LOG_GLD_SVC_PRVDR(GLD_AMF_HLTH_CHK_START_DONE, NCSFL_SEV_INFO, __FILE__, __LINE__); return (res); }
/************************************************************************** * FUNCTION: Java_org_opensaf_ais_amf_ComponentRegistryImpl_unregisterProxiedComponent * TYPE: native method * Class: ais_amf_ComponentRegistry * Method: unregisterProxiedComponent * Signature: (Ljava/lang/String;)V *************************************************************************/ JNIEXPORT void JNICALL Java_org_opensaf_ais_amf_ComponentRegistryImpl_unregisterProxiedComponent( JNIEnv* jniEnv, jobject thisComponentRegistry, jstring proxiedComponentName ) { SaNameT _saProxyComponentName; SaNameT _saProxiedComponentName; SaNameT* _saProxiedComponentNamePtr = &_saProxiedComponentName; SaAmfHandleT _saAmfHandle; SaAisErrorT _saStatus; // JNI jobject _amfLibraryHandle; jstring _thisComponentName; // BODY assert( thisComponentRegistry != NULL ); _TRACE2( "NATIVE: Executing Java_org_opensaf_ais_amf_ComponentRegistryImpl_unregisterProxiedComponent(...)\n" ); // get Java library handle _amfLibraryHandle = (*jniEnv)->GetObjectField( jniEnv, thisComponentRegistry, FID_amfLibraryHandle ); assert( _amfLibraryHandle != NULL ); // get native library handle _saAmfHandle = (SaAmfHandleT) (*jniEnv)->GetLongField( jniEnv, _amfLibraryHandle, FID_saAmfHandle ); // get Java component name _thisComponentName = (*jniEnv)->GetObjectField( jniEnv, thisComponentRegistry, FID_componentName ); // copy Java component name object if( JNU_copyFromStringToSaNameT_NotNull( jniEnv, _thisComponentName, &_saProxyComponentName ) != JNI_TRUE ){ return; // EXIT POINT! Exception pending... } // copy Java proxied component name object if( JNU_copyFromStringToSaNameT( jniEnv, proxiedComponentName, &_saProxiedComponentNamePtr ) != JNI_TRUE ){ return; // EXIT POINT! Exception pending... } // call saAmfComponentUnregister _saStatus = saAmfComponentUnregister( _saAmfHandle, _saProxiedComponentNamePtr, &_saProxyComponentName ); _TRACE2( "NATIVE: saAmfComponentUnregister(...) has returned with %d...\n", _saStatus ); // error handling if( _saStatus != SA_AIS_OK ){ switch( _saStatus ){ case SA_AIS_ERR_LIBRARY: JNU_throwNewByName( jniEnv, "org/saforum/ais/AisLibraryException", AIS_ERR_LIBRARY_MSG ); break; case SA_AIS_ERR_TIMEOUT: JNU_throwNewByName( jniEnv, "org/saforum/ais/AisTimeoutException", AIS_ERR_TIMEOUT_MSG ); break; case SA_AIS_ERR_TRY_AGAIN: JNU_throwNewByName( jniEnv, "org/saforum/ais/AisTryAgainException", AIS_ERR_TRY_AGAIN_MSG ); break; case SA_AIS_ERR_BAD_HANDLE: JNU_throwNewByName( jniEnv, "org/saforum/ais/AisBadHandleException", AIS_ERR_BAD_HANDLE_MSG ); break; case SA_AIS_ERR_INVALID_PARAM: JNU_throwNewByName( jniEnv, "org/saforum/ais/AisInvalidParamException", AIS_ERR_INVALID_PARAM_MSG ); break; case SA_AIS_ERR_NO_MEMORY: JNU_throwNewByName( jniEnv, "org/saforum/ais/AisNoMemoryException", AIS_ERR_NO_MEMORY_MSG ); break; case SA_AIS_ERR_NO_RESOURCES: JNU_throwNewByName( jniEnv, "org/saforum/ais/AisNoResourcesException", AIS_ERR_NO_RESOURCES_MSG ); break; case SA_AIS_ERR_NOT_EXIST: JNU_throwNewByName( jniEnv, "org/saforum/ais/AisNotExistException", AIS_ERR_NOT_EXIST_MSG ); break; case SA_AIS_ERR_BAD_OPERATION: JNU_throwNewByName( jniEnv, "org/saforum/ais/AisBadOperationException", AIS_ERR_BAD_OPERATION_MSG ); break; default: // this should not happen here! assert( JNI_FALSE ); JNU_throwNewByName( jniEnv, "org/saforum/ais/AisLibraryException", AIS_ERR_LIBRARY_MSG ); break; } return; // EXIT POINT! Exception pending... } _TRACE2( "NATIVE: Java_org_opensaf_ais_amf_ComponentRegistryImpl_unregisterProxiedComponent(...) returning normally\n" ); }