public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup v4 1/3] fix #4077: Estimated Full metric on ext4 file systems
Date: Wed, 24 Aug 2022 12:26:55 +0200	[thread overview]
Message-ID: <20220824102657.159735-1-d.tschlatscher@proxmox.com> (raw)

The rrd data now includes tracking the total disk usage for the unpri-
vileged backup user. The calculation for the estimated_time_full was
adapted to use the total for the unpriviliged user.

The unpriv_total is the sum of the used space in the file system, plus
the available space for the unpriviliged user.

Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
Reviewed-by: Matthias Heiserer <m.heiserer@proxmox.com>
---
No changes from v3

 src/api2/status.rs              | 3 ++-
 src/bin/proxmox-backup-proxy.rs | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/api2/status.rs b/src/api2/status.rs
index 50d401c2..b918156e 100644
--- a/src/api2/status.rs
+++ b/src/api2/status.rs
@@ -84,7 +84,8 @@ pub async fn datastore_status(
         let get_rrd =
             |what: &str| extract_rrd_data(&rrd_dir, what, RRDTimeFrame::Month, RRDMode::Average);
 
-        let total_res = get_rrd("total")?;
+        // Use the space for the unpriviliged user, as e.g. ext4 reserves 5% of disks for root only
+        let total_res = get_rrd("unpriv_total")?;
         let used_res = get_rrd("used")?;
 
         if let (
diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs
index 214bc9b1..e5c8813f 100644
--- a/src/bin/proxmox-backup-proxy.rs
+++ b/src/bin/proxmox-backup-proxy.rs
@@ -1273,6 +1273,8 @@ fn rrd_update_disk_stat(disk: &DiskStat, rrd_prefix: &str) {
         rrd_update_gauge(&rrd_key, status.total as f64);
         let rrd_key = format!("{}/used", rrd_prefix);
         rrd_update_gauge(&rrd_key, status.used as f64);
+        let rrd_key = format!("{}/unpriv_total", rrd_prefix);
+        rrd_update_gauge(&rrd_key, (status.used + status.available) as f64);
     }
 
     if let Some(stat) = &disk.dev {
-- 
2.30.2





             reply	other threads:[~2022-08-24 10:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-24 10:26 Daniel Tschlatscher [this message]
2022-08-24 10:26 ` [pbs-devel] [PATCH proxmox-backup v4 2/3] expose the unpriviliged total in the api and use it in the GUI Daniel Tschlatscher
2022-08-24 10:26 ` [pbs-devel] [PATCH proxmox-backup v4 3/3] gui: change reporting of the estimated_time_full to "Full" if no space Daniel Tschlatscher
2022-10-05 15:56 ` [pbs-devel] [PATCH proxmox-backup v4 1/3] fix #4077: Estimated Full metric on ext4 file systems Thomas Lamprecht
2022-10-10 14:23   ` Daniel Tschlatscher
2022-10-12 11:31     ` Thomas Lamprecht

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=20220824102657.159735-1-d.tschlatscher@proxmox.com \
    --to=d.tschlatscher@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