summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Lee <tony.lee@quantatw.com>2022-10-20 14:35:38 +0300
committerEd Tanous <ed@tanous.net>2022-10-31 18:17:34 +0300
commita9f68bb5f8e9cfe03fc8b31be5558d4bef20a5f4 (patch)
tree8e5a63070a81fe8bb6ad8b6966c9f5b87012f71a
parentbbd80db84e8ab56c6257e74ce21760a98d16b012 (diff)
downloadbmcweb-a9f68bb5f8e9cfe03fc8b31be5558d4bef20a5f4.tar.xz
pcie: Fixed return nothing when get PCIeDeviceId
GET /redfish/v1/Systems/system/PCIeDevices/<str> nothing will be returned if their 'generationInUse' is Unknown. The original intention is that if it is Unknown, there is no need to display '"PCIeType"'. But the others still have to show. After fix: PCIeType is not Unknown: GET http://${bmc}/redfish/v1/Systems/system/PCIeDevices/<str> { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/<str>.", "@odata.type": "#PCIeDevice.v1_4_0.PCIeDevice", "DeviceType": "SingleFunction", "Id": "<str>", "Manufacturer": "Intel Corporation", "Name": "PCIe Device", "PCIeFunctions": { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/<str>/PCIeFunctions" }, "PCIeInterface": { "PCIeType": "Gen1" } } PCIeType is Unknown: GET http://${bmc}/redfish/v1/Systems/system/PCIeDevices/<str> { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/<str>", "@odata.type": "#PCIeDevice.v1_4_0.PCIeDevice", "DeviceType": "SingleFunction", "Id": "<str>", "Manufacturer": "Intel Corporation", "Name": "PCIe Device", "PCIeFunctions": { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/<str>/PCIeFunctions" } } Signed-off-by: Tony Lee <tony.lee@quantatw.com> Change-Id: I85a97e0370a5789e4526964272381a557ce942a0
-rw-r--r--redfish-core/lib/pcie.hpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index 327e79e459..64fe70e7a1 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -215,13 +215,11 @@ inline void requestRoutesSystemPCIeDevice(App& app)
messages::internalError(asyncResp->res);
return;
}
- if (redfishGenerationInUse->empty())
+ if (!redfishGenerationInUse->empty())
{
- // unknown, no need to handle
- return;
+ asyncResp->res.jsonValue["PCIeInterface"]["PCIeType"] =
+ *redfishGenerationInUse;
}
- asyncResp->res.jsonValue["PCIeInterface"]["PCIeType"] =
- *redfishGenerationInUse;
}
if (manufacturer != nullptr)