Nvme: Don't trip thresholds when power off
Drives are only available DC on
Tested: Logs went away
Change-Id: I83cea3e1e6486885ef00a47a2122cb3a62468c37
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/NVMeSensor.cpp b/src/NVMeSensor.cpp
index be99f58..e993833 100644
--- a/src/NVMeSensor.cpp
+++ b/src/NVMeSensor.cpp
@@ -228,9 +228,15 @@
constexpr const size_t errorThreshold = 5;
if (errorCode)
{
+ sensor->errorCount = 0;
return;
}
- if (sensor->errorCount < errorThreshold)
+ if (!isPowerOn())
+ {
+ sensor->errorCount = 0;
+ sensor->updateValue(std::numeric_limits<double>::quiet_NaN());
+ }
+ else if (sensor->errorCount < errorThreshold)
{
std::cerr << "MCTP timeout device " << sensor->name << "\n";
sensor->errorCount++;
@@ -474,5 +480,9 @@
void NVMeSensor::checkThresholds(void)
{
+ if (!isPowerOn())
+ {
+ return;
+ }
thresholds::checkThresholds(this);
}