include ec shard for capacityByFreeVolumeCount

This commit is contained in:
chrislu 2022-10-09 22:31:30 -07:00
parent 98dc1e5c15
commit 0623bf582e

View file

@ -202,7 +202,11 @@ func capacityByFreeVolumeCount(diskType types.DiskType) CapacityFunc {
if !found {
return 0
}
return float64(diskInfo.MaxVolumeCount - diskInfo.VolumeCount)
var ecShardCount int
for _, ecShardInfo := range diskInfo.EcShardInfos {
ecShardCount += erasure_coding.ShardBits(ecShardInfo.EcIndexBits).ShardIdCount()
}
return float64(diskInfo.MaxVolumeCount-diskInfo.VolumeCount) - float64(ecShardCount)/erasure_coding.DataShardsCount
}
}