summaryrefslogtreecommitdiff
path: root/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces
diff options
context:
space:
mode:
authoreportnov <eportnov@ibs.ru>2022-08-15 11:58:49 +0300
committereportnov <eportnov@ibs.ru>2022-08-15 13:19:45 +0300
commit8fb26f9eb6e35256efced7043627bbd0affecf54 (patch)
tree7f8c88c3b282892a9a2fa4d34aa1ea73b8822842 /meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces
parentd83c30848c9281e7ee965984f53ef47c511a6be2 (diff)
downloadopenbmc-8fb26f9eb6e35256efced7043627bbd0affecf54.tar.xz
fix bug empty pcie functions
Diffstat (limited to 'meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces')
-rw-r--r--meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0006-fix-bug-empty-pcie-functions.patch75
-rw-r--r--meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend1
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 d984430c60..6e5e554232 100644
--- a/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend
+++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend
@@ -5,6 +5,7 @@ SRC_URI += "\
file://0002-add-new-cpu-fields.patch \
file://0003-add-new-dimm-fields.patch \
file://0004-configure-telemetry.patch \
+ file://0006-fix-bug-empty-pcie-functions.patch \
"
EXTRA_OEMESON += "\