@@ -208,7 +208,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
208
208
209
209
// Set scheduler hints if affinity or anti-affinity is set in PVC annotations
210
210
var schedulerHints volumes.SchedulerHintOptsBuilder
211
- var volCtx map [string ]string
211
+ volCtx := map [string ]string {}
212
212
affinity := pvcAnnotations [affinityKey ]
213
213
antiAffinity := pvcAnnotations [antiAffinityKey ]
214
214
if affinity != "" || antiAffinity != "" {
@@ -1059,10 +1059,9 @@ func getTopology(vol *volumes.Volume, topologyReq *csi.TopologyRequirement, igno
1059
1059
1060
1060
func getCreateVolumeResponse (vol * volumes.Volume , volCtx map [string ]string , accessibleTopology []* csi.Topology ) * csi.CreateVolumeResponse {
1061
1061
var volsrc * csi.VolumeContentSource
1062
- volCnx := map [string ]string {}
1063
1062
1064
1063
if vol .SnapshotID != "" {
1065
- volCnx [ResizeRequired ] = "true"
1064
+ volCtx [ResizeRequired ] = "true"
1066
1065
1067
1066
volsrc = & csi.VolumeContentSource {
1068
1067
Type : & csi.VolumeContentSource_Snapshot {
@@ -1074,7 +1073,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, acce
1074
1073
}
1075
1074
1076
1075
if vol .SourceVolID != "" {
1077
- volCnx [ResizeRequired ] = "true"
1076
+ volCtx [ResizeRequired ] = "true"
1078
1077
1079
1078
volsrc = & csi.VolumeContentSource {
1080
1079
Type : & csi.VolumeContentSource_Volume {
@@ -1086,7 +1085,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, acce
1086
1085
}
1087
1086
1088
1087
if vol .BackupID != nil && * vol .BackupID != "" {
1089
- volCnx [ResizeRequired ] = "true"
1088
+ volCtx [ResizeRequired ] = "true"
1090
1089
1091
1090
volsrc = & csi.VolumeContentSource {
1092
1091
Type : & csi.VolumeContentSource_Snapshot {
@@ -1103,7 +1102,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, acce
1103
1102
CapacityBytes : int64 (vol .Size * 1024 * 1024 * 1024 ),
1104
1103
AccessibleTopology : accessibleTopology ,
1105
1104
ContentSource : volsrc ,
1106
- VolumeContext : volCnx ,
1105
+ VolumeContext : volCtx ,
1107
1106
},
1108
1107
}
1109
1108
0 commit comments