storagehandler: Fix sdr count for cmdGetSdrRepositoryInfo
Match the Sdr Repository Info to cmdGetDeviceSdrInfo in sensorhandler.
It should return number of records in the SDR Repository not specific to
sensors or frus.
Change-Id: I9dcefcc07313b676df5205d896961461fac3e5ff
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/storagehandler.cpp b/storagehandler.cpp
index bd31314..0b1a4e4 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -1,5 +1,6 @@
#include "storagehandler.hpp"
+#include "entity_map_json.hpp"
#include "fruread.hpp"
#include "read_fru_data.hpp"
#include "selutility.hpp"
@@ -854,7 +855,12 @@
constexpr uint32_t deletionTimestamp = 0x0;
constexpr uint8_t operationSupport = 0;
- uint16_t records = frus.size() + ipmi::sensor::sensors.size();
+ // Get SDR count. This returns the total number of SDRs in the device.
+ const auto& entityRecords =
+ ipmi::sensor::EntityInfoMapContainer::getContainer()
+ ->getIpmiEntityRecords();
+ uint16_t records =
+ ipmi::sensor::sensors.size() + frus.size() + entityRecords.size();
return ipmi::responseSuccess(sdrVersion, records, freeSpace,
additionTimestamp, deletionTimestamp,