diff options
author | Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com> | 2017-10-03 03:58:05 -0500 |
---|---|---|
committer | Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com> | 2017-10-11 10:17:12 -0500 |
commit | e245e4e932279a112325dae06d7c12cf9e8ed833 (patch) | |
tree | 0be93f1578b547b6911c1f09f4c70b259e67b2a7 /sensordatahandler.cpp | |
parent | e84841ce7e833d527709c557e9e25829f4e3893c (diff) | |
download | phosphor-host-ipmid-e245e4e932279a112325dae06d7c12cf9e8ed833.tar.gz phosphor-host-ipmid-e245e4e932279a112325dae06d7c12cf9e8ed833.zip |
IPMI changes to mark non present as non functional
When marking a unit as functional, both functional state
and presence need to be checked to avoid marking non-present
units as functional.
Change-Id: If7b710c39f1c2590b82378ebdb7014dc924599ff
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Diffstat (limited to 'sensordatahandler.cpp')
-rw-r--r-- | sensordatahandler.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/sensordatahandler.cpp b/sensordatahandler.cpp index c8d4fbf..8240108 100644 --- a/sensordatahandler.cpp +++ b/sensordatahandler.cpp @@ -132,7 +132,7 @@ GetSensorResponse mapDbusToAssertion(const Info& sensorInfo, interface.first, property.first); - for (const auto& value : property.second) + for (const auto& value : std::get<OffsetValueMap>(property.second)) { if (propValue == value.second.assert) { @@ -176,7 +176,7 @@ GetSensorResponse eventdata2(const Info& sensorInfo) interface.first, property.first); - for (const auto& value : property.second) + for (const auto& value : std::get<OffsetValueMap>(property.second)) { if (propValue == value.second.assert) { @@ -230,8 +230,8 @@ ipmi_ret_t eventdata(const SetSensorReadingReq& cmdData, for (const auto& property : interface->second) { msg.append(property.first); - const auto& iter = property.second.find(data); - if (iter == property.second.end()) + const auto& iter = std::get<OffsetValueMap>(property.second).find(data); + if (iter == std::get<OffsetValueMap>(property.second).end()) { log<level::ERR>("Invalid event data"); return IPMI_CC_PARM_OUT_OF_RANGE; @@ -258,7 +258,7 @@ ipmi_ret_t assertion(const SetSensorReadingReq& cmdData, for (const auto& property : interface->second) { msg.append(property.first); - for (const auto& value : property.second) + for (const auto& value : std::get<OffsetValueMap>(property.second)) { if (assertionSet.test(value.first)) { @@ -310,11 +310,14 @@ ipmi_ret_t assertion(const SetSensorReadingReq& cmdData, ipmi::sensor::InterfaceMap interfaces; for (const auto& interface : sensorInfo.propertyInterfaces) { + //For a property like functional state the result will be + //calculated based on the true value of all conditions. for (const auto& property : interface.second) { ipmi::sensor::PropertyMap props; bool valid = false; - for (const auto& value : property.second) + auto result = true; + for (const auto& value : std::get<OffsetValueMap>(property.second)) { if (assertionSet.test(value.first)) { @@ -323,7 +326,7 @@ ipmi_ret_t assertion(const SetSensorReadingReq& cmdData, { return IPMI_CC_OK; } - props.emplace(property.first, value.second.assert); + result = result && value.second.assert.get<bool>(); valid = true; } else if (deassertionSet.test(value.first)) @@ -333,12 +336,25 @@ ipmi_ret_t assertion(const SetSensorReadingReq& cmdData, { return IPMI_CC_OK; } - props.emplace(property.first, value.second.deassert); + result = result && value.second.deassert.get<bool>(); valid = true; } } + for (const auto& value : + std::get<PreReqOffsetValueMap>(property.second)) + { + if (assertionSet.test(value.first)) + { + result = result && value.second.assert.get<bool>(); + } + else if (deassertionSet.test(value.first)) + { + result = result && value.second.deassert.get<bool>(); + } + } if (valid) { + props.emplace(property.first, result); interfaces.emplace(interface.first, std::move(props)); } } |