@@ -204,7 +204,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
204
204
205
205
// Set scheduler hints if affinity or anti-affinity is set in PVC annotations
206
206
var schedulerHints volumes.SchedulerHintOptsBuilder
207
- var volCtx map [string ]string
207
+ volCtx := map [string ]string {}
208
208
affinity := pvcAnnotations [affinityKey ]
209
209
antiAffinity := pvcAnnotations [antiAffinityKey ]
210
210
if affinity != "" || antiAffinity != "" {
@@ -1035,10 +1035,9 @@ func (cs *controllerServer) ControllerExpandVolume(ctx context.Context, req *csi
1035
1035
1036
1036
func getCreateVolumeResponse (vol * volumes.Volume , volCtx map [string ]string , ignoreVolumeAZ bool , accessibleTopologyReq * csi.TopologyRequirement ) * csi.CreateVolumeResponse {
1037
1037
var volsrc * csi.VolumeContentSource
1038
- volCnx := map [string ]string {}
1039
1038
1040
1039
if vol .SnapshotID != "" {
1041
- volCnx [ResizeRequired ] = "true"
1040
+ volCtx [ResizeRequired ] = "true"
1042
1041
1043
1042
volsrc = & csi.VolumeContentSource {
1044
1043
Type : & csi.VolumeContentSource_Snapshot {
@@ -1050,7 +1049,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, igno
1050
1049
}
1051
1050
1052
1051
if vol .SourceVolID != "" {
1053
- volCnx [ResizeRequired ] = "true"
1052
+ volCtx [ResizeRequired ] = "true"
1054
1053
1055
1054
volsrc = & csi.VolumeContentSource {
1056
1055
Type : & csi.VolumeContentSource_Volume {
@@ -1062,7 +1061,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, igno
1062
1061
}
1063
1062
1064
1063
if vol .BackupID != nil && * vol .BackupID != "" {
1065
- volCnx [ResizeRequired ] = "true"
1064
+ volCtx [ResizeRequired ] = "true"
1066
1065
1067
1066
volsrc = & csi.VolumeContentSource {
1068
1067
Type : & csi.VolumeContentSource_Snapshot {
@@ -1094,7 +1093,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, igno
1094
1093
CapacityBytes : int64 (vol .Size * 1024 * 1024 * 1024 ),
1095
1094
AccessibleTopology : accessibleTopology ,
1096
1095
ContentSource : volsrc ,
1097
- VolumeContext : volCnx ,
1096
+ VolumeContext : volCtx ,
1098
1097
},
1099
1098
}
1100
1099
0 commit comments