mirror of https://github.com/minio/minio.git
server-info: Return initializing state properly (#17070)
This commit is contained in:
parent
477230c82e
commit
6addc7a35d
|
@ -87,7 +87,6 @@ func getLocalServerProperty(endpointServerPools EndpointServerPools, r *http.Req
|
|||
}
|
||||
|
||||
props := madmin.ServerProperties{
|
||||
State: string(madmin.ItemInitializing),
|
||||
Endpoint: addr,
|
||||
Uptime: UTCNow().Unix() - globalBootTime.Unix(),
|
||||
Version: Version,
|
||||
|
@ -146,7 +145,8 @@ func getLocalServerProperty(endpointServerPools EndpointServerPools, r *http.Req
|
|||
props.State = string(madmin.ItemOnline)
|
||||
props.Disks = storageInfo.Disks
|
||||
} else {
|
||||
props.State = string(madmin.ItemOffline)
|
||||
props.State = string(madmin.ItemInitializing)
|
||||
props.Disks = getOfflineDisks("", globalEndpoints)
|
||||
}
|
||||
|
||||
return props
|
||||
|
|
|
@ -883,11 +883,13 @@ func (sys *NotificationSys) GetProcInfo(ctx context.Context) []madmin.ProcInfo {
|
|||
return reply
|
||||
}
|
||||
|
||||
// Construct a list of offline disks information for a given node.
|
||||
// If offlineHost is empty, do it for the local disks.
|
||||
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 {
|
||||
if offlineHost == "" && ep.IsLocal || offlineHost == ep.Host {
|
||||
offlineDisks = append(offlineDisks, madmin.Disk{
|
||||
Endpoint: ep.String(),
|
||||
State: string(madmin.ItemOffline),
|
||||
|
@ -947,8 +949,6 @@ func (sys *NotificationSys) ServerInfo() []madmin.ServerProperties {
|
|||
info.Endpoint = client.host.String()
|
||||
info.State = string(madmin.ItemOffline)
|
||||
info.Disks = getOfflineDisks(info.Endpoint, globalEndpoints)
|
||||
} else {
|
||||
info.State = string(madmin.ItemOnline)
|
||||
}
|
||||
reply[idx] = info
|
||||
}(client, i)
|
||||
|
|
Loading…
Reference in New Issue