Persist error d-bus objects
Use Cereal to implement serialization and de-serialization of
properties of error d-bus objects.
Serialize and persist error d-bus objects as they are put on the bus.
De-serialize and restore them (if persistent ones exist) when
phosphor-log-manager starts up.
Change-Id: I1f5df1abbe74bfdb86e3e82a78ff7115e90e2112
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/log_manager_main.cpp b/log_manager_main.cpp
index a3b26a3..b04c0e3 100644
--- a/log_manager_main.cpp
+++ b/log_manager_main.cpp
@@ -1,5 +1,6 @@
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/manager.hpp>
+#include <experimental/filesystem>
#include "config.h"
#include "log_manager.hpp"
@@ -12,6 +13,12 @@
phosphor::logging::Manager manager(bus, OBJ_INTERNAL);
+ // Create a directory to persist errors.
+ std::experimental::filesystem::create_directories(ERRLOG_PERSIST_PATH);
+
+ // Recreate error d-bus objects from persisted errors.
+ manager.restore();
+
bus.request_name(BUSNAME_LOGGING);
while(true)