From 3afa499885ab33d959ae789c8d05d3afc65f88e0 Mon Sep 17 00:00:00 2001 From: Shireesh Anjal <355479+anjalshireesh@users.noreply.github.com> Date: Tue, 9 Feb 2021 23:22:38 +0530 Subject: [PATCH] fix: empty buckets/objects nodes in new setup (#11493) --- cmd/admin-handlers.go | 4 ++++ pkg/madmin/info-commands.go | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cmd/admin-handlers.go b/cmd/admin-handlers.go index a27d8ce09..307c3439d 100644 --- a/cmd/admin-handlers.go +++ b/cmd/admin-handlers.go @@ -1585,6 +1585,10 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque buckets = madmin.Buckets{Count: dataUsageInfo.BucketsCount} objects = madmin.Objects{Count: dataUsageInfo.ObjectsTotalCount} usage = madmin.Usage{Size: dataUsageInfo.ObjectsTotalSize} + } else { + buckets = madmin.Buckets{Error: err.Error()} + objects = madmin.Objects{Error: err.Error()} + usage = madmin.Usage{Error: err.Error()} } // Fetching the backend information diff --git a/pkg/madmin/info-commands.go b/pkg/madmin/info-commands.go index bc2953f2b..50d5ab1c9 100644 --- a/pkg/madmin/info-commands.go +++ b/pkg/madmin/info-commands.go @@ -195,17 +195,20 @@ type Services struct { // Buckets contains the number of buckets type Buckets struct { - Count uint64 `json:"count,omitempty"` + Count uint64 `json:"count"` + Error string `json:"error,omitempty"` } // Objects contains the number of objects type Objects struct { - Count uint64 `json:"count,omitempty"` + Count uint64 `json:"count"` + Error string `json:"error,omitempty"` } -// Usage contains the tottal size used +// Usage contains the total size used type Usage struct { - Size uint64 `json:"size,omitempty"` + Size uint64 `json:"size"` + Error string `json:"error,omitempty"` } // KMS contains KMS status information