|
|
|
@ -768,31 +768,39 @@ func loadFormatXL(bootstrapDisks []StorageAPI, readQuorum int) (disks []StorageA |
|
|
|
|
return reorderDisks(bootstrapDisks, formatConfigs) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func checkFormatXLValues(formatConfigs []*formatConfigV1) error { |
|
|
|
|
for _, formatXL := range formatConfigs { |
|
|
|
|
func checkFormatXLValue(formatXL *formatConfigV1) error { |
|
|
|
|
// Validate format version and format type.
|
|
|
|
|
if formatXL.Version != "1" { |
|
|
|
|
return fmt.Errorf("Unsupported version of backend format [%s] found", formatXL.Version) |
|
|
|
|
} |
|
|
|
|
if formatXL.Format != "xl" { |
|
|
|
|
return fmt.Errorf("Unsupported backend format [%s] found", formatXL.Format) |
|
|
|
|
} |
|
|
|
|
if formatXL.XL.Version != "1" { |
|
|
|
|
return fmt.Errorf("Unsupported XL backend format found [%s]", formatXL.XL.Version) |
|
|
|
|
} |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func checkFormatXLValues(formatConfigs []*formatConfigV1) (int, error) { |
|
|
|
|
for i, formatXL := range formatConfigs { |
|
|
|
|
if formatXL == nil { |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
// Validate format version and format type.
|
|
|
|
|
if formatXL.Version != "1" { |
|
|
|
|
return fmt.Errorf("Unsupported version of backend format [%s] found", formatXL.Version) |
|
|
|
|
} |
|
|
|
|
if formatXL.Format != "xl" { |
|
|
|
|
return fmt.Errorf("Unsupported backend format [%s] found", formatXL.Format) |
|
|
|
|
} |
|
|
|
|
if formatXL.XL.Version != "1" { |
|
|
|
|
return fmt.Errorf("Unsupported XL backend format found [%s]", formatXL.XL.Version) |
|
|
|
|
if err := checkFormatXLValue(formatXL); err != nil { |
|
|
|
|
return i, err |
|
|
|
|
} |
|
|
|
|
if len(formatConfigs) != len(formatXL.XL.JBOD) { |
|
|
|
|
return fmt.Errorf("Number of disks %d did not match the backend format %d", len(formatConfigs), len(formatXL.XL.JBOD)) |
|
|
|
|
return i, fmt.Errorf("Number of disks %d did not match the backend format %d", |
|
|
|
|
len(formatConfigs), len(formatXL.XL.JBOD)) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return nil |
|
|
|
|
return -1, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// checkFormatXL - verifies if format.json format is intact.
|
|
|
|
|
func checkFormatXL(formatConfigs []*formatConfigV1) error { |
|
|
|
|
if err := checkFormatXLValues(formatConfigs); err != nil { |
|
|
|
|
if _, err := checkFormatXLValues(formatConfigs); err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
if err := checkJBODConsistency(formatConfigs); err != nil { |
|
|
|
|