diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-02-02 15:37:23 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-02-02 15:37:23 -0800 |
| commit | 40ae533fa34ae6e40fa31d6007e533a23391a5d8 (patch) | |
| tree | 7fe6ab2c8b30e7cc4df9cd42a67493198aa53ae5 /weed/storage/volume_super_block.go | |
| parent | fb19263a719b07d14f59cf8906c03a2a7d7ca3b8 (diff) | |
| download | seaweedfs-40ae533fa34ae6e40fa31d6007e533a23391a5d8.tar.xz seaweedfs-40ae533fa34ae6e40fa31d6007e533a23391a5d8.zip | |
shell: add volume.configure.replication to change replication for a volume
fix https://github.com/chrislusf/seaweedfs/issues/1192
Diffstat (limited to 'weed/storage/volume_super_block.go')
| -rw-r--r-- | weed/storage/volume_super_block.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/weed/storage/volume_super_block.go b/weed/storage/volume_super_block.go index 61c09d85a..1d7f35595 100644 --- a/weed/storage/volume_super_block.go +++ b/weed/storage/volume_super_block.go @@ -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 } |
