Add implementation capacity for drive interface
This will set the capacity property when the eStoraged object is
created. This change does not expect the drive size to change.
Change-Id: I72cd68c5045e9ef49939f4655a223a02234c7434
Signed-off-by: John Edward Broadbent <jebr@google.com>
diff --git a/src/main.cpp b/src/main.cpp
index 0207079..82ffcdd 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -5,6 +5,7 @@
#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/bus.hpp>
+#include <util.hpp>
#include <filesystem>
#include <iostream>
@@ -69,8 +70,9 @@
b.request_name(busName.c_str());
/* Create an eStoraged object. */
- estoraged::EStoraged esObject{b, path.c_str(), physicalBlockDev,
- containerBlockDev};
+ estoraged::EStoraged esObject{
+ b, path.c_str(), physicalBlockDev, containerBlockDev,
+ estoraged::util::Util::findSizeOfBlockDevice(physicalBlockDev)};
lg2::info("Storage management service is running", "REDFISH_MESSAGE_ID",
std::string("OpenBMC.1.0.ServiceStarted"));
diff --git a/src/test/estoraged_test.cpp b/src/test/estoraged_test.cpp
index e77d4c6..e7ad562 100644
--- a/src/test/estoraged_test.cpp
+++ b/src/test/estoraged_test.cpp
@@ -43,6 +43,7 @@
public:
const char* testFileName = "testfile";
const char* testLuksDevName = "testfile_luksDev";
+ uint64_t testSize = 24;
std::ofstream testFile;
std::unique_ptr<estoraged::EStoraged> esObject;
const char* testPath = "/test/openbmc_project/storage/test_dev";
@@ -97,8 +98,8 @@
mockFsIface = fsIface.get();
esObject = std::make_unique<estoraged::EStoraged>(
- bus, testPath, testFileName, testLuksDevName, std::move(cryptIface),
- std::move(fsIface));
+ bus, testPath, testFileName, testLuksDevName, testSize,
+ std::move(cryptIface), std::move(fsIface));
}
void TearDown() override