aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_volume_balance.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-02-16 04:16:46 -0800
committerChris Lu <chris.lu@gmail.com>2021-02-16 04:16:46 -0800
commit38bbef7ec1e945eef626bf6f638cbb0ec4dbe20b (patch)
treeb8771eb6875c42c9697e98316e986772493966bc /weed/shell/command_volume_balance.go
parentcb9cc295184c269da5d4e4028ca29badfa16eec7 (diff)
downloadseaweedfs-38bbef7ec1e945eef626bf6f638cbb0ec4dbe20b.tar.xz
seaweedfs-38bbef7ec1e945eef626bf6f638cbb0ec4dbe20b.zip
avoid nil
Diffstat (limited to 'weed/shell/command_volume_balance.go')
-rw-r--r--weed/shell/command_volume_balance.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/shell/command_volume_balance.go b/weed/shell/command_volume_balance.go
index 9fa915ea4..f5fdf2216 100644
--- a/weed/shell/command_volume_balance.go
+++ b/weed/shell/command_volume_balance.go
@@ -205,7 +205,10 @@ type CapacityFunc func(*master_pb.DataNodeInfo) int
func capacityByMaxVolumeCount(diskType types.DiskType) CapacityFunc {
return func(info *master_pb.DataNodeInfo) int {
- diskInfo := info.DiskInfos[string(diskType)]
+ diskInfo, found := info.DiskInfos[string(diskType)]
+ if !found {
+ return 0
+ }
return int(diskInfo.MaxVolumeCount)
}
}