host-bmc: handle PDR repo change event from remote endpoint
When the PDR repository change event is initiated with the
event data operation as RECORDS_DELETED, we need to delete the
PDRs from the repository based on the record handles.
Change-Id: Ia484b7a0465169bc471f93bda0baa3c4b8ed5f63
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/host-bmc/host_pdr_handler.cpp b/host-bmc/host_pdr_handler.cpp
index 079c6dc..de828ec 100644
--- a/host-bmc/host_pdr_handler.cpp
+++ b/host-bmc/host_pdr_handler.cpp
@@ -1228,4 +1228,17 @@
getFRURecordTableMetadataByRemote(fruRecordSetPDRs);
}
+void HostPDRHandler::deletePDRFromRepo(PDRRecordHandles&& recordHandles)
+{
+ for (auto& recordHandle : recordHandles)
+ {
+ int rc = pldm_pdr_delete_by_record_handle(repo, recordHandle, true);
+ if (rc)
+ {
+ error("Failed to delete the record handle: {REC_HANDLE}",
+ "REC_HANDLE", recordHandle);
+ }
+ }
+}
+
} // namespace pldm
diff --git a/host-bmc/host_pdr_handler.hpp b/host-bmc/host_pdr_handler.hpp
index 87da96c..8c97693 100644
--- a/host-bmc/host_pdr_handler.hpp
+++ b/host-bmc/host_pdr_handler.hpp
@@ -104,6 +104,12 @@
void fetchPDR(PDRRecordHandles&& recordHandles);
+ /** @brief delete PDRs from remote pldm endpoint.
+ * @param[in] recordHandles - list of record handles pointing to remote
+ * PDRs that need to be deleted.
+ */
+ void deletePDRFromRepo(PDRRecordHandles&& recordHandles);
+
/** @brief Send a PLDM event to host firmware containing a list of record
* handles of PDRs that the host firmware has to fetch.
* @param[in] pdrTypes - list of PDR types that need to be looked up in the