diff --git a/cmd/endpoint.go b/cmd/endpoint.go index 0db280fc3..7b21c0cbc 100644 --- a/cmd/endpoint.go +++ b/cmd/endpoint.go @@ -182,12 +182,12 @@ func (endpoints EndpointList) SetHTTP() { func NewEndpointList(args ...string) (endpoints EndpointList, err error) { // isValidDistribution - checks whether given count is a valid distribution for erasure coding. isValidDistribution := func(count int) bool { - return (count >= 4 && count <= 16 && count%2 == 0) + return (count >= minErasureBlocks && count <= maxErasureBlocks && count%2 == 0) } // Check whether no. of args are valid for XL distribution. if !isValidDistribution(len(args)) { - return nil, fmt.Errorf("total endpoints %d found. For XL/Distribute, it should be 4, 6, 8, 10, 12, 14 or 16", len(args)) + return nil, fmt.Errorf("A total of %d endpoints were found. For erasure mode it should be an even number between %d and %d", len(args), minErasureBlocks, maxErasureBlocks) } var endpointType EndpointType diff --git a/cmd/endpoint_test.go b/cmd/endpoint_test.go index 8f69c3162..49736bd66 100644 --- a/cmd/endpoint_test.go +++ b/cmd/endpoint_test.go @@ -123,7 +123,7 @@ func TestNewEndpointList(t *testing.T) { {[]string{"d1", "d2", "d3", "d1"}, fmt.Errorf("duplicate endpoints found")}, {[]string{"d1", "d2", "d3", "./d1"}, fmt.Errorf("duplicate endpoints found")}, {[]string{"http://localhost/d1", "http://localhost/d2", "http://localhost/d1", "http://localhost/d4"}, fmt.Errorf("duplicate endpoints found")}, - {[]string{"d1", "d2", "d3", "d4", "d5"}, fmt.Errorf("total endpoints 5 found. For XL/Distribute, it should be 4, 6, 8, 10, 12, 14 or 16")}, + {[]string{"d1", "d2", "d3", "d4", "d5"}, fmt.Errorf("A total of 5 endpoints were found. For erasure mode it should be an even number between 4 and 16")}, {[]string{"ftp://server/d1", "http://server/d2", "http://server/d3", "http://server/d4"}, fmt.Errorf("'ftp://server/d1': invalid URL endpoint format")}, {[]string{"d1", "http://localhost/d2", "d3", "d4"}, fmt.Errorf("mixed style endpoints are not supported")}, {[]string{"http://example.org/d1", "https://example.com/d1", "http://example.net/d1", "https://example.edut/d1"}, fmt.Errorf("mixed scheme is not supported")},