Skip to content

Commit e13de2b

Browse files
committed
cinder-csi-plugin: Use generated VolumeContext
Looks like an oversight in commit 7bfb2eb. Signed-off-by: Stephen Finucane <[email protected]>
1 parent 53a4505 commit e13de2b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pkg/csi/cinder/controllerserver.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
204204

205205
// Set scheduler hints if affinity or anti-affinity is set in PVC annotations
206206
var schedulerHints volumes.SchedulerHintOptsBuilder
207-
var volCtx map[string]string
207+
volCtx := map[string]string{}
208208
affinity := pvcAnnotations[affinityKey]
209209
antiAffinity := pvcAnnotations[antiAffinityKey]
210210
if affinity != "" || antiAffinity != "" {
@@ -1035,10 +1035,9 @@ func (cs *controllerServer) ControllerExpandVolume(ctx context.Context, req *csi
10351035

10361036
func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, ignoreVolumeAZ bool, accessibleTopologyReq *csi.TopologyRequirement) *csi.CreateVolumeResponse {
10371037
var volsrc *csi.VolumeContentSource
1038-
volCnx := map[string]string{}
10391038

10401039
if vol.SnapshotID != "" {
1041-
volCnx[ResizeRequired] = "true"
1040+
volCtx[ResizeRequired] = "true"
10421041

10431042
volsrc = &csi.VolumeContentSource{
10441043
Type: &csi.VolumeContentSource_Snapshot{
@@ -1050,7 +1049,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, igno
10501049
}
10511050

10521051
if vol.SourceVolID != "" {
1053-
volCnx[ResizeRequired] = "true"
1052+
volCtx[ResizeRequired] = "true"
10541053

10551054
volsrc = &csi.VolumeContentSource{
10561055
Type: &csi.VolumeContentSource_Volume{
@@ -1062,7 +1061,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, igno
10621061
}
10631062

10641063
if vol.BackupID != nil && *vol.BackupID != "" {
1065-
volCnx[ResizeRequired] = "true"
1064+
volCtx[ResizeRequired] = "true"
10661065

10671066
volsrc = &csi.VolumeContentSource{
10681067
Type: &csi.VolumeContentSource_Snapshot{
@@ -1094,7 +1093,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, igno
10941093
CapacityBytes: int64(vol.Size * 1024 * 1024 * 1024),
10951094
AccessibleTopology: accessibleTopology,
10961095
ContentSource: volsrc,
1097-
VolumeContext: volCnx,
1096+
VolumeContext: volCtx,
10981097
},
10991098
}
11001099

0 commit comments

Comments
 (0)