PEL: Guard against hostboot sending down duplicate PEL Ids

This commit is to guard against hostboot sending down PEL Id
that we already have in our repository. This caused PEL to
get orphaned in the filesystem without a corresponding valid
openbmc event log Id.
The action is to move such PELs to archive folder.

Signed-off-by: Sumit Kumar <sumit_kumar@in.ibm.com>
Change-Id: I46bb865b4b87ec0b59f362e3f79a1b5a6710a45c
diff --git a/extensions/openpower-pels/repository.cpp b/extensions/openpower-pels/repository.cpp
index c49d92f..9b650ce 100644
--- a/extensions/openpower-pels/repository.cpp
+++ b/extensions/openpower-pels/repository.cpp
@@ -734,5 +734,17 @@
     }
 }
 
+void Repository::archivePEL(const PEL& pel)
+{
+    if (pel.valid())
+    {
+        auto path = _archivePath / getPELFilename(pel.id(), pel.commitTime());
+
+        write(pel, path);
+
+        _archiveSize += getFileDiskSize(path);
+    }
+}
+
 } // namespace pels
 } // namespace openpower