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