dak180 / FreeNAS-Report

SMART & ZPool Status Report for FreeNAS/TrueNAS
GNU General Public License v3.0
38 stars 8 forks source link

Fix for out of order check on lastTestType prior to setting it to 'N/A' #11

Closed mth309 closed 2 years ago

mth309 commented 2 years ago

After your re-arranging of these two code blocks, I thought combining them as a single nested block actually makes the most sense? This way I believe it's even more obvious that the inner block is just a workaround for some badly behaved drives? And this seems better than testing for "Default Self" twice, in two separate code blocks.

mth309 commented 2 years ago

While I was in there I fixed another issue for people with very long-running drives. The lifetime hours counter in the selftest log overflows after 65535 hours, whereas the total drive lifetime (typically) does not (though I've seen the total counter overflow at various values on various drives and I can't universally correct for that). This leads to situations where drives might have e.g. 80,000 hours of total lifetime, and show that the last selftest was run 14,500 hours ago. The delta between the two is >65535 hours, due to the overflow of the value in the selftest log, and the selftest was actually only run a few hours ago.

I added a test for this condition on both SATA and SAS drives, but I've never seen this issue on NVME and I'm not sure whether they are subject to the same problem so I didn't edit those.