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.
This commit is contained in:
Harshavardhana 2020-09-24 15:36:47 -07:00 committed by GitHub
parent e6ab4db6b8
commit 3cac262dd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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{