From 2f62cdf491cbfe195606cc5fb78ad1c39e1dc384 Mon Sep 17 00:00:00 2001 From: Qweder93 Date: Tue, 8 Dec 2020 16:55:16 +0200 Subject: [PATCH] storagenode/console: diskSpaceInfo extended with overused diskspace, getDashboardData updated. Change-Id: I44db26661a8dfb45b5d8e9fcb7511f63deb88cad --- storagenode/console/diskspace.go | 1 + storagenode/console/service.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/storagenode/console/diskspace.go b/storagenode/console/diskspace.go index f37f32739..b5cf0a49e 100644 --- a/storagenode/console/diskspace.go +++ b/storagenode/console/diskspace.go @@ -8,4 +8,5 @@ type DiskSpaceInfo struct { Used int64 `json:"used"` Available int64 `json:"available"` Trash int64 `json:"trash"` + Overused int64 `json:"overused"` } diff --git a/storagenode/console/service.go b/storagenode/console/service.go index 304a2ab4b..b603e3b0c 100644 --- a/storagenode/console/service.go +++ b/storagenode/console/service.go @@ -5,6 +5,7 @@ package console import ( "context" + "math" "time" "github.com/spacemonkeygo/monkit/v3" @@ -210,6 +211,11 @@ func (s *Service) GetDashboardData(ctx context.Context) (_ *Dashboard, err error Trash: trash, } + overused := s.allocatedDiskSpace.Int64() - pieceTotal - trash + if overused < 0 { + data.DiskSpace.Overused = int64(math.Abs(float64(overused))) + } + data.Bandwidth = BandwidthInfo{ Used: bandwidthUsage, }