Currently the code assumed some orthogonal requirements
which led situations where when we have a setup where
we have let's say for example 168 drives, the final
set_drive_count chosen was 14. Indeed 168 drives are
divisible by 12 but this wasn't allowed due to an
unexpected requirement to have 12 to be a perfect modulo
of 14 which is not possible. This assumption was incorrect.
This PR fixes this old assumption properly, also adds
few tests and some negative tests as well. Improvements
are seen in error messages as well.
msg:=fmt.Sprintf("Incorrect number of endpoints provided %s, number of disks %d is not divisible by any supported erasure set sizes %d",args,commonSize,setSizes)
msg:=fmt.Sprintf("Invalid set drive count, leads to non-uniform distribution for the given number of disks. Possible values for custom set count are %d",possibleSetCounts(setSize))
msg:=fmt.Sprintf("Invalid set drive count. Acceptable values for %d number drives are %d",commonSize,setCounts)
// Check whether setSize is with the supported range.
if!isValidSetSize(setSize){
msg:=fmt.Sprintf("Incorrect number of endpoints provided %s",args)
msg:=fmt.Sprintf("Incorrect number of endpoints provided %s, number of disks %d is not divisible by any supported erasure set sizes %d",args,commonSize,setSizes)
returnfmt.Errorf("%s disk is already being used in another erasure deployment. (Number of disks specified: %d but the number of disks found in the %s disk's format.json: %d)",
returnfmt.Errorf("%s disk is already formatted with %d drives per erasure set. This cannot be changed to %d, please revert your MINIO_ERASURE_SET_DRIVE_COUNT setting",humanize.Ordinal(i+1),len(formatXL.XL.Sets[0]),drivesPerSet)