Skip to content

Commit 68887e1

Browse files
committed
Fix typo in capacity check condition
Should not retrun failure on requested capacity and max available capacity are same.
1 parent 5e2e086 commit 68887e1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pkg/hostpath/controllerserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ func (hp *hostPath) ControllerExpandVolume(ctx context.Context, req *csi.Control
703703
}
704704

705705
capacity := int64(capRange.GetRequiredBytes())
706-
if capacity >= maxStorageCapacity {
706+
if capacity > maxStorageCapacity {
707707
return nil, status.Errorf(codes.OutOfRange, "Requested capacity %d exceeds maximum allowed %d", capacity, maxStorageCapacity)
708708
}
709709

pkg/hostpath/hostpath.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ func getVolumePath(volID string) string {
275275
// It returns the volume path or err if one occurs. That error is suitable as result of a gRPC call.
276276
func (hp *hostPath) createVolume(volID, name string, cap int64, volAccessType accessType, ephemeral bool, kind string) (hpv *hostPathVolume, finalErr error) {
277277
// Check for maximum available capacity
278-
if cap >= maxStorageCapacity {
278+
if cap > maxStorageCapacity {
279279
return nil, status.Errorf(codes.OutOfRange, "Requested capacity %d exceeds maximum allowed %d", cap, maxStorageCapacity)
280280
}
281281
if hp.config.Capacity.Enabled() {

0 commit comments

Comments
 (0)