Fail for critical errors early on during prepare storage (#6404)

This commit is contained in:
Harshavardhana 2018-09-05 10:20:54 -07:00 committed by kannappanr
parent d0d015361c
commit e0f8b767ba
1 changed files with 6 additions and 6 deletions

View File

@ -129,6 +129,12 @@ func connectLoadInitFormats(firstDisk bool, endpoints EndpointList, setCount, dr
// Attempt to load all `format.json` from all disks. // Attempt to load all `format.json` from all disks.
formatConfigs, sErrs := loadFormatXLAll(storageDisks) formatConfigs, sErrs := loadFormatXLAll(storageDisks)
// Check if we have
for i, sErr := range sErrs {
if _, ok := formatCriticalErrors[sErr]; ok {
return nil, fmt.Errorf("Disk %s: %s", endpoints[i], sErr)
}
}
// Pre-emptively check if one of the formatted disks // Pre-emptively check if one of the formatted disks
// is invalid. This function returns success for the // is invalid. This function returns success for the
@ -139,12 +145,6 @@ func connectLoadInitFormats(firstDisk bool, endpoints EndpointList, setCount, dr
return nil, err return nil, err
} }
for i, sErr := range sErrs {
if _, ok := formatCriticalErrors[sErr]; ok {
return nil, fmt.Errorf("Disk %s: %s", endpoints[i], sErr)
}
}
// All disks report unformatted we should initialized everyone. // All disks report unformatted we should initialized everyone.
if shouldInitXLDisks(sErrs) && firstDisk { if shouldInitXLDisks(sErrs) && firstDisk {
return initFormatXL(context.Background(), storageDisks, setCount, drivesPerSet) return initFormatXL(context.Background(), storageDisks, setCount, drivesPerSet)