aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_volume_balance.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-02-16 04:27:16 -0800
committerChris Lu <chris.lu@gmail.com>2021-02-16 04:27:16 -0800
commit43101ccea03f45de6d43b41a4d08eba1de1b89e6 (patch)
treefcd7481150cecbee07022072133299b32e35a065 /weed/shell/command_volume_balance.go
parent38bbef7ec1e945eef626bf6f638cbb0ec4dbe20b (diff)
downloadseaweedfs-43101ccea03f45de6d43b41a4d08eba1de1b89e6.tar.xz
seaweedfs-43101ccea03f45de6d43b41a4d08eba1de1b89e6.zip
move to the empty nodes first
Diffstat (limited to 'weed/shell/command_volume_balance.go')
-rw-r--r--weed/shell/command_volume_balance.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/weed/shell/command_volume_balance.go b/weed/shell/command_volume_balance.go
index f5fdf2216..a1e3c1ab6 100644
--- a/weed/shell/command_volume_balance.go
+++ b/weed/shell/command_volume_balance.go
@@ -213,6 +213,16 @@ func capacityByMaxVolumeCount(diskType types.DiskType) CapacityFunc {
}
}
+func capacityByFreeVolumeCount(diskType types.DiskType) CapacityFunc {
+ return func(info *master_pb.DataNodeInfo) int {
+ diskInfo, found := info.DiskInfos[string(diskType)]
+ if !found {
+ return 0
+ }
+ return int(diskInfo.MaxVolumeCount - diskInfo.VolumeCount)
+ }
+}
+
func (n *Node) localVolumeRatio(capacityFunc CapacityFunc) float64 {
return divide(len(n.selectedVolumes), capacityFunc(n.info))
}