Fix free and total space reported in startup banner (#5419)

With storage class support, the free and total space
reported in Minio XL startup banner should be based on
totalDisks - standardClassParityDisks, instead of totalDisks/2.

fixes #5416
master
Nitish Tiwari 7 years ago committed by kannappanr
parent d0a43af616
commit e2d5a87b26
  1. 18
      cmd/xl-v1.go

@ -295,23 +295,27 @@ func getStorageInfo(disks []StorageAPI) StorageInfo {
} }
} }
_, sscParity := getRedundancyCount(standardStorageClass, len(disks))
_, rrscparity := getRedundancyCount(reducedRedundancyStorageClass, len(disks))
// Total number of online data drives available
// This is the number of drives we report free and total space for
availableDataDisks := uint64(onlineDisks - sscParity)
// Return calculated storage info, choose the lowest Total and // Return calculated storage info, choose the lowest Total and
// Free as the total aggregated values. Total capacity is always // Free as the total aggregated values. Total capacity is always
// the multiple of smallest disk among the disk list. // the multiple of smallest disk among the disk list.
storageInfo := StorageInfo{ storageInfo := StorageInfo{
Total: validDisksInfo[0].Total * uint64(onlineDisks) / 2, Total: validDisksInfo[0].Total * availableDataDisks,
Free: validDisksInfo[0].Free * uint64(onlineDisks) / 2, Free: validDisksInfo[0].Free * availableDataDisks,
} }
storageInfo.Backend.Type = Erasure storageInfo.Backend.Type = Erasure
storageInfo.Backend.OnlineDisks = onlineDisks storageInfo.Backend.OnlineDisks = onlineDisks
storageInfo.Backend.OfflineDisks = offlineDisks storageInfo.Backend.OfflineDisks = offlineDisks
_, scParity := getRedundancyCount(standardStorageClass, len(disks)) storageInfo.Backend.StandardSCParity = sscParity
storageInfo.Backend.StandardSCParity = scParity storageInfo.Backend.RRSCParity = rrscparity
_, rrSCparity := getRedundancyCount(reducedRedundancyStorageClass, len(disks))
storageInfo.Backend.RRSCParity = rrSCparity
return storageInfo return storageInfo
} }

Loading…
Cancel
Save