fix: throw appropriate errors when all disks fail (#13820)

when all disks fail with same error, fail server
startup anyways - we cannot proceed.

fixes #13818
This commit is contained in:
Harshavardhana
2021-12-03 09:25:17 -08:00
committed by GitHub
parent 1df1517449
commit a7c430355a
3 changed files with 48 additions and 6 deletions

View File

@@ -188,13 +188,17 @@ func connectLoadInitFormats(retryCount int, firstDisk bool, endpoints Endpoints,
for i, err := range errs {
if err != nil {
if err == errDiskNotFound && retryCount >= 5 {
logger.Info("Unable to connect to %s: %v", endpoints[i], isServerResolvable(endpoints[i], time.Second))
logger.Error("Unable to connect to %s: %v", endpoints[i], isServerResolvable(endpoints[i], time.Second))
} else {
logger.Info("Unable to use the drive %s: %v", endpoints[i], err)
logger.Error("Unable to use the drive %s: %v", endpoints[i], err)
}
}
}
if err := checkDiskFatalErrs(errs); err != nil {
return nil, nil, err
}
// Attempt to load all `format.json` from all disks.
formatConfigs, sErrs := loadFormatErasureAll(storageDisks, false)
// Check if we have
@@ -202,7 +206,7 @@ func connectLoadInitFormats(retryCount int, firstDisk bool, endpoints Endpoints,
// print the error, nonetheless, which is perhaps unhandled
if sErr != errUnformattedDisk && sErr != errDiskNotFound && retryCount >= 5 {
if sErr != nil {
logger.Info("Unable to read 'format.json' from %s: %v\n", endpoints[i], sErr)
logger.Error("Unable to read 'format.json' from %s: %v\n", endpoints[i], sErr)
}
}
}