The disk predictor assumes that it has at least 6 days worth of data to work
with, and the code ensures that `health_data` contains at least 6 elements.
However, it then gets fitlered down into a `predict_datas` array that can
contain less than 6 elements in some cases.
This commit ensures that `predict_datas` contains 6 elements or more before
passing it on to the disk predictor.
Fixes: https://tracker.ceph.com/issues/46549
Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
(cherry picked from commit
ab0e5ae928d4fc15cf812957541c02770d13ab26)
else:
self.log.error('unable to predict device due to health data records less than 6 days')
- if predict_datas:
+ if len(predict_datas) >= 6:
predicted_result = obj_predictor.predict(predict_datas)
return predicted_result