Add support for LocationCode
LocationCode is needed to populate ServiceLabel by BMCWeb for Redfish
resource associated with eStorage.
LocationCode is derived from config object exported by Entity Manager
in the the following interface:
"xyz.openbmc_project.Configuration.EmmcDevice
To surface LocationCode, the "Exposes" entry in board's Entity Manager
config can add "LocationCode" property as follows:
{
"Name": "example_emmc",
"Type": "EmmcDevice",
"LocationCode": "U1000"
}
Here the LocationCode is the silk screen label.
Tested:
busctl introspect xyz.openbmc_project.eStoraged \
/xyz/openbmc_project/inventory/storage/mmcblk0 \
xyz.openbmc_project.Inventory.Decorator.LocationCode
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.LocationCode property s "U1000" emits-change
wget -qO- localhost:80/redfish/v1/Chassis/DCSCM/Drives/mmcblk0
{
"@odata.id": "/redfish/v1/Chassis/DCSCM/Drives/mmcblk0",
"@odata.type": "#Drive.v1_7_0.Drive",
"Id": "mmcblk0",
"Links": {
"Chassis": {
"@odata.id": "/redfish/v1/Chassis/DCSCM"
}
},
"Name": "mmcblk0",
"PhysicalLocation": {
"PartLocation": {
"LocationType": "Embedded",
"ServiceLabel": "U1000"
},
"PartLocationContext": "DC_SCM"
},
"PredictedMediaLifeLeftPercent": 100,
"Status": {
"State": "Enabled"
}
}
Change-Id: Ibf53ede5ee65787f9cef53d4bad4cb8fccba3606
Signed-off-by: Rahul Kapoor <rahulkpr@google.com>
diff --git a/include/estoraged.hpp b/include/estoraged.hpp
index 8e4ceb7..871fdca 100644
--- a/include/estoraged.hpp
+++ b/include/estoraged.hpp
@@ -43,6 +43,7 @@
* @param[in] lifeTime - percent of lifetime remaining for a drive
* @param[in] partNumber - part number for the storage device
* @param[in] serialNumber - serial number for the storage device
+ * @param[in] locationCode - location code for the storage device
* @param[in] cryptInterface - (optional) pointer to CryptsetupInterface
* object
* @param[in] fsInterface - (optional) pointer to FilesystemInterface
@@ -52,6 +53,7 @@
const std::string& configPath, const std::string& devPath,
const std::string& luksName, uint64_t size, uint8_t lifeTime,
const std::string& partNumber, const std::string& serialNumber,
+ const std::string& locationCode,
std::unique_ptr<CryptsetupInterface> cryptInterface =
std::make_unique<Cryptsetup>(),
std::unique_ptr<FilesystemInterface> fsInterface =
@@ -141,9 +143,12 @@
/** @brief D-Bus interface for the physical drive. */
std::shared_ptr<sdbusplus::asio::dbus_interface> driveInterface;
- /** @brief D-Bus interface for the location of the drive. */
+ /** @brief D-Bus interface for the location type of the drive. */
std::shared_ptr<sdbusplus::asio::dbus_interface> embeddedLocationInterface;
+ /** @brief D-Bus interface for the location code of the drive. */
+ std::shared_ptr<sdbusplus::asio::dbus_interface> locationCodeInterface;
+
/** @brief D-Bus interface for the asset information. */
std::shared_ptr<sdbusplus::asio::dbus_interface> assetInterface;