Difference between revisions of "Doc:latest/evalguide/cmPlugin"

(Building the CM-Plugin model and controlling Events in run-time)
(Usage of CM-Plugin)
Line 19: Line 19:
 
====Usage of CM-Plugin====
 
====Usage of CM-Plugin====
  
The policy to control the events is defined in cmPolicy.c and is available in the location: ...\CmPlugin\src\app\common\plugins\cmPolicy.c in specified example.
+
The policy to control the events is defined in cmPolicy.c and is available in the location: .../CmPlugin/src/app/common/plugins/cmPolicy.c in specified example.
  
 
{| cellspacing="0" cellpadding = "0" border="0" align = "center" width="680"
 
{| cellspacing="0" cellpadding = "0" border="0" align = "center" width="680"
Line 29: Line 29:
 
     {
 
     {
 
         /* Define the policy to Allow, Block or Change the events here */
 
         /* Define the policy to Allow, Block or Change the events here */
         if ( /* For Specific condition of Event Ex: event->Severity==SAHPI_MAJOR */)
+
         if ((event->EventType==SAHPI_ET_SENSOR) && (event->EventDataUnion.SensorEvent.SensorNum==4))
 
         {
 
         {
             /* Change the event to required form */
+
             event->Severity=SAHPI_MINOR;
            /* event->Severity=SAHPI_MINOR;     */
+
 
         }
 
         }
   
+
        else if ((event->EventType==SAHPI_ET_SENSOR) && (event->Source == 0x10))
 +
        {
 +
            event->Severity=SAHPI_MINOR;
 +
        }   
 
         return CL_OK;
 
         return CL_OK;
 
     }
 
     }

Revision as of 09:48, 10 October 2013

Contents

CM Plug-in Guide

Objective

CM-Plugin is an event controlling policy in Platform-Support-Package(PSP) to allow, restrict, or modify the events received from HPI and forwarded to the Application during run-time. The policy is defined by the Application programmer and is loaded into the Chassis Manager and called whenever a hardware event is received.

The purpose of this plugin is to allow the application programmer to intercept events that may be miscategorized by the hardware and transform them. For example, if a voltage loss event is reported as MAJOR in a dual power supply system, this even should not cause system shutdown so can be reduced to a MINOR level event.

What you can learn

How to define a policy to control the events in the CM, so that only interested events are forwarded to the Application and unintended events are discarded.

Building the CM-Plugin model and controlling Events in run-time

The example code containing Application and CM-Policy is available in PSP/src/example

Usage of CM-Plugin

The policy to control the events is defined in cmPolicy.c and is available in the location: .../CmPlugin/src/app/common/plugins/cmPolicy.c in specified example.

cmPolicy.c

    ClRcT HpiEventFilter(SaHpiSessionIdT session, SaHpiEventT* event, SaHpiRdrT* rdr, SaHpiRptEntryT* rpt)
    {
        /* Define the policy to Allow, Block or Change the events here */
        if ((event->EventType==SAHPI_ET_SENSOR) && (event->EventDataUnion.SensorEvent.SensorNum==4))
        {
             event->Severity=SAHPI_MINOR;
        }
        else if ((event->EventType==SAHPI_ET_SENSOR) && (event->Source == 0x10))
        {
             event->Severity=SAHPI_MINOR;
        }    
        return CL_OK;
    }
  
  • HpiEventFilter() will be contain the details of specific event to be handled and specific modification for that event.

How to Run cmPlugin model

Copy the image to required location (/root/asp/).

  1. Start the SAFplus Platform on deployed node
     # cd /root/asp/
     # ./etc/init.d/asp start
  2. Generate event using HPI Event Simulator OR through actual hardware
     # cd /root/asp/bin
     # ./hpithres
    The logs are available in var/log/sys.latest and application_name.latest