diff options
author | eportnov <eportnov@ibs.ru> | 2022-08-15 13:46:16 +0300 |
---|---|---|
committer | eportnov <eportnov@ibs.ru> | 2022-08-15 13:46:16 +0300 |
commit | 498f934e1de2c02b968bc90fc0cc23dc95703207 (patch) | |
tree | b292a3a582779e06d204b5499fb1c0db43fad288 /meta-ibs/meta-cp2-5422/recipes-phosphor | |
parent | b0d7894c802c69e2efdda34eddaa7429dcdee4c7 (diff) | |
download | openbmc-498f934e1de2c02b968bc90fc0cc23dc95703207.tar.xz |
fix bug empty pcie functions
# Conflicts:
# meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend
Diffstat (limited to 'meta-ibs/meta-cp2-5422/recipes-phosphor')
-rw-r--r-- | meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0006-fix-bug-empty-pcie-functions.patch | 75 | ||||
-rw-r--r-- | meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend | 1 |
2 files changed, 76 insertions, 0 deletions
diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0006-fix-bug-empty-pcie-functions.patch b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0006-fix-bug-empty-pcie-functions.patch new file mode 100644 index 0000000000..9c602f8264 --- /dev/null +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0006-fix-bug-empty-pcie-functions.patch @@ -0,0 +1,75 @@ +From 575061c877a15ae590fecc2843fbd5087d159341 Mon Sep 17 00:00:00 2001 +From: eportnov <eportnov@ibs.ru> +Date: Fri, 12 Aug 2022 18:19:20 +0300 +Subject: [PATCH] fix bug empty pcie functions + +--- + redfish-core/lib/pcie.hpp | 42 +++++++++++++++++++-------------------- + 1 file changed, 21 insertions(+), 21 deletions(-) + +diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp +index b4d64332..1f04f5f9 100644 +--- a/redfish-core/lib/pcie.hpp ++++ b/redfish-core/lib/pcie.hpp +@@ -297,18 +297,20 @@ inline void requestRoutesSystemPCIeFunctionCollection(App& app) + // device ID + std::string devIDProperty = + "Function" + std::to_string(functionNum) + "DeviceId"; +- const std::string* property = nullptr; +- for (const auto& propEntry : pcieDevProperties) +- { +- if (propEntry.first == devIDProperty) +- { +- property = std::get_if<std::string>(&propEntry.second); +- } +- } +- if (property == nullptr || !property->empty()) ++ ++ auto find = std::find_if(pcieDevProperties.begin(), pcieDevProperties.end(),[devIDProperty](auto const& propEntry) ++ { return propEntry.first == devIDProperty; }); ++ if(find == pcieDevProperties.end()) + { ++ BMCWEB_LOG_DEBUG << "property" << devIDProperty << "not found"; + return; + } ++ auto property = std::get_if<std::string>(&find->second); ++ if(!property || property->empty()) ++ { ++ BMCWEB_LOG_DEBUG << "property is empty"; ++ return; ++ } + nlohmann::json::object_t pcieFunction; + pcieFunction["@odata.id"] = + "/redfish/v1/Systems/system/PCIeDevices/" + device + +@@ -367,21 +369,19 @@ inline void requestRoutesSystemPCIeFunction(App& app) + std::string functionName = "Function" + function; + std::string devIDProperty = functionName + "DeviceId"; + +- const std::string* devIdProperty = nullptr; +- for (const auto& property : pcieDevProperties) +- { +- if (property.first == devIDProperty) +- { +- devIdProperty = std::get_if<std::string>(&property.second); +- continue; +- } +- } +- if (devIdProperty == nullptr || !devIdProperty->empty()) ++ auto find = std::find_if(pcieDevProperties.begin(), pcieDevProperties.end(),[devIDProperty](auto const& propEntry) ++ { return propEntry.first == devIDProperty; }); ++ if(find == pcieDevProperties.end()) + { +- messages::resourceNotFound(asyncResp->res, "PCIeFunction", +- function); ++ BMCWEB_LOG_DEBUG << "property" << devIDProperty << "not found"; + return; + } ++ auto property_func = std::get_if<std::string>(&find->second); ++ if(!property_func || property_func->empty()) ++ { ++ BMCWEB_LOG_DEBUG << "property is empty"; ++ return; ++ } + + asyncResp->res.jsonValue["@odata.type"] = + "#PCIeFunction.v1_2_0.PCIeFunction"; diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend index e888b304b0..b0db511bfe 100644 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -6,6 +6,7 @@ SRC_URI += "\ file://0003-add-new-dimm-fields.patch \ file://0004-configure-telemetry.patch \ file://0005-Fix-keep-and-re-send-initial-negotiation-data-from-W.patch \ + file://0006-fix-bug-empty-pcie-functions.patch \ " EXTRA_OEMESON += "\ |