Skip to content

Commit 67a2422

Browse files
authored
Merge pull request #2730 from ConnorJC3/fix-throughput-2
[release-1.50] Fix throughput handling
2 parents 3f4fd47 + 3a16424 commit 67a2422

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

pkg/cloud/cloud.go

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -598,11 +598,9 @@ func extractVolumeKey(v *types.Volume, batcher volumeBatcherType) (string, error
598598

599599
func (c *cloud) CreateDisk(ctx context.Context, volumeName string, diskOptions *DiskOptions) (*Disk, error) {
600600
var (
601-
createType string
602-
iops int32
603-
throughput int32
604-
err error
605-
requestedIops int32
601+
createType string
602+
iops int32
603+
err error
606604
)
607605

608606
capacityGiB := util.BytesToGiB(diskOptions.CapacityBytes)
@@ -688,13 +686,13 @@ func (c *cloud) CreateDisk(ctx context.Context, volumeName string, diskOptions *
688686
return nil, fmt.Errorf("invalid AWS VolumeType %q", diskOptions.VolumeType)
689687
}
690688

691-
if iopsLimit.maxIops > 0 {
692-
if diskOptions.IOPS > 0 {
693-
requestedIops = diskOptions.IOPS
694-
} else if diskOptions.IOPSPerGB > 0 {
695-
requestedIops = diskOptions.IOPSPerGB * capacityGiB
696-
}
697-
iops = capIOPS(createType, capacityGiB, requestedIops, iopsLimit, diskOptions.AllowIOPSPerGBIncrease)
689+
if diskOptions.IOPS > 0 {
690+
iops = diskOptions.IOPS
691+
} else if diskOptions.IOPSPerGB > 0 {
692+
iops = diskOptions.IOPSPerGB * capacityGiB
693+
}
694+
if iopsLimit.maxIops > 0 && iops > 0 {
695+
iops = capIOPS(createType, capacityGiB, iops, iopsLimit, diskOptions.AllowIOPSPerGBIncrease)
698696
}
699697

700698
if len(diskOptions.KmsKeyID) > 0 {
@@ -704,8 +702,8 @@ func (c *cloud) CreateDisk(ctx context.Context, volumeName string, diskOptions *
704702
if iops > 0 {
705703
requestInput.Iops = aws.Int32(iops)
706704
}
707-
if throughput > 0 {
708-
requestInput.Throughput = aws.Int32(throughput)
705+
if diskOptions.Throughput > 0 {
706+
requestInput.Throughput = aws.Int32(diskOptions.Throughput)
709707
}
710708
snapshotID := diskOptions.SnapshotID
711709
if len(snapshotID) > 0 {

0 commit comments

Comments
 (0)