Skip to content

Commit

Permalink
shell: fix moving volume, volume server evacuate
Browse files Browse the repository at this point in the history
fix #1534
  • Loading branch information
chrislusf committed Mar 15, 2021
1 parent ca10056 commit a4cfffc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
5 changes: 2 additions & 3 deletions weed/shell/command_volume_balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,8 @@ func adjustAfterMove(v *master_pb.VolumeInformationMessage, volumeReplicas map[u
if replica.location.dataNode.Id == fullNode.info.Id &&
replica.location.rack == fullNode.rack &&
replica.location.dc == fullNode.dc {
replica.location.dc = emptyNode.dc
replica.location.rack = emptyNode.rack
replica.location.dataNode = emptyNode.info
loc := newLocation(emptyNode.dc, emptyNode.rack, emptyNode.info)
replica.location = &loc
return
}
}
Expand Down
17 changes: 17 additions & 0 deletions weed/shell/command_volume_server_evacuate_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package shell

import (
"os"
"testing"
)

func TestVolumeServerEvacuate(t *testing.T) {
topologyInfo := parseOutput(topoData)

volumeServer := "192.168.1.4:8080"

if err := evacuateNormalVolumes(nil, topologyInfo, volumeServer, true, false, os.Stdout); err != nil {
t.Errorf("evacuate: %v", err)
}

}

0 comments on commit a4cfffc

Please sign in to comment.