shell: add volume.configure.replication to change replication for a volume

fix https://github.com/chrislusf/seaweedfs/issues/1192
This commit is contained in:
Chris Lu
2020-02-02 15:37:23 -08:00
parent fb19263a71
commit 40ae533fa3
10 changed files with 536 additions and 252 deletions

View File

@@ -1,6 +1,7 @@
package storage
import (
"fmt"
"os"
"github.com/chrislusf/seaweedfs/weed/glog"
@@ -36,5 +37,12 @@ func (v *Volume) maybeWriteSuperBlock() error {
func (v *Volume) readSuperBlock() (err error) {
v.SuperBlock, err = super_block.ReadSuperBlock(v.DataBackend)
if v.volumeInfo != nil && v.volumeInfo.Replication != ""{
if replication, err := super_block.NewReplicaPlacementFromString(v.volumeInfo.Replication); err != nil {
return fmt.Errorf("Error parse volume %d replication %s : %v", v.Id, v.volumeInfo.Replication, err)
} else {
v.SuperBlock.ReplicaPlacement = replication
}
}
return err
}