IPMI from drive to Application (medium )
In the previous article, we talked about the IPMI underlying hardware connection and the implementation of the kernel driver, which facilitated the application developer by simply opening the operation with standard device files and invoking the available IOCTL to the BMC Send the request or read the response result.
In addition to using this approach, application development engineers can leverage existing open source code that encapsulates the above operations. The current open sourceIPMIThe code mainly hasIpmitooland theOpenIPMI. Interested readers can use thegit clonegit://git.code.sf.net/p/ipmitool/sourceipmitool-sourceDownloadIpmitoolThe source code, you can use theGitclone Git://git.code.sf.net/p/openipmi/codeopenipmi-codeDownloadOpenIPMIcode. The former will compile a matchIPMICanonical user-state commands "Ipmitoo ", it can be used toBMCQuery system motherboard, fan, power, temperature and other status information. Support a lot of parameters, use flexible, short and concise. You can also use it.Rawcommandformat to send different manufacturers to define their own implementationOEMcommands to meet a variety of common scenarios. In the ointment, it isOEMthe parsing of the system event log needs to be based onVendordefines the format to modify the code. In addition, due to several reasons,BMCneed to implementsystemmanagement Software (SMS)to periodically detect system status:
-
< Span lang= "ZH-CN" xml:lang= "ZH-CN" > overheating or long-term thermal condition reduces the life of the silicon chip;
-
with capacitance aging Span style= "font-family: ' Times New Roman ', serif;" >, system will slowly go wrong;
-
fan will go wrong with the service life Span style= "font-family: ' Times New Roman ', serif;" >;
but IPMI does not provide a set of easy to implement SMS the framework and interface, for this deficiency, OpenIPMI The arrival of the ship.
OpenIPMIbased on the event-driven model, it provides callback and timeout mechanisms, encapsulates locks, multiline libraries, and memory management, hides the differences between operating systems, and masksSMI (systemmanagmentinterface)and theLaninterfaces,IPMBuse of the interface, users can directly use theOpenIPMIThe library has been developed two times, focusing on andBMCIPMIThe modules and implementations of the relevant business, without additional consideration of the design of the lock, synchronization and event-driven models themselves, greatly improve the development efficiency. OPENIPMThe following six basic concepts are involved in understanding these concepts to quickly graspOpenIPMIthe key:
-
all devices or modules that can be prosecuted are called entity psu/ambient entity
Sensors: used to monitor an object on the system, can be divided into Threshodsensor and DiscreteSensor , the former is a continuous value, by the comparison with the threshold value set to trigger the SEL or set up a special status bit, and the latter is a discrete value, different values represent different states, as an example of power supply, it is the electricity, electricity off, error, Aclost and other state;
Controls: including lighting, relay, display, Alarm, restart, fan speed, one-shot-reset,one-shot-outputs , identifiers;
Events: system events are usually made with sensor/control/entity The connected event callback function is processed. The callback function needs to return a value to flag whether the handler has handled the Event.
OPENIPM and the IPMI the driver's brief module looks like this:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/73/59/wKiom1X6r0mBa0zNAAGQx2xHWg8051.jpg "title=" Openipmi_struture.png "alt=" Wkiom1x6r0mba0znaagqx2xhwg8051.jpg "/>
then the How to write a based on OpenIPMI the program? The following is an analysis based on SAMPLE/DUMP_SENSOR.C, with the following main steps:
1.allocate OS Handler
Oshandler The differences between operating systems are shielded and the openipmilibrary provides a unified service for implementing an event-driven model. These services include callback interfaces, timeout counters, condition variables (OPENIPMI not used), and locking and threading mechanisms.
2. update The relevant settings of handler, such as Log records;
3. Initialize ipmilibrary. Ipmi_init (OS hanlder) includes the following steps:
Establish a connection: Define address settings, change connection status, send commands, add and remove event handlers, send responses, errors in processor response, and other issues that may occur when connecting
InitializeDomain:Domainis a differentIDbut connected toManagementcontrolerthe collection, why need to introduce thisdomain?need it to distinguish moreMCone of the systemMCand the individual connected to itentities (_ipmi_domain_init), it initializesmc_oem_handlers,domain_change_handlers,domains_list,oem_handlers
according to manufactory_id,product_id to initialize some of the OEM of the MC, These models include: FORCE_CONN,MOTORALA_MXP,INTEL,KONTRON,ATCA
4. Parse parameter:ipmi_parse_args2: Receive user's input
5. Establish a connection: establish the appropriate connection according to the input parameters
6. opendomain and register The operation after connection is established;
7. Call perform_one_op () to implement the specified operation.
Developers can be based on the above and the sample directory of other examples to achieve their own functions, I based on the demo program to achieve a database with the target system, very convenient to use. Do you want to know how I came to realize it? What is the OpenIPMI Library and callback function? Small series will continue to analyze with you, please continue to pay attention.
This article from "Storage Chef" blog, reproduced please contact the author!
IPMI from drive to Application (medium)