diff options
author | Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com> | 2017-08-09 09:10:47 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-08-10 17:31:53 +0000 |
commit | 18e9999232b76cc311bd307fd28adce0fb17db9a (patch) | |
tree | cae5703d184253d21bd2f40b448cfa0e147d6482 /sensorhandler.cpp | |
parent | 63a0051b4f93f1422998f0748c9ac6c0111d25c3 (diff) | |
download | phosphor-host-ipmid-18e9999232b76cc311bd307fd28adce0fb17db9a.tar.gz phosphor-host-ipmid-18e9999232b76cc311bd307fd28adce0fb17db9a.zip |
Fix for reboot attempt and catch internal failures.
The assumption was reboot attempt left will be sent through
reading data in ipmi sensor data, but it is being sent as
assertion so adding support to read raw data from assertion bits.
Added a catch for internal failures while calling update function
for sensors.
Change-Id: If45d003c1c22f60e7c8a723c1ff9d077c53cad37
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Diffstat (limited to 'sensorhandler.cpp')
-rw-r--r-- | sensorhandler.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sensorhandler.cpp b/sensorhandler.cpp index a4cfe34..eac4215 100644 --- a/sensorhandler.cpp +++ b/sensorhandler.cpp @@ -7,15 +7,20 @@ #include <systemd/sd-bus.h> #include "host-ipmid/ipmid-api.h" #include <phosphor-logging/log.hpp> +#include <phosphor-logging/elog-errors.hpp> #include "ipmid.hpp" #include "sensorhandler.h" #include "types.hpp" #include "utils.hpp" +#include "xyz/openbmc_project/Common/error.hpp" + extern int updateSensorRecordFromSSRAESC(const void *); extern sd_bus *bus; extern const ipmi::sensor::IdInfoMap sensors; using namespace phosphor::logging; +using InternalFailure = + sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; void register_netfn_sen_functions() __attribute__((constructor)); @@ -418,7 +423,18 @@ ipmi_ret_t setSensorReading(void *request) return IPMI_CC_SENSOR_INVALID; } - return iter->second.updateFunc(cmdData, iter->second); + try + { + return iter->second.updateFunc(cmdData, iter->second); + } + catch (InternalFailure& e) + { + log<level::ERR>("Set sensor failed", + entry("SENSOR_NUM=%d", cmdData.number)); + commit<InternalFailure>(); + } + + return IPMI_CC_UNSPECIFIED_ERROR; } ipmi_ret_t ipmi_sen_set_sensor(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |