ec.balance: Allow EC balancing without collections. (#6488)
This commit is contained in:
@@ -1067,10 +1067,6 @@ func (ecb *ecBalancer) collectVolumeIdToEcNodes(collection string) map[needle.Vo
|
|||||||
}
|
}
|
||||||
|
|
||||||
func EcBalance(commandEnv *CommandEnv, collections []string, dc string, ecReplicaPlacement *super_block.ReplicaPlacement, maxParallelization int, applyBalancing bool) (err error) {
|
func EcBalance(commandEnv *CommandEnv, collections []string, dc string, ecReplicaPlacement *super_block.ReplicaPlacement, maxParallelization int, applyBalancing bool) (err error) {
|
||||||
if len(collections) == 0 {
|
|
||||||
return fmt.Errorf("no collections to balance")
|
|
||||||
}
|
|
||||||
|
|
||||||
// collect all ec nodes
|
// collect all ec nodes
|
||||||
allEcNodes, totalFreeEcSlots, err := collectEcNodesForDC(commandEnv, dc)
|
allEcNodes, totalFreeEcSlots, err := collectEcNodesForDC(commandEnv, dc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1088,11 +1084,15 @@ func EcBalance(commandEnv *CommandEnv, collections []string, dc string, ecReplic
|
|||||||
maxParallelization: maxParallelization,
|
maxParallelization: maxParallelization,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(collections) == 0 {
|
||||||
|
fmt.Printf("WARNING: No collections to balance EC volumes across.")
|
||||||
|
}
|
||||||
for _, c := range collections {
|
for _, c := range collections {
|
||||||
if err = ecb.balanceEcVolumes(c); err != nil {
|
if err = ecb.balanceEcVolumes(c); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ecb.balanceEcRacks(); err != nil {
|
if err := ecb.balanceEcRacks(); err != nil {
|
||||||
return fmt.Errorf("balance ec racks: %v", err)
|
return fmt.Errorf("balance ec racks: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user