aboutsummaryrefslogtreecommitdiff
path: root/weed/stats/disk_common.go
diff options
context:
space:
mode:
authorDominic Pearson <dsp@technoanimal.net>2024-06-03 07:10:28 +0200
committerGitHub <noreply@github.com>2024-06-02 22:10:28 -0700
commitd8bde9b96e1e314534cd76345c61c623c5824132 (patch)
tree6c32bce60220d2d313719d64b608bd414271a6d6 /weed/stats/disk_common.go
parent579ebbdf602c13c839f6e933163cf16f81d25bfb (diff)
downloadseaweedfs-d8bde9b96e1e314534cd76345c61c623c5824132.tar.xz
seaweedfs-d8bde9b96e1e314534cd76345c61c623c5824132.zip
Solaris disk support (#5638)
Diffstat (limited to 'weed/stats/disk_common.go')
-rw-r--r--weed/stats/disk_common.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/weed/stats/disk_common.go b/weed/stats/disk_common.go
new file mode 100644
index 000000000..936c77e91
--- /dev/null
+++ b/weed/stats/disk_common.go
@@ -0,0 +1,17 @@
+package stats
+
+import "github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
+
+func calculateDiskRemaining(disk *volume_server_pb.DiskStatus) {
+ disk.Used = disk.All - disk.Free
+
+ if disk.All > 0 {
+ disk.PercentFree = float32((float64(disk.Free) / float64(disk.All)) * 100)
+ disk.PercentUsed = float32((float64(disk.Used) / float64(disk.All)) * 100)
+ } else {
+ disk.PercentFree = 0
+ disk.PercentUsed = 0
+ }
+
+ return
+}