update Get System GUID to use yielding calls
The Get System GUID handler was using blocking calls
This updates it to use yielding calls instead.
Tested: run 'ipmitool raw 6 0x37' to verify that it returns the
value hosted by xyz.openbmc_project.Common.UUID under
/xyz/openbmc_project/inventory
Change-Id: Ifcd65c195d5ff684177b6d7f3f1eb5dbe61c24d2
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/apphandler.cpp b/apphandler.cpp
index 5628b35..c4798e2 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -832,33 +832,38 @@
outputBufferSize, transactionTime, nrRetries);
}
-auto ipmiAppGetSystemGuid() -> ipmi::RspType<std::array<uint8_t, 16>>
+auto ipmiAppGetSystemGuid(ipmi::Context::ptr& ctx)
+ -> ipmi::RspType<std::array<uint8_t, 16>>
{
static constexpr auto uuidInterface = "xyz.openbmc_project.Common.UUID";
static constexpr auto uuidProperty = "UUID";
- ipmi::Value propValue;
- try
+ // Get the Inventory object implementing BMC interface
+ ipmi::DbusObjectInfo objectInfo{};
+ boost::system::error_code ec = ipmi::getDbusObject(ctx, uuidInterface,
+ objectInfo);
+ if (ec.value())
{
- // Get the Inventory object implementing BMC interface
- auto busPtr = getSdBus();
- auto objectInfo = ipmi::getDbusObject(*busPtr, uuidInterface);
-
- // Read UUID property value from bmcObject
- // UUID is in RFC4122 format Ex: 61a39523-78f2-11e5-9862-e6402cfc3223
- propValue = ipmi::getDbusProperty(*busPtr, objectInfo.second,
- objectInfo.first, uuidInterface,
- uuidProperty);
+ log<level::ERR>("Failed to locate System UUID object",
+ entry("INTERFACE=%s", uuidInterface),
+ entry("ERROR=%s", ec.message().c_str()));
+ return ipmi::responseUnspecifiedError();
}
- catch (const InternalFailure& e)
+
+ // Read UUID property value from bmcObject
+ // UUID is in RFC4122 format Ex: 61a39523-78f2-11e5-9862-e6402cfc3223
+ std::string rfc4122Uuid{};
+ ec = ipmi::getDbusProperty(ctx, objectInfo.second, objectInfo.first,
+ uuidInterface, uuidProperty, rfc4122Uuid);
+ if (ec.value())
{
log<level::ERR>("Failed in reading BMC UUID property",
entry("INTERFACE=%s", uuidInterface),
- entry("PROPERTY=%s", uuidProperty));
+ entry("PROPERTY=%s", uuidProperty),
+ entry("ERROR=%s", ec.message().c_str()));
return ipmi::responseUnspecifiedError();
}
std::array<uint8_t, 16> uuid;
- std::string rfc4122Uuid = std::get<std::string>(propValue);
try
{
// convert to IPMI format