Provide more descriptive error during erasure init (#5282)

fixes #5239
master
Krishna Srinivas 7 years ago committed by kannappanr
parent d2d49f6c6c
commit a00e052606
  1. 9
      cmd/format-xl.go

@ -24,8 +24,9 @@ import (
"encoding/hex" "encoding/hex"
humanize "github.com/dustin/go-humanize"
"github.com/minio/minio/pkg/errors" "github.com/minio/minio/pkg/errors"
"github.com/minio/sha256-simd" sha256 "github.com/minio/sha256-simd"
) )
const ( const (
@ -373,7 +374,7 @@ func checkFormatXLValue(formatXL *formatXLV2) error {
// Check all format values. // Check all format values.
func checkFormatXLValues(formats []*formatXLV2) error { func checkFormatXLValues(formats []*formatXLV2) error {
for _, formatXL := range formats { for i, formatXL := range formats {
if formatXL == nil { if formatXL == nil {
continue continue
} }
@ -381,8 +382,8 @@ func checkFormatXLValues(formats []*formatXLV2) error {
return err return err
} }
if len(formats) != len(formatXL.XL.Sets)*len(formatXL.XL.Sets[0]) { if len(formats) != len(formatXL.XL.Sets)*len(formatXL.XL.Sets[0]) {
return fmt.Errorf("Number of disks %d did not match the backend format %d", return fmt.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)",
len(formats), len(formatXL.XL.Sets)*len(formatXL.XL.Sets[0])) humanize.Ordinal(i+1), len(formats), humanize.Ordinal(i+1), len(formatXL.XL.Sets)*len(formatXL.XL.Sets[0]))
} }
} }
return nil return nil

Loading…
Cancel
Save