[pbs-devel] [PATCH proxmox-backup 1/2] api2/status: fix estimation bug

Dominik Csapak d.csapak at proxmox.com
Fri Jul 17 15:39:16 CEST 2020


when a datastore has enough data to calculate the estimated full date,
but always has exactly the same usage, the factor b of the regression
is '0'

return 0 for that case so that the gui can show 'never' instead of
'not enough data'

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/api2/status.rs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/api2/status.rs b/src/api2/status.rs
index 34e0505..4f98543 100644
--- a/src/api2/status.rs
+++ b/src/api2/status.rs
@@ -161,6 +161,8 @@ fn datastore_status(
                         if b != 0.0 {
                             let estimate = (1.0 - a) / b;
                             entry["estimated-full-date"] = Value::from(estimate.floor() as u64);
+                        } else {
+                            entry["estimated-full-date"] = Value::from(0);
                         }
                     }
                 }
-- 
2.20.1






More information about the pbs-devel mailing list