Populate the Type property in Item.Drive interface
By populating this property, bmcweb can populate the "MediaType"
property in the Drive schema.
Tested:
$ busctl get-property xyz.openbmc_project.eStoraged \
/xyz/openbmc_project/inventory/storage/mmcblk0 \
xyz.openbmc_project.Inventory.Item.Drive Type
s "xyz.openbmc_project.Inventory.Item.Drive.DriveType.SSD"
$ curl http://localhost:80/redfish/v1/Chassis/DCSCM/Drives/mmcblk0
{
...
"MediaType": "SSD",
...
}
Signed-off-by: John Wedig <johnwedig@google.com>
Change-Id: I2cb6c7d3ec3b49e8d666da940d873f1117a0aa85
diff --git a/include/estoraged.hpp b/include/estoraged.hpp
index ec8f467..077b12e 100644
--- a/include/estoraged.hpp
+++ b/include/estoraged.hpp
@@ -46,6 +46,7 @@
* @param[in] locationCode - location code for the storage device
* @param[in] eraseMaxGeometry - max geometry to erase if it's specified
* @param[in] eraseMinGeometry - min geometry to erase if it's specified
+ * @param[in] driveType - type of drive, e.g. HDD vs SSD
* @param[in] cryptInterface - (optional) pointer to CryptsetupInterface
* object
* @param[in] fsInterface - (optional) pointer to FilesystemInterface
@@ -56,7 +57,7 @@
const std::string& luksName, uint64_t size, uint8_t lifeTime,
const std::string& partNumber, const std::string& serialNumber,
const std::string& locationCode, uint64_t eraseMaxGeometry,
- uint64_t eraseMinGeometry,
+ uint64_t eraseMinGeometry, const std::string& driveType,
std::unique_ptr<CryptsetupInterface> cryptInterface =
std::make_unique<Cryptsetup>(),
std::unique_ptr<FilesystemInterface> fsInterface =
diff --git a/include/util.hpp b/include/util.hpp
index 8f5a0ff..7cc778a 100644
--- a/include/util.hpp
+++ b/include/util.hpp
@@ -18,14 +18,16 @@
std::string locationCode;
uint64_t eraseMaxGeometry;
uint64_t eraseMinGeometry;
+ std::string driveType;
DeviceInfo(std::filesystem::path& deviceFile,
std::filesystem::path& sysfsDir, std::string& luksName,
std::string& locationCode, uint64_t eraseMaxGeometry,
- uint64_t eraseMinGeometry) :
+ uint64_t eraseMinGeometry, std::string& driveType) :
deviceFile(deviceFile),
sysfsDir(sysfsDir), luksName(luksName), locationCode(locationCode),
- eraseMaxGeometry(eraseMaxGeometry), eraseMinGeometry(eraseMinGeometry)
+ eraseMaxGeometry(eraseMaxGeometry), eraseMinGeometry(eraseMinGeometry),
+ driveType(driveType)
{}
};