summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tanous <ed.tanous@intel.com>2018-11-15 03:50:18 +0300
committerEd Tanous <ed.tanous@intel.com>2018-11-21 18:46:30 +0300
commit244365165adba1bc6b96aebbd7d305b055f379b1 (patch)
treeebb74fb7ac687699fdad4c64a0305568f6c76901
parentf839dfee32b930537d2d198f4bf236ff03b7581d (diff)
downloadbmcweb-244365165adba1bc6b96aebbd7d305b055f379b1.tar.xz
bmcweb: fix Redfish UUID
The UUID implementation had a number of issues that weren't fleshed out, as it was built before we had the appropriate systemd support. This resolves it. Tested By: Loading the redfish ServiceRoot endpoint, and verifying the UUID is not zeros. Change-Id: I86aba678e3d492ad7d258807b0ed9e7d453667a2 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
-rw-r--r--redfish-core/lib/service_root.hpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/redfish-core/lib/service_root.hpp b/redfish-core/lib/service_root.hpp
index 6041d321f6..3a3107636f 100644
--- a/redfish-core/lib/service_root.hpp
+++ b/redfish-core/lib/service_root.hpp
@@ -60,25 +60,23 @@ class ServiceRoot : public Node
const std::string getUuid()
{
- // If we are using a version of systemd that can get the app specific
- // uuid, use that
-#ifdef sd_id128_get_machine_app_specific
- std::array<char, SD_ID128_STRING_MAX> string;
- sd_id128_t id = SD_ID128_NULL;
-
+ std::string ret;
// This ID needs to match the one in ipmid
- int r = sd_id128_get_machine_app_specific(
- SD_ID128_MAKE(e0, e1, 73, 76, 64, 61, 47, da, a5, 0c, d0, cc, 64,
- 12, 45, 78),
- &id);
- if (r < 0)
+ sd_id128_t appId = SD_ID128_MAKE(e0, e1, 73, 76, 64, 61, 47, da, a5, 0c,
+ d0, cc, 64, 12, 45, 78);
+ sd_id128_t machineId = SD_ID128_NULL;
+
+ if (sd_id128_get_machine_app_specific(appId, &machineId) == 0)
{
- return "00000000-0000-0000-0000-000000000000";
+ std::array<char, SD_ID128_STRING_MAX> str;
+ ret = sd_id128_to_string(machineId, str.data());
+ ret.insert(8, 1, '-');
+ ret.insert(13, 1, '-');
+ ret.insert(18, 1, '-');
+ ret.insert(23, 1, '-');
}
- return string.data();
-#else
- return "00000000-0000-0000-0000-000000000000";
-#endif
+
+ return ret;
}
};