let disk_usage return StorageStatus and use it for datastores/nodes

disk_usage returned the same values as defined in StorageStatus,
so simply use that

with that we can replace the logic of the datastore status with that
function and also use it for root disk usage of the nodes

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak
2020-06-09 10:01:09 +02:00
committed by Dietmar Maurer
parent da84cc52f4
commit 33070956af
4 changed files with 18 additions and 24 deletions

View File

@ -711,11 +711,11 @@ async fn generate_host_stats(save: bool) {
fn gather_disk_stats(disk_manager: Arc<DiskManage>, path: &Path, rrd_prefix: &str, save: bool) {
match proxmox_backup::tools::disks::disk_usage(path) {
Ok((total, used, _avail)) => {
Ok(status) => {
let rrd_key = format!("{}/total", rrd_prefix);
rrd_update_gauge(&rrd_key, total as f64, save);
rrd_update_gauge(&rrd_key, status.total as f64, save);
let rrd_key = format!("{}/used", rrd_prefix);
rrd_update_gauge(&rrd_key, used as f64, save);
rrd_update_gauge(&rrd_key, status.used as f64, save);
}
Err(err) => {
eprintln!("read disk_usage on {:?} failed - {}", path, err);