Skip to content

Commit

Permalink
fix: correctly calculate Power
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyberezansky committed Mar 28, 2023
1 parent 9f6086f commit b865786
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/wekafs/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"google.golang.org/grpc/status"
"io"
"io/fs"
"math"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -1117,7 +1118,7 @@ func (v *Volume) Create(ctx context.Context, capacity int64) error {
}
if v.isFilesystem() {
// filesystem size might be larger than free space, check it
fsSize := Max(int64(capacity), v.initialFilesystemSize)
fsSize := Max(capacity, v.initialFilesystemSize)
if fsSize > maxStorageCapacity {
return status.Errorf(codes.OutOfRange, fmt.Sprintf("Minimum filesystem size %d is set in storageClass, which exceeds total free capacity %d", fsSize, maxStorageCapacity))
}
Expand Down Expand Up @@ -1526,7 +1527,7 @@ func (v *Volume) ObtainRequestParams(ctx context.Context, params map[string]stri
if err != nil {
return err
}
v.initialFilesystemSize = int64(raw)*1024 ^ 3
v.initialFilesystemSize = int64(raw) * int64(math.Pow10(9))
}
return nil
}
Expand Down

0 comments on commit b865786

Please sign in to comment.