mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-19 13:37:55 +08:00
shell: add volume.configure.replication to change replication for a volume
fix https://github.com/chrislusf/seaweedfs/issues/1192
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user