OpenClovis Logo

API Usage Examples
Fault Manager

Code Examples. More...

Code Examples.

Reporting fault

Fault Manager provides a mechanism to report faults that occurred in the system through the following two APIs:

Alarm Manager uses clFaultReport() to report non-service impacting alarm to Fault Manager which invokes the action configured by the user corresponding to the alarm category and severity. The following example shows the usage of clFaultReport(). It reports fault for MO \Chassis:0\TestSync2T1:0 belonging to category CL_ALARM_SEVERITY_MINOR.

ClRcT rc;
ClRcT errorCode = CL_OK;
ClNameT compName, moIdName;
ClCorMOIdPtrT hMoId = NULL;
//The value of specificProblem can be anything.
ClAlarmSpecificProblemT specificProblem = 1;
void *pData=NULL;
ClUint32T len=0;
strncpy(compName.value, "cntlrTi1Sys0", sizeof(compName.value));
compName.length = strlen(compName.value);
strncpy(moIdName.value, "\\Chassis:0\\TestSync2T1:0",
sizeof(moIdName.value));
moIdName.length = strlen(moIdName.value);
rc = clCorMoIdNameToMoIdGet(&moIdName, hMoId);
if(CL_OK != rc)
{
//Error occurred. Take appropriate action
clLogError("FLT", "002",
"Error while getting MOId from MOId name, rc=[0x%x]",
rc);
return rc;
}
// Reports a fault on the compName
errorCode =clFaultReport(&compName,
hMoId,
alarmState,
category,
specificProblem,
severity,
cause,
pData,
len);
if(CL_OK != errorCode)
{
//Error occurred. Take appropriate action.
clLogError("FLT", "002",
"Reporting fault failed with error [0x%x]", rc);
return rc;
}

For service impacting alarms, Alarm Manager(AM) publishes an event which is subscribed by Availability Management Framework(AMF). AMF does service recovery and informs Fault Manager(FM) to take appropriate action. FM invokes the appropriate handler for the alarm. This handler is being defined by the user during modeling of the system. Following example shows the usage of clFaultRepairAction()

ClRcT rc = CL_OK;
ClIocAddressT iocAddress;
// alarmHandle is obtained from the invocation of clAlarmRaise()
ClAlarmHandleT alarmHandle = *(ClAlarmHandleT *)arg;
rc = clFaultRepairAction(iocAddress,
alarmHandle,
CL_AMS_RECOVERY_COMP_RESTART);
if(CL_OK != rc)
{
//Error occurred. Take appropriate action.
clLogError("FLT", "002",
"Fault repair failed with error [0x%x]", rc);
return rc;
}
return CL_OK;

Version Checking

The following API checks for version compatibility of the Application.


Generated on Tue Jan 10 10:29:15 PST 2012 for OpenClovis SDK using Doxygen