[pbs-devel] [PATCH proxmox-backup] fix #4165: SMART: add raw field

Matthias Heiserer m.heiserer at proxmox.com
Thu Jul 21 12:45:57 CEST 2022


This makes it consistent with the naming scheme in PVE/GUI.
Keep value for API stability reasons, and remove it in next major version.

Signed-off-by: Matthias Heiserer <m.heiserer at proxmox.com>
---
 src/tools/disks/smart.rs | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/tools/disks/smart.rs b/src/tools/disks/smart.rs
index 3738cdfd..787971e9 100644
--- a/src/tools/disks/smart.rs
+++ b/src/tools/disks/smart.rs
@@ -25,8 +25,11 @@ pub enum SmartStatus {
 pub struct SmartAttribute {
     /// Attribute name
     name: String,
-    /// Attribute raw value
+    // fixme remove value in major release
+    /// duplicate of raw - kept for API stability
     value: String,
+    /// Attribute raw value
+    raw: String,
     // the rest of the values is available for ATA type
     /// ATA Attribute ID
     #[serde(skip_serializing_if = "Option::is_none")]
@@ -146,7 +149,8 @@ pub fn get_smart_data(disk: &super::Disk, health_only: bool) -> Result<SmartData
 
             attributes.push(SmartAttribute {
                 name,
-                value: raw_value,
+                value: raw_value.clone(),
+                raw: raw_value,
                 id: Some(id),
                 flags: Some(flags),
                 normalized: Some(normalized),
@@ -180,6 +184,7 @@ pub fn get_smart_data(disk: &super::Disk, health_only: bool) -> Result<SmartData
                 attributes.push(SmartAttribute {
                     name: name.to_string(),
                     value: value.to_string(),
+                    raw: value.to_string(),
                     id: None,
                     flags: None,
                     normalized: None,
-- 
2.30.2






More information about the pbs-devel mailing list