improve server startup error when pools are incorrect (#16056)

This commit is contained in:
Harshavardhana 2022-11-11 19:40:45 -08:00 committed by GitHub
parent 00857f8f59
commit 6d76db9d6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -31,6 +31,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/dustin/go-humanize"
"github.com/minio/madmin-go" "github.com/minio/madmin-go"
"github.com/minio/minio-go/v7/pkg/set" "github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/minio-go/v7/pkg/tags" "github.com/minio/minio-go/v7/pkg/tags"
@ -89,7 +90,7 @@ func newErasureServerPools(ctx context.Context, endpointServerPools EndpointServ
} }
if err = storageclass.ValidateParity(commonParityDrives, ep.DrivesPerSet); err != nil { if err = storageclass.ValidateParity(commonParityDrives, ep.DrivesPerSet); err != nil {
return nil, fmt.Errorf("All current serverPools should have same parity ratio - expected %d, got %d", commonParityDrives, ecDrivesNoConfig(ep.DrivesPerSet)) return nil, fmt.Errorf("parity validation returned an error %w <- (%d, %d), for pool(%s)", err, commonParityDrives, ep.DrivesPerSet, humanize.Ordinal(i+1))
} }
storageDisks[i], formats[i], err = waitForFormatErasure(local, ep.Endpoints, i+1, storageDisks[i], formats[i], err = waitForFormatErasure(local, ep.Endpoints, i+1,
@ -115,7 +116,7 @@ func newErasureServerPools(ctx context.Context, endpointServerPools EndpointServ
// Validate if users brought different DeploymentID pools. // Validate if users brought different DeploymentID pools.
if deploymentID != formats[i].ID { if deploymentID != formats[i].ID {
return nil, fmt.Errorf("All serverPools should have same deployment ID expected %s, got %s", deploymentID, formats[i].ID) return nil, fmt.Errorf("all pools must have same deployment ID - expected %s, got %s for pool(%s)", deploymentID, formats[i].ID, humanize.Ordinal(i+1))
} }
z.serverPools[i], err = newErasureSets(ctx, ep, storageDisks[i], formats[i], commonParityDrives, i) z.serverPools[i], err = newErasureSets(ctx, ep, storageDisks[i], formats[i], commonParityDrives, i)

View File

@ -167,12 +167,12 @@ func ValidateParity(ssParity, setDriveCount int) error {
// SS parity disks should be greater than or equal to minParityDisks. // SS parity disks should be greater than or equal to minParityDisks.
// Parity below minParityDisks is not supported. // Parity below minParityDisks is not supported.
if ssParity > 0 && ssParity < minParityDisks { if ssParity > 0 && ssParity < minParityDisks {
return fmt.Errorf("Standard storage class parity %d should be greater than or equal to %d", return fmt.Errorf("parity %d should be greater than or equal to %d",
ssParity, minParityDisks) ssParity, minParityDisks)
} }
if ssParity > setDriveCount/2 { if ssParity > setDriveCount/2 {
return fmt.Errorf("Standard storage class parity %d should be less than or equal to %d", ssParity, setDriveCount/2) return fmt.Errorf("parity %d should be less than or equal to %d", ssParity, setDriveCount/2)
} }
return nil return nil