Skip to content

Commit 0583d18

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 c5d2d2b commit 0583d18

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
@@ -208,7 +208,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
208208

209209
// Set scheduler hints if affinity or anti-affinity is set in PVC annotations
210210
var schedulerHints volumes.SchedulerHintOptsBuilder
211-
var volCtx map[string]string
211+
volCtx := map[string]string{}
212212
affinity := pvcAnnotations[affinityKey]
213213
antiAffinity := pvcAnnotations[antiAffinityKey]
214214
if affinity != "" || antiAffinity != "" {
@@ -1059,10 +1059,9 @@ func getTopology(vol *volumes.Volume, topologyReq *csi.TopologyRequirement, igno
10591059

10601060
func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, accessibleTopology []*csi.Topology) *csi.CreateVolumeResponse {
10611061
var volsrc *csi.VolumeContentSource
1062-
volCnx := map[string]string{}
10631062

10641063
if vol.SnapshotID != "" {
1065-
volCnx[ResizeRequired] = "true"
1064+
volCtx[ResizeRequired] = "true"
10661065

10671066
volsrc = &csi.VolumeContentSource{
10681067
Type: &csi.VolumeContentSource_Snapshot{
@@ -1074,7 +1073,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, acce
10741073
}
10751074

10761075
if vol.SourceVolID != "" {
1077-
volCnx[ResizeRequired] = "true"
1076+
volCtx[ResizeRequired] = "true"
10781077

10791078
volsrc = &csi.VolumeContentSource{
10801079
Type: &csi.VolumeContentSource_Volume{
@@ -1086,7 +1085,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, acce
10861085
}
10871086

10881087
if vol.BackupID != nil && *vol.BackupID != "" {
1089-
volCnx[ResizeRequired] = "true"
1088+
volCtx[ResizeRequired] = "true"
10901089

10911090
volsrc = &csi.VolumeContentSource{
10921091
Type: &csi.VolumeContentSource_Snapshot{
@@ -1103,7 +1102,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, acce
11031102
CapacityBytes: int64(vol.Size * 1024 * 1024 * 1024),
11041103
AccessibleTopology: accessibleTopology,
11051104
ContentSource: volsrc,
1106-
VolumeContext: volCnx,
1105+
VolumeContext: volCtx,
11071106
},
11081107
}
11091108

0 commit comments

Comments
 (0)