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
+9
View File
@@ -153,6 +153,15 @@ func getAPIEndpoints(serverAddr string) (apiEndpoints []string) {
return apiEndpoints
}
// isHostIPv4 - helper for validating if the provided arg is an ip address.
func isHostIPv4(ipAddress string) bool {
host, _, err := net.SplitHostPort(ipAddress)
if err != nil {
host = ipAddress
}
return net.ParseIP(host) != nil
}
// checkPortAvailability - check if given port is already in use.
// Note: The check method tries to listen on given port and closes it.
// It is possible to have a disconnected client in this tiny window of time.