Skip to content

Commit

Permalink
fix: WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyberezansky committed Mar 27, 2023
1 parent 9f6086f commit 35b02de
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/wekafs/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,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 @@ -1476,6 +1476,11 @@ func (v *Volume) waitForSnapshotDeletion(ctx context.Context, logger zerolog.Log
// ObtainRequestParams takes additional optional params from storage class params and applies them to Volume object
// those params then need to be set during actual volume creation via UpdateParams function
func (v *Volume) ObtainRequestParams(ctx context.Context, params map[string]string) error {
op := "CreateVolume"
ctx, span := otel.Tracer(TracerName).Start(ctx, op)
defer span.End()
ctx = log.With().Str("trace_id", span.SpanContext().TraceID().String()).Str("span_id", span.SpanContext().SpanID().String()).Str("op", op).Logger().WithContext(ctx)
logger := log.Ctx(ctx)
// set explicit mount options if were passed in storageclass
if val, ok := params["mountOptions"]; ok {
v.mountOptions.Merge(NewMountOptionsFromString(val))
Expand Down Expand Up @@ -1523,10 +1528,13 @@ func (v *Volume) ObtainRequestParams(ctx context.Context, params map[string]stri
// make sure to set min capacity if comes from request
if val, ok := params["initialFilesystemSizeGB"]; ok {
raw, err := strconv.Atoi(val)
logger.Error().Int("raw", raw).Msg("Received raw initialFilesystemSizeGB")
if err != nil {
return err
}
v.initialFilesystemSize = int64(raw)*1024 ^ 3
} else {
logger.Error().Msg("Failed to fetch params")
}
return nil
}
Expand Down

0 comments on commit 35b02de

Please sign in to comment.