aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_volume_configure_replication.go
diff options
context:
space:
mode:
authorhilimd <68371223+hilimd@users.noreply.github.com>2021-02-23 13:41:30 +0800
committerGitHub <noreply@github.com>2021-02-23 13:41:30 +0800
commit620b91f23eaf5718088dc9ddcf91540967d0c8a6 (patch)
tree04e92a8f92b548e26080040d009f23a51d9cc521 /weed/shell/command_volume_configure_replication.go
parent690d7c10b826b53bf823faef76603cd6ad83aa1d (diff)
parent90cdf9dcace5595b31104df3a3b7e4038a7db341 (diff)
downloadseaweedfs-620b91f23eaf5718088dc9ddcf91540967d0c8a6.tar.xz
seaweedfs-620b91f23eaf5718088dc9ddcf91540967d0c8a6.zip
Merge pull request #73 from chrislusf/master
sync
Diffstat (limited to 'weed/shell/command_volume_configure_replication.go')
-rw-r--r--weed/shell/command_volume_configure_replication.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/weed/shell/command_volume_configure_replication.go b/weed/shell/command_volume_configure_replication.go
index 539bdb515..e3f034873 100644
--- a/weed/shell/command_volume_configure_replication.go
+++ b/weed/shell/command_volume_configure_replication.go
@@ -56,11 +56,8 @@ func (c *commandVolumeConfigureReplication) Do(args []string, commandEnv *Comman
}
replicaPlacementInt32 := uint32(replicaPlacement.Byte())
- var resp *master_pb.VolumeListResponse
- err = commandEnv.MasterClient.WithClient(func(client master_pb.SeaweedClient) error {
- resp, err = client.VolumeList(context.Background(), &master_pb.VolumeListRequest{})
- return err
- })
+ // collect topology information
+ topologyInfo, _, err := collectTopologyInfo(commandEnv)
if err != nil {
return err
}
@@ -69,12 +66,14 @@ func (c *commandVolumeConfigureReplication) Do(args []string, commandEnv *Comman
// find all data nodes with volumes that needs replication change
var allLocations []location
- eachDataNode(resp.TopologyInfo, func(dc string, rack RackId, dn *master_pb.DataNodeInfo) {
+ eachDataNode(topologyInfo, func(dc string, rack RackId, dn *master_pb.DataNodeInfo) {
loc := newLocation(dc, string(rack), dn)
- for _, v := range dn.VolumeInfos {
- if v.Id == uint32(vid) && v.ReplicaPlacement != replicaPlacementInt32 {
- allLocations = append(allLocations, loc)
- continue
+ for _, diskInfo := range dn.DiskInfos {
+ for _, v := range diskInfo.VolumeInfos {
+ if v.Id == uint32(vid) && v.ReplicaPlacement != replicaPlacementInt32 {
+ allLocations = append(allLocations, loc)
+ continue
+ }
}
}
})