public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/2] api/admin/datastore: rrd: do not include io_ticks for zfs datastores
Date: Tue, 11 Jan 2022 10:27:07 +0100	[thread overview]
Message-ID: <20220111092708.1683867-1-d.csapak@proxmox.com> (raw)

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

Signed-off-by: Dominik Csapak <d.csapak@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





             reply	other threads:[~2022-01-11  9:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11  9:27 Dominik Csapak [this message]
2022-01-11  9:27 ` [pbs-devel] [PATCH proxmox-backup 2/2] ui: hide rrd chard for io delay if no io_ticks are returned Dominik Csapak
2022-01-11  9:28   ` Dominik Csapak
2022-01-11 10:46 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] api/admin/datastore: rrd: do not include io_ticks for zfs datastores Dietmar Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220111092708.1683867-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal