PEL: Get new references to the event loop
In the EventLogger and Manager classes, have them acquire their own
references to the event loop as opposed to trying to get them from the
bus object.
This is because lately in SDK based testcases, when sdbusplus tries to
create a new sd_bus object, the creation fails and so it isn't possible
to get an sd_event object out of it like the code was trying to do.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I22811f725d44b8c39e68222f3eddb4e87622674f
diff --git a/extensions/openpower-pels/event_logger.hpp b/extensions/openpower-pels/event_logger.hpp
index b4df0d4..9c520e6 100644
--- a/extensions/openpower-pels/event_logger.hpp
+++ b/extensions/openpower-pels/event_logger.hpp
@@ -53,11 +53,10 @@
/**
* @brief Constructor
*
- * @param[in] event - The sd_event object
* @param[in] creator - The function to use to create the event log
*/
- EventLogger(sd_event* event, LogFunction creator) :
- _event(event), _creator(creator)
+ EventLogger(LogFunction creator) :
+ _event(sdeventplus::Event::get_default()), _creator(creator)
{
}
diff --git a/extensions/openpower-pels/manager.cpp b/extensions/openpower-pels/manager.cpp
index a0c0929..fb0efb3 100644
--- a/extensions/openpower-pels/manager.cpp
+++ b/extensions/openpower-pels/manager.cpp
@@ -324,10 +324,11 @@
void Manager::scheduleFDClose(int fd)
{
+ sdeventplus::Event event = sdeventplus::Event::get_default();
+
_fdCloserEventSource = std::make_unique<sdeventplus::source::Defer>(
- _logManager.getBus().get_event(),
- std::bind(std::mem_fn(&Manager::closeFD), this, fd,
- std::placeholders::_1));
+ event, std::bind(std::mem_fn(&Manager::closeFD), this, fd,
+ std::placeholders::_1));
}
void Manager::closeFD(int fd, sdeventplus::source::EventBase& source)
diff --git a/extensions/openpower-pels/manager.hpp b/extensions/openpower-pels/manager.hpp
index d25afbd..1aa15ed 100644
--- a/extensions/openpower-pels/manager.hpp
+++ b/extensions/openpower-pels/manager.hpp
@@ -49,8 +49,7 @@
std::unique_ptr<DataInterfaceBase> dataIface,
EventLogger::LogFunction creatorFunc) :
PELInterface(logManager.getBus(), OBJ_LOGGING),
- _logManager(logManager),
- _eventLogger(logManager.getBus().get_event(), std::move(creatorFunc)),
+ _logManager(logManager), _eventLogger(std::move(creatorFunc)),
_repo(getPELRepoPath()),
_registry(getMessageRegistryPath() / message::registryFileName),
_dataIface(std::move(dataIface))