mirror of https://github.com/minio/minio.git
remove network calls for getLocalDisks (#11603)
This commit is contained in:
parent
18ec933085
commit
da676ac298
|
@ -17,9 +17,11 @@
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/minio/minio/cmd/logger"
|
||||||
"github.com/minio/minio/pkg/madmin"
|
"github.com/minio/minio/pkg/madmin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -46,10 +48,12 @@ func getLocalServerProperty(endpointServerPools EndpointServerPools, r *http.Req
|
||||||
}
|
}
|
||||||
_, present := network[nodeName]
|
_, present := network[nodeName]
|
||||||
if !present {
|
if !present {
|
||||||
if err := isServerResolvable(endpoint, time.Second); err == nil {
|
if err := isServerResolvable(endpoint, 2*time.Second); err == nil {
|
||||||
network[nodeName] = "online"
|
network[nodeName] = "online"
|
||||||
} else {
|
} else {
|
||||||
network[nodeName] = "offline"
|
network[nodeName] = "offline"
|
||||||
|
// log once the error
|
||||||
|
logger.LogOnceIf(context.Background(), err, nodeName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,30 +77,15 @@ func getLocalServerProperty(endpointServerPools EndpointServerPools, r *http.Req
|
||||||
|
|
||||||
func getLocalDisks(endpointServerPools EndpointServerPools) []madmin.Disk {
|
func getLocalDisks(endpointServerPools EndpointServerPools) []madmin.Disk {
|
||||||
var localEndpoints Endpoints
|
var localEndpoints Endpoints
|
||||||
network := make(map[string]string)
|
|
||||||
|
|
||||||
for _, ep := range endpointServerPools {
|
for _, ep := range endpointServerPools {
|
||||||
for _, endpoint := range ep.Endpoints {
|
for _, endpoint := range ep.Endpoints {
|
||||||
nodeName := endpoint.Host
|
if !endpoint.IsLocal {
|
||||||
if nodeName == "" {
|
|
||||||
nodeName = "localhost"
|
|
||||||
}
|
|
||||||
if endpoint.IsLocal {
|
|
||||||
// Only proceed for local endpoints
|
|
||||||
network[nodeName] = "online"
|
|
||||||
localEndpoints = append(localEndpoints, endpoint)
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
_, present := network[nodeName]
|
localEndpoints = append(localEndpoints, endpoint)
|
||||||
if !present {
|
|
||||||
if err := isServerResolvable(endpoint, time.Second); err == nil {
|
|
||||||
network[nodeName] = "online"
|
|
||||||
} else {
|
|
||||||
network[nodeName] = "offline"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
localDisks, _ := initStorageDisksWithErrors(localEndpoints)
|
localDisks, _ := initStorageDisksWithErrors(localEndpoints)
|
||||||
defer closeStorageDisks(localDisks)
|
defer closeStorageDisks(localDisks)
|
||||||
storageInfo, _ := getStorageInfo(localDisks, localEndpoints.GetAllStrings())
|
storageInfo, _ := getStorageInfo(localDisks, localEndpoints.GetAllStrings())
|
||||||
|
|
|
@ -167,8 +167,7 @@ func isServerResolvable(endpoint Endpoint, timeout time.Duration) error {
|
||||||
var tlsConfig *tls.Config
|
var tlsConfig *tls.Config
|
||||||
if globalIsTLS {
|
if globalIsTLS {
|
||||||
tlsConfig = &tls.Config{
|
tlsConfig = &tls.Config{
|
||||||
ServerName: endpoint.Hostname(),
|
RootCAs: globalRootCAs,
|
||||||
RootCAs: globalRootCAs,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue