本文整理汇总了C++中saAmfResponse函数的典型用法代码示例。如果您正苦于以下问题:C++ saAmfResponse函数的具体用法?C++ saAmfResponse怎么用?C++ saAmfResponse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了saAmfResponse函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadinessStateSetCallback
void ReadinessStateSetCallback (SaInvocationT invocation,
const SaNameT *compName,
SaAmfReadinessStateT readinessState)
{
switch (readinessState) {
case SA_AMF_IN_SERVICE:
printf ("ReadinessStateSetCallback: '");
printSaNameT ((SaNameT *)compName);
printf ("' requested to enter operational state SA_AMF_IN_SERVICE.\n");
saAmfResponse (invocation, SA_OK);
break;
case SA_AMF_OUT_OF_SERVICE:
printf ("ReadinessStateSetCallback: '");
printSaNameT ((SaNameT *)compName);
printf ("' requested to enter operational state SA_AMF_OUT_OF_SERVICE.\n");
saAmfResponse (invocation, SA_OK);
break;
case SA_AMF_STOPPING:
printf ("ReadinessStateSetCallback: '");
printSaNameT ((SaNameT *)compName);
printf ("' requested to enter operational state SA_AMF_STOPPING.\n");
saAmfStoppingComplete (invocation, SA_OK);
break;
}
}
示例2: CSISetCallback
void CSISetCallback (
SaInvocationT invocation,
const SaNameT *compName,
SaAmfHAStateT haState,
SaAmfCSIDescriptorT *csiDescriptor)
{
int res;
switch (haState) {
case SA_AMF_HA_ACTIVE:
printf ("CSISetCallback:");
printf ("for CSI '");
printSaNameT ((SaNameT *)&csiDescriptor->csiName);
printf ("' for component ");
printSaNameT ((SaNameT *)compName);
printf ("'");
printf (" requested to enter hastate SA_AMF_ACTIVE.\n");
res = saAmfResponse (handle, invocation, SA_AIS_OK);
break;
case SA_AMF_HA_STANDBY:
printf ("CSISetCallback:");
printf ("for CSI '");
printSaNameT ((SaNameT *)compName);
printf ("' for component ");
printSaNameT ((SaNameT *)compName);
printf ("'");
printf (" requested to enter hastate SA_AMF_STANDBY.\n");
saAmfResponse (handle, invocation, SA_AIS_OK);
break;
}
}
示例3: amf_healthcheck_callback
/**
* AMF invoked this callback periodically to assess our health.
*
* @param inv
* @param comp_name
* @param health_check_key
*/
static void amf_healthcheck_callback(SaInvocationT inv,
const SaNameT *comp_name,
SaAmfHealthcheckKeyT *health_check_key)
{
SaAisErrorT rc, status = SA_AIS_OK;
static int healthcheck_count = 0;
healthcheck_count++;
syslog(LOG_DEBUG, "Health check %u", healthcheck_count);
/* Check the status of our service but only if active */
if ((my_ha_state == SA_AMF_HA_ACTIVE) && (foo_healthcheck() != 0)) {
/* 7.8.2 - an error report should be done before returning failed op */
rc = saAmfComponentErrorReport(my_amf_hdl, &my_comp_name, 0,
SA_AMF_COMPONENT_RESTART, SA_NTF_IDENTIFIER_UNUSED);
if (rc != SA_AIS_OK) {
syslog(LOG_ERR, "saAmfComponentErrorReport FAILED - %u", rc);
exit(1);
}
status = SA_AIS_ERR_FAILED_OPERATION;
}
rc = saAmfResponse(my_amf_hdl, inv, status);
if (rc != SA_AIS_OK) {
syslog(LOG_ERR, "saAmfResponse FAILED - %u", rc);
exit(1);
}
}
示例4: ckptTerminate
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;
}
示例5: clCompAppAMFCSIRemove
void
clCompAppAMFCSIRemove(
SaInvocationT invocation,
const SaNameT *compName,
const SaNameT *csiName,
SaAmfCSIFlagsT csiFlags)
{
/*
* Print information about the CSI Remove
*/
clprintf (CL_LOG_SEV_INFO, "Component [%.*s] : PID [%d]. CSI Remove Received\n",
compName->length, compName->value, mypid);
clprintf (CL_LOG_SEV_INFO, " CSI : %.*s\n", csiName->length, csiName->value);
clprintf (CL_LOG_SEV_INFO, " CSI Flags : 0x%d\n", csiFlags);
/*
* Add application specific logic for removing the work for this CSI.
*/
saAmfResponse(amfHandle, invocation, SA_AIS_OK);
return;
}
开发者ID:mrv-communications-pilot,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:26,代码来源:clProxyCompAppMain.c
示例6: clCompAppAMFCSIRemove
static void clCompAppAMFCSIRemove(SaInvocationT invocation,
const SaNameT *compName,
const SaNameT *csiName,
SaAmfCSIFlagsT csiFlags)
{
clprintf (CL_LOG_SEV_INFO, "Node Addr [%d] Component [%s] : PID [%d]. CSI Remove Received\n", ASP_NODEADDR, compName->value, mypid);
clprintf (CL_LOG_SEV_INFO, " CSI : %s\n", csiName->value);
clprintf (CL_LOG_SEV_INFO, " CSI Flags : 0x%d\n", csiFlags);
/*
* Add application specific logic for removing the work for this CSI.
*/
/*
* ---BEGIN_APPLICATION_CODE---
*/
clPyGlueCsiRemove(compName, csiName, csiFlags);
/*
* ---END_APPLICATION_CODE---
*/
saAmfResponse(amfHandle, invocation, SA_AIS_OK);
return;
}
示例7: clCompAppAMFCSISet
static void clCompAppAMFCSISet(SaInvocationT invocation,
const SaNameT *compName,
SaAmfHAStateT haState,
SaAmfCSIDescriptorT csiDescriptor)
{
/*
* ---BEGIN_APPLICATION_CODE---
*/
clprintf (CL_LOG_SEV_INFO, "Component [%s] : PID [%d]. CSISet called\n", compName->value, mypid);
clPyGlueCsiSet(compName, haState,&csiDescriptor);
clprintf (CL_LOG_SEV_INFO, "Component [%s] : PID [%d]. PyGlueCsiSet() returned OK\n", compName->value, mypid);
/* if (haState != SA_AMF_HA_QUIESCING) */
saAmfResponse(amfHandle, invocation, SA_AIS_OK);
/* GAS TODO: put in a separate python-visible callback */
if (haState == SA_AMF_HA_QUIESCING) saAmfCSIQuiescingComplete(amfHandle, invocation, SA_AIS_OK);
/*
* ---END_APPLICATION_CODE---
*/
/*
* Print information about the CSI Set
*/
clprintf (CL_LOG_SEV_INFO, "Component [%s] : PID [%d]. CSI Set Received\n",
compName->value, mypid);
clCompAppAMFPrintCSI(csiDescriptor, haState);
}
示例8: gld_quisced_process
/****************************************************************************
* Name : gld_quisced_process
*
* Description : Instruction from the GLND to set the orphan flag
*
* Arguments : evt - Event structure
*
* Return Values : NCSCC_RC_SUCCESS/ NCSCC_RC_FAILURE
*
* Notes : None.
*****************************************************************************/
static uint32_t gld_quisced_process(GLSV_GLD_EVT *evt)
{
GLSV_GLD_CB *gld_cb = evt->gld_cb;
SaAisErrorT saErr = SA_AIS_OK;
uint32_t rc = NCSCC_RC_SUCCESS;
TRACE_ENTER();
if ((evt == GLSV_GLD_EVT_NULL) || (gld_cb == NULL)){
rc = NCSCC_RC_FAILURE;
goto end;
}
if (gld_cb->is_quiasced) {
gld_cb->ha_state = SA_AMF_HA_QUIESCED;
/* Give up our IMM OI implementer role */
rc = immutil_saImmOiImplementerClear(gld_cb->immOiHandle);
if (rc != SA_AIS_OK) {
LOG_ER("saImmOiImplementerClear failed: err = %d", rc);
}
gld_cb->is_impl_set = false;
rc = glsv_gld_mbcsv_chgrole(gld_cb);
if (rc != NCSCC_RC_SUCCESS) {
m_LEAP_DBG_SINK(NCSCC_RC_FAILURE);
goto end;
}
saAmfResponse(gld_cb->amf_hdl, gld_cb->invocation, saErr);
gld_cb->is_quiasced = false;
}
end:
TRACE_LEAVE();
return rc;
}
示例9: saAmfHealthcheckStop
/****************************************************************************
Name : proxied_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 proxied_healthcheck_callback(SaInvocationT inv,
const SaNameT *comp_name,
SaAmfHealthcheckKeyT *health_check_key)
{
SaAisErrorT rc;
static int healthcheck_count = 0;
uns32 index = 0;
printf("\n Dispatched 'HealthCheck' Callback \n Component: %s \n HealthCheckKey: %s \n",
comp_name->value, health_check_key->key);
for(index=0; index<PXY_PXD_NUM_OF_PROXIED_COMP; index++)
{
if(0 == strcmp(comp_name->value, pxy_pxd_cb.pxd_info[index].compName.value))
break;
}
if(PXY_PXD_NUM_OF_PROXIED_COMP == index)
printf("\n Component not found, index\n");
else
printf("\n Component %s, index %d\n",
pxy_pxd_cb.pxd_info[index].compName.value, index);
/* Respond immediately */
rc = saAmfResponse(pxy_pxd_cb.pxd_info[index].amfHandle, inv, SA_AIS_OK);
if ( SA_AIS_OK != rc )
{
printf("\nsaAmfResponse failure for HC. Comp %s,Result %d\n",
pxy_pxd_cb.pxd_info[index].compName.value, rc);
return;
}
return;
}
示例10: cpnd_saf_health_chk_callback
/****************************************************************************
* Name : cpnd_saf_health_chk_callback
*
* Description : This function SAF callback function which will be called
* when the AMF framework needs to health for the component.
*
* Arguments : invocation - This parameter designated a particular
* invocation of this callback function. The
* invoke process return invocation when it
* responds to the Availability Management
* FrameWork using the saAmfResponse()
* function.
* compName - A pointer to the name of the component
* whose readiness stae the Availability
* Management Framework is setting.
* checkType - The type of healthcheck to be executed.
*
* Return Values : None
*
* Notes : At present we are just support a simple liveness check.
*****************************************************************************/
void
cpnd_saf_health_chk_callback(SaInvocationT invocation, const SaNameT *compName, const SaAmfHealthcheckKeyT *checkType)
{
CPND_CB *cpnd_cb = NULL;
SaAisErrorT error = SA_AIS_OK;
uns32 cb_hdl = m_CPND_GET_CB_HDL;
/* Get the CB from the handle */
cpnd_cb = ncshm_take_hdl(NCS_SERVICE_ID_CPND, cb_hdl);
if (!cpnd_cb) {
m_LOG_CPND_CL(CPND_CB_HDL_TAKE_FAILED, CPND_FC_HDLN, NCSFL_SEV_ERROR, __FILE__, __LINE__);
return;
}
if (saAmfResponse(cpnd_cb->amf_hdl, invocation, error) != SA_AIS_OK) {
m_LOG_CPND_CL(CPND_AMF_RESPONSE_FAILED, CPND_FC_HDLN, NCSFL_SEV_ERROR, __FILE__, __LINE__);
ncshm_give_hdl(cb_hdl);
return;
}
/* giveup the handle */
ncshm_give_hdl(cb_hdl);
return;
}
示例11: eds_proc_quiesced_ack_evt
/****************************************************************************
* Name : eds_proc_quiesced_ack_evt
*
* Description : This is the function which is called when eds receives an
* quiesced ack event from MDS
*
* Arguments : evt - Message that was posted to the EDS Mail box.
*
* Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
*
* Notes : None.
*****************************************************************************/
static uint32_t eds_proc_quiesced_ack_evt(EDSV_EDS_EVT *evt)
{
EDS_CB *cb;
TRACE_ENTER();
/* Retrieve the cb handle */
if (NULL == (cb = (EDS_CB *)ncshm_take_hdl(NCS_SERVICE_ID_EDS, evt->cb_hdl))) {
TRACE_LEAVE();
return NCSCC_RC_FAILURE;
}
if (cb->is_quisced_set == true) {
cb->ha_state = SA_AMF_HA_QUIESCED;
/* Inform MBCSV of HA state change */
if (eds_mbcsv_change_HA_state(cb) != NCSCC_RC_SUCCESS) {
TRACE("EDS-MBCSV change role failed");
}
/* Update control block */
saAmfResponse(cb->amf_hdl, cb->amf_invocation_id, SA_AIS_OK);
cb->is_quisced_set = false;
/* Give the cb handle back */
ncshm_give_hdl(evt->cb_hdl);
} else {
TRACE("Quiesced set is false");
ncshm_give_hdl(evt->cb_hdl);
}
TRACE_LEAVE();
return NCSCC_RC_SUCCESS;
}
示例12: CSI
/****************************************************************************
Name : proxied_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 proxied_csi_remove_callback(SaInvocationT inv,
const SaNameT *comp_name,
const SaNameT *csi_name,
SaAmfCSIFlagsT csi_flags)
{
SaAisErrorT rc;
uns32 index = 0;
printf("\n Proxied 'CSI Remove' Callback \n Component: %s \n CSI: %s \n CSIFlags: %s \n",
comp_name->value, csi_name->value, csi_flag_str[csi_flags]);
for(index=0; index<PXY_PXD_NUM_OF_PROXIED_COMP; index++)
{
if(0 == strcmp(comp_name->value, pxy_pxd_cb.pxd_info[index].compName.value))
break;
}
if(PXY_PXD_NUM_OF_PROXIED_COMP == index)
printf("\n Component not found, index\n");
else
printf("\n Component %s, index %d\n",
pxy_pxd_cb.pxd_info[index].compName.value, index);
/* Reset the ha state */
pxy_pxd_cb.pxd_info[index].haState = 0;
/* Respond immediately */
rc = saAmfResponse(pxy_pxd_cb.pxd_info[index].amfHandle, inv, SA_AIS_OK);
if ( SA_AIS_OK != rc )
{
printf("\nsaAmfResponse failure for CSI Rem. Comp %s,Result %d\n",
pxy_pxd_cb.pxd_info[index].compName.value, rc);
}
return;
}
示例13: clCompAppTerminate
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;
}
示例14: safTerminate
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;
}
示例15: amf_csi_rmv_callback
/****************************************************************************
* Name : amf_csi_rmv_callback
*
* Description : This callback routine is invoked by AMF during a
* CSI set removal operation.
*
* 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.
* csiName - A const pointer to csiName
* csiFlags - csi Flags
* Return Values : None
*****************************************************************************/
static void amf_csi_rmv_callback(SaInvocationT invocation,
const SaNameT *compName, const SaNameT *csiName, const SaAmfCSIFlagsT csiFlags)
{
TRACE_ENTER();
saAmfResponse(ntfs_cb->amf_hdl, invocation, SA_AIS_OK);
TRACE_LEAVE();
}