summaryrefslogtreecommitdiff
path: root/redfish-core/lib/sensors.hpp
diff options
context:
space:
mode:
authorzhanghch05 <zhanghch05@inspur.com>2021-10-20 11:04:48 +0300
committerEd Tanous <ed@tanous.net>2021-10-27 23:26:05 +0300
commit9d832618c74052bd445d6e8b3461946f3c431ca3 (patch)
tree302f7364ac8225d9e08e7b5d3748b35afb6a800f /redfish-core/lib/sensors.hpp
parent2107fe1809bf71cd72bdaf21e432d96b3dccc630 (diff)
downloadbmcweb-9d832618c74052bd445d6e8b3461946f3c431ca3.tar.xz
Use AsyncResp in retrieveUriToDbusMap
Initially, when the change to use AsyncResp everywhere was made, the retrieveUriToDbusMap was skipped. This commit address that issue, by adding AsyncResp to retrieveUriToDbusMap. Tested: curl -k -H "X-Auth-Token: $token" -X POST https://${bmc}/redfish/v1/TelemetryService/MetricReportDefinitions/ -d '{"Id": "lxw1", "Metrics": [{"MetricId": "123", "MetricProperties": ["/redfish/v1/Chassis/chassis/Power#/Voltages/0 /ReadingVolts"]}], "MetricReportDefinitionType": "OnRequest", "ReportActions": ["LogToMetricReportsCollection"], "Schedule": {"RecurrenceInterval": "100"}}' { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The resource has been created successfully", "MessageArgs": [], "MessageId": "Base.1.8.1.Created", "MessageSeverity": "OK", "Resolution": "None" } ], "@odata.id": "/redfish/v1/Chassis/chassis/Power", "@odata.type": "#Power.v1_5_2.Power", "Id": "Power", "Name": "Power", "Redundancy": [], "Voltages": [ { "@odata.id": "/redfish/v1/Chassis/chassis/Power#/Voltages/0", "@odata.type": "#Power.v1_0_0.Voltage", "LowerThresholdCritical": 10.8, "LowerThresholdNonCritical": 11.16, "MaxReadingRange": 12600.0, "MemberId": "P12V", "MinReadingRange": 11400.0, "Name": "P12V", "ReadingVolts": 22.930140000000005, "Status": { "Health": "Critical", "State": "Enabled" }, "UpperThresholdCritical": 13.200000000000001, "UpperThresholdNonCritical": 12.84 }, ... The response is too long, so I omitted the following content. Signed-off-by: zhanghaicheng <zhanghch05@inspur.com> Change-Id: I6f82bdb234ddade67f689d79d004d672593fba4f
Diffstat (limited to 'redfish-core/lib/sensors.hpp')
-rw-r--r--redfish-core/lib/sensors.hpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index f9d806b89c..d371378616 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -2960,9 +2960,10 @@ inline void setSensorsOverride(
* @param node Node (group) of sensors. See sensors::node for supported values
* @param mapComplete Callback to be called with retrieval result
*/
-inline void retrieveUriToDbusMap(const std::string& chassis,
- const std::string& node,
- SensorsAsyncResp::DataCompleteCb&& mapComplete)
+inline void
+ retrieveUriToDbusMap(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& chassis, const std::string& node,
+ SensorsAsyncResp::DataCompleteCb&& mapComplete)
{
auto pathIt = sensors::dbus::paths.find(node);
if (pathIt == sensors::dbus::paths.end())
@@ -2972,10 +2973,8 @@ inline void retrieveUriToDbusMap(const std::string& chassis,
return;
}
- auto res = std::make_shared<crow::Response>();
- auto asyncResp = std::make_shared<bmcweb::AsyncResp>(*res);
auto callback =
- [res, asyncResp, mapCompleteCb{std::move(mapComplete)}](
+ [asyncResp, mapCompleteCb{std::move(mapComplete)}](
const boost::beast::http::status status,
const boost::container::flat_map<std::string, std::string>&
uriToDbus) { mapCompleteCb(status, uriToDbus); };