Skip to content

Commit

Permalink
fix: capture disks when entire peer is offline (#11697)
Browse files Browse the repository at this point in the history
currently when one of the peer is down, the
drives from that peer are reported as '0/0'
offline instead we should capture/filter the
drives from the peer and populate it appropriately
such that `mc admin info` displays correct info.
  • Loading branch information
harshavardhana committed Mar 4, 2021
1 parent 7be7109 commit 7865850
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cmd/notification.go
Expand Up @@ -1218,6 +1218,21 @@ func (sys *NotificationSys) ProcInfo(ctx context.Context) []madmin.ServerProcInf
return reply
}

func getOfflineDisks(offlineHost string, endpoints EndpointServerPools) []madmin.Disk {
var offlineDisks []madmin.Disk
for _, pool := range endpoints {
for _, ep := range pool.Endpoints {
if offlineHost == ep.Host {
offlineDisks = append(offlineDisks, madmin.Disk{
Endpoint: ep.String(),
State: string(madmin.ItemOffline),
})
}
}
}
return offlineDisks
}

// ServerInfo - calls ServerInfo RPC call on all peers.
func (sys *NotificationSys) ServerInfo() []madmin.ServerProperties {
reply := make([]madmin.ServerProperties, len(sys.peerClients))
Expand All @@ -1233,6 +1248,7 @@ func (sys *NotificationSys) ServerInfo() []madmin.ServerProperties {
if err != nil {
info.Endpoint = client.host.String()
info.State = string(madmin.ItemOffline)
info.Disks = getOfflineDisks(info.Endpoint, globalEndpoints)
} else {
info.State = string(madmin.ItemOnline)
}
Expand Down

0 comments on commit 7865850

Please sign in to comment.