aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_s3_bucket_quota_check.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/shell/command_s3_bucket_quota_check.go')
-rw-r--r--weed/shell/command_s3_bucket_quota_check.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/weed/shell/command_s3_bucket_quota_check.go b/weed/shell/command_s3_bucket_quota_check.go
index 066ef6909..a901af077 100644
--- a/weed/shell/command_s3_bucket_quota_check.go
+++ b/weed/shell/command_s3_bucket_quota_check.go
@@ -65,7 +65,7 @@ func (c *commandS3BucketQuotaEnforce) Do(args []string, commandEnv *CommandEnv,
return nil
}
collection := entry.Name
- var collectionSize uint64
+ var collectionSize float64
if collectionInfo, found := collectionInfos[collection]; found {
collectionSize = collectionInfo.Size
}
@@ -95,7 +95,7 @@ func (c *commandS3BucketQuotaEnforce) Do(args []string, commandEnv *CommandEnv,
}
-func (c *commandS3BucketQuotaEnforce) processEachBucket(fc *filer.FilerConf, filerBucketsPath string, entry *filer_pb.Entry, writer io.Writer, collectionSize uint64) (hasConfChanges bool) {
+func (c *commandS3BucketQuotaEnforce) processEachBucket(fc *filer.FilerConf, filerBucketsPath string, entry *filer_pb.Entry, writer io.Writer, collectionSize float64) (hasConfChanges bool) {
locPrefix := filerBucketsPath + "/" + entry.Name + "/"
locConf := fc.MatchStorageRule(locPrefix)
@@ -103,12 +103,12 @@ func (c *commandS3BucketQuotaEnforce) processEachBucket(fc *filer.FilerConf, fil
if entry.Quota > 0 {
if locConf.ReadOnly {
- if collectionSize < uint64(entry.Quota) {
+ if collectionSize < float64(entry.Quota) {
locConf.ReadOnly = false
hasConfChanges = true
}
} else {
- if collectionSize > uint64(entry.Quota) {
+ if collectionSize > float64(entry.Quota) {
locConf.ReadOnly = true
hasConfChanges = true
}
@@ -122,7 +122,7 @@ func (c *commandS3BucketQuotaEnforce) processEachBucket(fc *filer.FilerConf, fil
if hasConfChanges {
fmt.Fprintf(writer, " %s\tsize:%d", entry.Name, collectionSize)
- fmt.Fprintf(writer, "\tquota:%d\tusage:%.2f%%", entry.Quota, float64(collectionSize)*100/float64(entry.Quota))
+ fmt.Fprintf(writer, "\tquota:%d\tusage:%.2f%%", entry.Quota, collectionSize*100/float64(entry.Quota))
fmt.Fprintln(writer)
if locConf.ReadOnly {
fmt.Fprintf(writer, " changing bucket %s to read only!\n", entry.Name)