[pbs-devel] [PATCH proxmox-backup 1/2] api/admin/datastore: rrd: do not include io_ticks for zfs datastores

Dominik Csapak d.csapak at proxmox.com
Tue Jan 11 10:27:07 CET 2022


since it is not possible to collect them, do not return them here either

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/api2/admin/datastore.rs | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs
index 4073c96b..263ea96f 100644
--- a/src/api2/admin/datastore.rs
+++ b/src/api2/admin/datastore.rs
@@ -1567,14 +1567,24 @@ pub fn get_rrd_stats(
     _param: Value,
 ) -> Result<Value, Error> {
 
+    let datastore = DataStore::lookup_datastore(&store)?;
+    let disk_manager = crate::tools::disks::DiskManage::new();
+
+    let mut rrd_fields = vec![
+        "total", "used",
+        "read_ios", "read_bytes",
+        "write_ios", "write_bytes",
+    ];
+
+    // we do not have io_ticks for zpools, so don't include them
+    match disk_manager.find_mounted_device(&datastore.base_path()) {
+        Ok(Some((fs_type, _, _))) if fs_type.as_str() == "zfs" => {},
+        _ => rrd_fields.push("io_ticks"),
+    };
+
     create_value_from_rrd(
         &format!("datastore/{}", store),
-        &[
-            "total", "used",
-            "read_ios", "read_bytes",
-            "write_ios", "write_bytes",
-            "io_ticks",
-        ],
+        &rrd_fields,
         timeframe,
         cf,
     )
-- 
2.30.2






More information about the pbs-devel mailing list