Prevent minio server starting in standalone erasure mode for wrong inputs. (#4700)

It is possible at times due to a typo when distributed mode was intended
a user might end up starting standalone erasure mode causing confusion.
Add code to check this based on some standard heuristic guess work and
report an error to the user.

Fixes #4686
This commit is contained in:
Dee Koder
2017-08-10 16:54:19 -07:00
committed by Harshavardhana
parent 3544e5ad01
commit 1978b9d8f9
4 changed files with 38 additions and 1 deletions

View File

@@ -132,6 +132,12 @@ func NewEndpoint(arg string) (ep Endpoint, e error) {
return ep, err
}
} else {
// Only check if the arg is an ip address and ask for scheme since its absent.
// localhost, example.com, any FQDN cannot be disambiguated from a regular file path such as
// /mnt/export1. So we go ahead and start the minio server in FS modes in these cases.
if isHostIPv4(arg) {
return ep, fmt.Errorf("invalid URL endpoint format: missing scheme http or https")
}
u = &url.URL{Path: path.Clean(arg)}
isLocal = true
}
@@ -212,7 +218,6 @@ func NewEndpointList(args ...string) (endpoints EndpointList, err error) {
return nil, fmt.Errorf("duplicate endpoints found")
}
uniqueArgs.Add(arg)
endpoints = append(endpoints, endpoint)
}
@@ -267,6 +272,7 @@ func CreateEndpoints(serverAddr string, args ...string) (string, EndpointList, S
localEndpointCount := 0
localServerAddrSet := set.NewStringSet()
localPortSet := set.NewStringSet()
for _, endpoint := range endpoints {
endpointPathSet.Add(endpoint.Path)
if endpoint.IsLocal {