Discussion:
[Ipmitool-devel] [PATCH]Prevention of printing outdated event log entry if SEL entry is not present
Mamatha Inamdar
2014-02-27 03:44:27 UTC
Permalink
Currently when we issue ipmitool command to get SEL entry,
it prints the following outdated event log entry if SEL entry is not present.

ipmitool -I lanplus -H <ip address> -P PASSW0RD -C 1 sel get 1
Get SEL Entry 1 command failed: Requested sensor, data, or record not found

SEL Record ID : 0000
Record Type : 00
Timestamp : 01/01/1970 00:00:00
Generator ID : 92c0
EvM Revision : 04
Sensor Type : Power Supply
Sensor Number : 28
Event Type : Reserved
Event Direction : Assertion Event
Event Data : 0d0809

This patch is to avoid printing outdated event log entry if SEL entry is not present.

Test results:

1)SEL event ID not present

./ipmitool -I lanplus -H <ip address> -P PASSW0RD -C 1 sel get 5
Get SEL Entry 5 command failed: Requested sensor, data, or record not found

2) SEL Event ID present

./ipmitool -I lanplus -H <ip address> -P PASSW0RD -C 1 sel get 1
SEL Record ID : 0001
Record Type : 02
Timestamp : 02/25/2014 03:09:53
Generator ID : 2000
EvM Revision : 04
Sensor Type : System Event
Sensor Number : 36
Event Type : Generic Discrete
Event Direction : Assertion Event
Event Data : 466fff
Description : Transition to Non-recoverable

Signed-off-by: Mamatha Inamdar <***@linux.vnet.ibm.com>
---
lib/ipmi_sel.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/ipmi_sel.c b/lib/ipmi_sel.c
index 63ecbcf..0393a99 100644
--- a/lib/ipmi_sel.c
+++ b/lib/ipmi_sel.c
@@ -2898,7 +2898,11 @@ ipmi_sel_show_entry(struct ipmi_intf * intf, int argc, char ** argv)
lprintf(LOG_DEBUG, "Looking up SEL entry 0x%x", id);

/* lookup SEL entry based on ID */
- ipmi_sel_get_std_entry(intf, id, &evt);
+ if(!ipmi_sel_get_std_entry(intf, id, &evt)) {
+ lprintf(LOG_DEBUG, "SEL Entry %d not found", id);
+ return -1;
+ }
+
if (evt.sel_type.standard_type.sensor_num == 0 && evt.sel_type.standard_type.sensor_type == 0 && evt.record_type == 0) {
lprintf(LOG_WARN, "SEL Entry 0x%x not found", id);
rc = -1;

Loading...