QAT: make plugin read trimmed heartbeat status

Plugin used to consider only the value "-1" but there are some
cases when files show "\n" or "\n\x00". This makes plugin to have
wrong status of the device. So, trim the value after \n so only
numerical value can be read.

Signed-off-by: Hyeongju Johannes Lee <hyeongju.lee@intel.com>
This commit is contained in:
Hyeongju Johannes Lee 2024-08-05 15:14:08 +03:00
parent 5c8faeae17
commit ea6d52d443

View File

@ -416,7 +416,7 @@ func getDeviceHealthiness(device string, lookup map[string]string) string {
// If status reads "-1", the device is considered bad: // If status reads "-1", the device is considered bad:
// https://github.com/torvalds/linux/blob/v6.6-rc5/Documentation/ABI/testing/debugfs-driver-qat // https://github.com/torvalds/linux/blob/v6.6-rc5/Documentation/ABI/testing/debugfs-driver-qat
if data, err := os.ReadFile(hbStatusFile); err == nil && string(data) == "-1" { if data, err := os.ReadFile(hbStatusFile); err == nil && strings.Split(string(data), "\n")[0] == "-1" {
healthiness = pluginapi.Unhealthy healthiness = pluginapi.Unhealthy
} }