Hey everyone,

Someone recently gave me a feature request for FreeIPMI for the
equivalent of the "sel list last N" in ipmitool.  Wondering how ipmitool
was able to perform this so much faster than FreeIPMI, I looked at the
code and saw this in __ipmi_sel_savelist_entries().

----
/* Get first record. */
next_id = ipmi_sel_get_std_entry(intf, 0, &evt);

delta = next_id - evt.record_id;

/* Get last record. */
next_id = ipmi_sel_get_std_entry(intf, 0xffff, &evt);

next_id = evt.record_id + count * delta + delta;
---

So, get the first record.  Determine the difference between that record
and the next one.  Using that difference, use it to calculate what the
nth to last record_id is.  Then later on, use that for listing the last
N elements.

I don't believe this is a valid assumption.  As far as I can tell, a
motherboard can store records in any record id pattern it wishes.  Add
in the fact that a user can delete arbitrary records, and you have a
problem.  Here's a test on a motherboard I just tried out.

# ipmitool -H pwoprjr1 -U admin1 -P poseidon sel list | wc -l
160

# ipmitool -H pwoprjr1 -U admin1 -P poseidon sel list last 50 | wc -l
33

So definitely a bug.  IMO, the actual fix is to loop through all the
records until you are N - count away from the end.  If you don't want to
do this, perhaps at a minimum it should be documented that this is not
guaranteed to work.

Al

-- 
Albert Chu
ch...@llnl.gov
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to