mirror of
https://github.com/minio/minio.git
synced 2024-12-23 21:55:53 -05:00
fix: pool number not added for one server (#11670)
The previous code was iterating over replies from peers and assigning pool numbers to them, thus missing to add it for the local server. Fixed by iterating over the server properties of all the servers including the local one.
This commit is contained in:
parent
0b9c17443e
commit
289b22d911
@ -1570,6 +1570,8 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque
|
||||
servers := globalNotificationSys.ServerInfo()
|
||||
servers = append(servers, server)
|
||||
|
||||
assignPoolNumbers(servers)
|
||||
|
||||
var backend interface{}
|
||||
mode := madmin.ObjectLayerInitializing
|
||||
|
||||
@ -1651,6 +1653,22 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque
|
||||
writeSuccessResponseJSON(w, jsonBytes)
|
||||
}
|
||||
|
||||
func assignPoolNumbers(servers []madmin.ServerProperties) {
|
||||
for i := range servers {
|
||||
for idx, ge := range globalEndpoints {
|
||||
for _, endpoint := range ge.Endpoints {
|
||||
if servers[i].Endpoint == endpoint.Host {
|
||||
servers[i].PoolNumber = idx + 1
|
||||
} else if host, err := xnet.ParseHost(servers[i].Endpoint); err == nil {
|
||||
if host.Name == endpoint.Hostname() {
|
||||
servers[i].PoolNumber = idx + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func fetchLambdaInfo() []map[string][]madmin.TargetIDStatus {
|
||||
|
||||
lambdaMap := make(map[string][]madmin.TargetIDStatus)
|
||||
|
@ -1240,20 +1240,6 @@ func (sys *NotificationSys) ServerInfo() []madmin.ServerProperties {
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
for i := range reply {
|
||||
for j := range globalEndpoints {
|
||||
for _, endpoint := range globalEndpoints[j].Endpoints {
|
||||
if reply[i].Endpoint == endpoint.Host {
|
||||
reply[i].PoolNumber = j + 1
|
||||
} else if host, err := xnet.ParseHost(reply[i].Endpoint); err == nil {
|
||||
if host.Name == endpoint.Hostname() {
|
||||
reply[i].PoolNumber = j + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return reply
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user