From 3cac262dd1d9af758286d1b44dc7e1b23d74293e Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 24 Sep 2020 15:36:47 -0700 Subject: [PATCH] report heal drives properly, also from global state (#10561) It is possible the heal drives are not reported from the maintenance check because the background heal state simply relied on the `format.json` for capturing unformatted drives. It is possible that drives might be still healing - make sure that applications which rely on cluster health check respond back this detail. --- cmd/global-heal.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/cmd/global-heal.go b/cmd/global-heal.go index 9e45c1938..bd06bbc6d 100644 --- a/cmd/global-heal.go +++ b/cmd/global-heal.go @@ -66,19 +66,26 @@ func getLocalBackgroundHealStatus() (madmin.BgHealState, bool) { if globalBackgroundHealState == nil { return madmin.BgHealState{}, false } + bgSeq, ok := globalBackgroundHealState.getHealSequenceByToken(bgHealingUUID) if !ok { return madmin.BgHealState{}, false } - objAPI := newObjectLayerWithoutSafeModeFn() - if objAPI == nil { - return madmin.BgHealState{}, false + var healDisksMap = map[string]struct{}{} + for _, ep := range getLocalDisksToHeal() { + healDisksMap[ep.String()] = struct{}{} + } + + for _, ep := range globalBackgroundHealState.getHealLocalDisks() { + if _, ok := healDisksMap[ep.String()]; !ok { + healDisksMap[ep.String()] = struct{}{} + } } var healDisks []string - for _, ep := range getLocalDisksToHeal() { - healDisks = append(healDisks, ep.String()) + for disk := range healDisksMap { + healDisks = append(healDisks, disk) } return madmin.BgHealState{