@@ -1060,10 +1060,10 @@ func getTopology(vol *volumes.Volume, topologyReq *csi.TopologyRequirement, igno
10601060
10611061func getCreateVolumeResponse (vol * volumes.Volume , volCtx map [string ]string , accessibleTopology []* csi.Topology ) * csi.CreateVolumeResponse {
10621062 var volSrc * csi.VolumeContentSource
1063+ var resizeRequired bool
10631064
10641065 if vol .SnapshotID != "" {
1065- volCtx [ResizeRequired ] = "true"
1066-
1066+ resizeRequired = true
10671067 volSrc = & csi.VolumeContentSource {
10681068 Type : & csi.VolumeContentSource_Snapshot {
10691069 Snapshot : & csi.VolumeContentSource_SnapshotSource {
@@ -1074,8 +1074,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, acce
10741074 }
10751075
10761076 if vol .SourceVolID != "" {
1077- volCtx [ResizeRequired ] = "true"
1078-
1077+ resizeRequired = true
10791078 volSrc = & csi.VolumeContentSource {
10801079 Type : & csi.VolumeContentSource_Volume {
10811080 Volume : & csi.VolumeContentSource_VolumeSource {
@@ -1086,8 +1085,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, acce
10861085 }
10871086
10881087 if vol .BackupID != nil && * vol .BackupID != "" {
1089- volCtx [ResizeRequired ] = "true"
1090-
1088+ resizeRequired = true
10911089 volSrc = & csi.VolumeContentSource {
10921090 Type : & csi.VolumeContentSource_Snapshot {
10931091 Snapshot : & csi.VolumeContentSource_SnapshotSource {
@@ -1097,6 +1095,11 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, acce
10971095 }
10981096 }
10991097
1098+ if volCtx == nil {
1099+ volCtx = map [string ]string {}
1100+ }
1101+ volCtx [ResizeRequired ] = "true"
1102+
11001103 resp := & csi.CreateVolumeResponse {
11011104 Volume : & csi.Volume {
11021105 VolumeId : vol .ID ,
0 commit comments