You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
424 B

  1. package stats
  2. import "github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
  3. func calculateDiskRemaining(disk *volume_server_pb.DiskStatus) {
  4. disk.Used = disk.All - disk.Free
  5. if disk.All > 0 {
  6. disk.PercentFree = float32((float64(disk.Free) / float64(disk.All)) * 100)
  7. disk.PercentUsed = float32((float64(disk.Used) / float64(disk.All)) * 100)
  8. } else {
  9. disk.PercentFree = 0
  10. disk.PercentUsed = 0
  11. }
  12. return
  13. }