tools: smart: only throw error for smartctl fatal errors

only bit 0-2 are fatal errors, bit 3-7 are used to indicate
some drive conditions. for details see the manpage of smartctl(8)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ Thomas: resolved merge-conflict due to moved run_command ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-08-31 15:48:25 +02:00 committed by Thomas Lamprecht
parent bbd57396d7
commit af2eb422d5
1 changed files with 3 additions and 1 deletions

View File

@ -91,7 +91,9 @@ pub fn get_smart_data(
}; };
command.arg(disk_path); command.arg(disk_path);
let output = pbs_tools::run_command(command, None)?; let output = pbs_tools::run_command(command, Some(|exitcode|
(exitcode & 0b0111) == 0 // only bits 0-2 are fatal errors
))?;
let output: serde_json::Value = output.parse()?; let output: serde_json::Value = output.parse()?;