fix: generalize SC config and also skip healing sub-sys under SD (#15757)

This commit is contained in:
Harshavardhana
2022-09-26 09:04:54 -07:00
committed by GitHub
parent 048a46ec2a
commit 94dbb4a427
7 changed files with 84 additions and 68 deletions

View File

@@ -193,12 +193,14 @@ func validateParity(ssParity, rrsParity, setDriveCount int) (err error) {
return fmt.Errorf("Reduced redundancy storage class parity %d should be greater than or equal to %d", rrsParity, minParityDisks)
}
if ssParity > setDriveCount/2 {
return fmt.Errorf("Standard storage class parity %d should be less than or equal to %d", ssParity, setDriveCount/2)
}
if 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)
}
if rrsParity > setDriveCount/2 {
return fmt.Errorf("Reduced redundancy storage class parity %d should be less than or equal to %d", rrsParity, setDriveCount/2)
if rrsParity > setDriveCount/2 {
return fmt.Errorf("Reduced redundancy storage class parity %d should be less than or equal to %d", rrsParity, setDriveCount/2)
}
}
if ssParity > 0 && rrsParity > 0 {
@@ -283,6 +285,8 @@ func LookupConfig(kvs config.KVS, setDriveCount int) (cfg Config, err error) {
if err != nil {
return Config{}, err
}
} else {
cfg.Standard.Parity = DefaultParityBlocks(setDriveCount)
}
if rrsc != "" {
@@ -290,14 +294,11 @@ func LookupConfig(kvs config.KVS, setDriveCount int) (cfg Config, err error) {
if err != nil {
return Config{}, err
}
}
if cfg.RRS.Parity == 0 && rrsc == "" {
} else {
cfg.RRS.Parity = defaultRRSParity
}
if cfg.Standard.Parity == 0 && ssc == "" {
cfg.Standard.Parity = DefaultParityBlocks(setDriveCount)
if setDriveCount == 1 {
cfg.RRS.Parity = 0
}
}
// Validation is done after parsing both the storage classes. This is needed because we need one