Skip to content

Commit 0a13c0b

Browse files
authored
Merge pull request #1892 from travisyx/automated-cherry-pick-of-#1875-upstream-release-1.15
Automated cherry pick of #1875: Require VACs to use SI units
2 parents 6491802 + 8aa27a9 commit 0a13c0b

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

pkg/common/parameters.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ func ExtractModifyVolumeParameters(parameters map[string]string) (ModifyVolumePa
343343
}
344344
modifyVolumeParams.IOPS = &iops
345345
case "throughput":
346-
throughput, err := ConvertStringToInt64(value)
346+
throughput, err := ConvertMiStringToInt64(value)
347347
if err != nil {
348348
return ModifyVolumeParameters{}, fmt.Errorf("parameters contain invalid throughput parameter: %w", err)
349349
}

pkg/common/parameters_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ func TestSnapshotParameters(t *testing.T) {
485485
func TestExtractModifyVolumeParameters(t *testing.T) {
486486
parameters := map[string]string{
487487
"iops": "1000",
488-
"throughput": "500",
488+
"throughput": "500Mi",
489489
}
490490

491491
iops := int64(1000)

pkg/gce-pd-csi-driver/controller_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -1789,7 +1789,7 @@ func TestCreateVolumeWithVolumeAttributeClassParameters(t *testing.T) {
17891789
},
17901790
},
17911791
},
1792-
MutableParameters: map[string]string{"iops": "20000", "throughput": "600"},
1792+
MutableParameters: map[string]string{"iops": "20000", "throughput": "600Mi"},
17931793
},
17941794
expIops: 20000,
17951795
expThroughput: 600,
@@ -1822,7 +1822,7 @@ func TestCreateVolumeWithVolumeAttributeClassParameters(t *testing.T) {
18221822
},
18231823
},
18241824
},
1825-
MutableParameters: map[string]string{"iops": "20000", "throughput": "600"},
1825+
MutableParameters: map[string]string{"iops": "20000", "throughput": "600Mi"},
18261826
},
18271827
expIops: 0,
18281828
expThroughput: 0,
@@ -1890,7 +1890,7 @@ func TestVolumeModifyOperation(t *testing.T) {
18901890
name: "Update volume with valid parameters",
18911891
req: &csi.ControllerModifyVolumeRequest{
18921892
VolumeId: testVolumeID,
1893-
MutableParameters: map[string]string{"iops": "20000", "throughput": "600"},
1893+
MutableParameters: map[string]string{"iops": "20000", "throughput": "600Mi"},
18941894
},
18951895
diskType: "hyperdisk-balanced",
18961896
params: &common.DiskParameters{
@@ -1906,7 +1906,7 @@ func TestVolumeModifyOperation(t *testing.T) {
19061906
name: "Update volume with invalid parameters",
19071907
req: &csi.ControllerModifyVolumeRequest{
19081908
VolumeId: testVolumeID,
1909-
MutableParameters: map[string]string{"iops": "0", "throughput": "0"},
1909+
MutableParameters: map[string]string{"iops": "0", "throughput": "0Mi"},
19101910
},
19111911
diskType: "hyperdisk-balanced",
19121912
params: &common.DiskParameters{
@@ -1922,7 +1922,7 @@ func TestVolumeModifyOperation(t *testing.T) {
19221922
name: "Update volume with valid parameters but invalid disk type",
19231923
req: &csi.ControllerModifyVolumeRequest{
19241924
VolumeId: testVolumeID,
1925-
MutableParameters: map[string]string{"iops": "20000", "throughput": "600"},
1925+
MutableParameters: map[string]string{"iops": "20000", "throughput": "600Mi"},
19261926
},
19271927
diskType: "pd-ssd",
19281928
params: &common.DiskParameters{
@@ -2053,7 +2053,7 @@ func TestVolumeModifyErrorHandling(t *testing.T) {
20532053
},
20542054
},
20552055
modifyReq: &csi.ControllerModifyVolumeRequest{
2056-
MutableParameters: map[string]string{"iops": "3001", "throughput": "151"},
2056+
MutableParameters: map[string]string{"iops": "3001", "throughput": "151Mi"},
20572057
},
20582058
modifyVolumeErrors: map[*meta.Key]error{
20592059
meta.ZonalKey(name, "us-central1-a"): &googleapi.Error{
@@ -2089,7 +2089,7 @@ func TestVolumeModifyErrorHandling(t *testing.T) {
20892089
},
20902090
},
20912091
modifyReq: &csi.ControllerModifyVolumeRequest{
2092-
MutableParameters: map[string]string{"iops": "10000", "throughput": "2400"},
2092+
MutableParameters: map[string]string{"iops": "10000", "throughput": "2400Mi"},
20932093
},
20942094
modifyVolumeErrors: map[*meta.Key]error{
20952095
meta.ZonalKey(name, "us-central1-a"): &googleapi.Error{Code: int(codes.InvalidArgument), Message: "InvalidArgument"},

test/k8s-integration/config/hdb-volumeattributesclass.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ metadata:
55
driverName: pd.csi.storage.gke.io
66
parameters:
77
iops: "3600"
8-
throughput: "290"
8+
throughput: "290Mi"

0 commit comments

Comments
 (0)