sel-cache: Register matches before getting logs
The code was getting the log entries first and then register matches.
In case an event occurs and a log entry is created during this time, the
log entry is missed in SELs.
Register matches before getting log entries to make sure all the log
entries could be handled in ipmid.
Tested: Before this change, the BMC boot event is missed in ipmi SEL
because the event happens to be logged during the ipmid starts.
With this change, the BMC boot event is shown in ipmi SEL.
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I03c587faf7eed5a0390302a90616f133a8303688
diff --git a/storagehandler.cpp b/storagehandler.cpp
index cdd61da..690ea42 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -185,6 +185,7 @@
void initSELCache()
{
+ registerSelCallbackHandler();
ipmi::sel::ObjectPaths paths;
try
{
@@ -203,7 +204,6 @@
selCacheMap.insert(std::move(*entry));
}
}
- registerSelCallbackHandler();
selCacheMapInitialized = true;
}