heal: Avoid printing repetitive error to heal a root disk (#14220)

The healing code repeatedly tries to heal a root disk when it is empty
the reason is that connectEndpoint() returns errUnformattedDisk even
if the disk is a root disk. Changing that to returning another error
will avoid queueing the disk to the healing code in each connect disks
iteration.
This commit is contained in:
Anis Elleuch 2022-02-01 02:28:20 +01:00 committed by GitHub
parent 74faed166a
commit 127e8bf3b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,7 +146,7 @@ func connectEndpoint(endpoint Endpoint) (StorageAPI, *formatErasureV3, error) {
if errors.Is(err, errUnformattedDisk) {
info, derr := disk.DiskInfo(context.TODO())
if derr != nil && info.RootDisk {
return nil, nil, fmt.Errorf("Disk: %s returned %w", disk, derr) // make sure to '%w' to wrap the error
return nil, nil, fmt.Errorf("Disk: %s is a root disk", disk)
}
}
return nil, nil, fmt.Errorf("Disk: %s returned %w", disk, err) // make sure to '%w' to wrap the error