diff options
author | Tim Lee <timlee660101@gmail.com> | 2020-04-27 06:47:58 +0300 |
---|---|---|
committer | James Feist <james.feist@linux.intel.com> | 2020-06-03 19:44:38 +0300 |
commit | d4342a9202e8781a3634a14c4d5311aaaab23fda (patch) | |
tree | b3ed438837f2d2bb96baacdfb2e1e2eed3b3b55c /redfish-core/lib/log_services.hpp | |
parent | dc3fbbd0b0021ae888a97bf48a62f30129fc3f4d (diff) | |
download | bmcweb-d4342a9202e8781a3634a14c4d5311aaaab23fda.tar.xz |
log_services: Fix Severity Empty string found issue when running Redfish Service Validator
Symptom:
When running Redfish Service Validator, we found that Severity Empty string issue except first post code in PostCodesEntry.
*** /redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1
Regetting resource from URI /redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1
Type (#LogEntry.v1_4_0.LogEntry), GET SUCCESS (time: 0)
PASS
*** /redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-2
Regetting resource from URI /redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-2
Type (#LogEntry.v1_4_0.LogEntry), GET SUCCESS (time: 0)
Severity: Empty string found - Services should omit properties if not supported
Severity: Invalid Enum value '' found, expected ['OK', 'Warning', 'Critical']
FAIL...
Root cause:
In fillPostCodeEntry(), this statement "severity = message->severity" only be executed once.
And another statement {"Severity", std::move(severity)} in the end of this function will clear severity string to null after calling std::move() standard function.
Thus, only first post code Severity is 'OK', but the others are NULL.
Solution:
Move this statement "severity = message->severity" to for loop in fillPostCodeEntry() then all post codes will be recorded with correct severity string 'OK'.
Tested:
Passed the Redfish Service Validator and verified "Severity": "OK" in /redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-2
{
"@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry",
"@odata.id": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-2",
"@odata.type": "#LogEntry.v1_4_0.LogEntry",
"Created": "2020-04-27T01:48:10+00:00",
"EntryType": "Event",
"Id": "B1-2",
"Message": "Boot Count: 1: TS Offset: 0.0046; POST Code: 0x02",
"MessageArgs": [
"1",
"0.0046",
"0x02"
],
"MessageId": "OpenBMC.0.1.BIOSPOSTCode",
"Name": "POST Code Log Entry",
"Severity": "OK"
}
Signed-off-by: Tim Lee <timlee660101@gmail.com>
Change-Id: Ibfccfa47cfe8e0f58e7f24650871edda5d248674
Diffstat (limited to 'redfish-core/lib/log_services.hpp')
-rw-r--r-- | redfish-core/lib/log_services.hpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index 2284e23537..3f107252c6 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -2620,11 +2620,6 @@ static void fillPostCodeEntry( // Get the Message from the MessageRegistry const message_registries::Message *message = message_registries::getMessage("OpenBMC.0.1.BIOSPOSTCode"); - std::string severity; - if (message != nullptr) - { - severity = message->severity; - } uint64_t currentCodeIndex = 0; nlohmann::json &logEntryArray = aResp->res.jsonValue["Members"]; @@ -2710,6 +2705,13 @@ static void fillPostCodeEntry( } } + // Get Severity template from message registry + std::string severity; + if (message != nullptr) + { + severity = message->severity; + } + // add to AsyncResp logEntryArray.push_back({}); nlohmann::json &bmcLogEntry = logEntryArray.back(); |