fix: add stricter validation for erasure server pools (#11299)

During expansion we need to validate if

- new deployment is expanded with newer constraints
- existing deployment is expanded with older constraints
- multiple server pools rejected if they have different
  deploymentID and distribution algo
This commit is contained in:
Harshavardhana
2021-01-19 10:01:31 -08:00
committed by GitHub
parent b5049d541f
commit 1ad2b7b699
6 changed files with 57 additions and 23 deletions

View File

@@ -363,19 +363,12 @@ func createServerEndpoints(serverAddr string, args ...string) (
}
var foundPrevLocal bool
var commonParityDrives int
for _, arg := range args {
setArgs, err := GetAllSets(arg)
if err != nil {
return nil, -1, err
}
parityDrives := ecDrivesNoConfig(len(setArgs[0]))
if commonParityDrives != 0 && commonParityDrives != parityDrives {
return nil, -1, fmt.Errorf("All serverPools should have same parity ratio - expected %d, got %d", commonParityDrives, parityDrives)
}
endpointList, gotSetupType, err := CreateEndpoints(serverAddr, foundPrevLocal, setArgs...)
if err != nil {
return nil, -1, err
@@ -388,10 +381,6 @@ func createServerEndpoints(serverAddr string, args ...string) (
return nil, -1, err
}
foundPrevLocal = endpointList.atleastOneEndpointLocal()
if commonParityDrives == 0 {
commonParityDrives = ecDrivesNoConfig(len(setArgs[0]))
}
if setupType == UnknownSetupType {
setupType = gotSetupType
}