fix: add proper errors for disks with preexisting content (#9703)

This commit is contained in:
Harshavardhana
2020-05-26 09:32:33 -07:00
committed by GitHub
parent 5e15b0b844
commit d0ae69087c
3 changed files with 16 additions and 7 deletions

View File

@@ -27,6 +27,7 @@ import (
"time"
"github.com/dustin/go-humanize"
"github.com/minio/minio/cmd/config"
xhttp "github.com/minio/minio/cmd/http"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/cmd/rest"
@@ -227,7 +228,7 @@ func connectLoadInitFormats(retryCount int, firstDisk bool, endpoints Endpoints,
// Check if we have
for i, sErr := range sErrs {
if _, ok := formatCriticalErrors[sErr]; ok {
return nil, nil, fmt.Errorf("Disk %s: %w", endpoints[i], sErr)
return nil, nil, config.ErrCorruptedBackend(err).Hint(fmt.Sprintf("Clear any pre-existing content on %s", endpoints[i]))
}
// not critical error but still print the error, nonetheless, which is perhaps unhandled
if sErr != errUnformattedDisk && sErr != errDiskNotFound && retryCount >= 5 {